'Flutter Web - Screen Unresponsive after GenerateRoute

I am building an application using Flutter Web and facing an issue that sometimes the screen becomes unresponsive (20% of the time) when the page is loaded and the url directs the application to another Screen different than the default Screen (Main Screen). The page loads perfectly but when you try to interact with it it doesn't detect any gesture. The application is hosted on Firebase.

I would really appreciate your help, thanks!

Renderer Used: flutter build web --web-renderer canvaskit --release

MyApp
class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'AppOne',
      debugShowCheckedModeBanner: false,
      onGenerateRoute: RouteGenerator.generateRoute,
      initialRoute: RoutesName.MainPage,
      color: Colors.white,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MainScreen(),
    );
  }
}

class RoutesName {
  // ignore: non_constant_identifier_names
  static const String MainPage = '/Main';
  static const String OnlinePlatform = '/ONplatform';
  static const String ProductItem = 'ONplatform/Item';
  
}

class RouteGenerator {
  static Route<dynamic> generateRoute(RouteSettings settings) {
    var settingsName;
    if (settings.name != null) {
      settingsName = settings.name;
    }



    _GeneratePageRoute value = _GeneratePageRoute(
            widget: const MainScreen(), routeName: settingsName);;

    if (settings.name != null) {
      if (settings.name == RoutesName.MainPage) {
        value = _GeneratePageRoute(
            widget: const MainScreen(), routeName: settingsName);
      }
      if (settings.name == RoutesName.OnlinePlatform) {
        value = _GeneratePageRoute(
            widget: FSApplicationScreenExample(), routeName: settingsName);
      }

      if (settings.name.toString().length >= 16) {
        if (settings.name.toString().substring(0, 16) == '/ONplatform/Item') {
          value = _GeneratePageRoute(
              widget: FSApplicationScreenItemDetail(
                settings.name.toString().substring(16, 17),
                settings.name.toString().substring(17, 18),
                settings.name.toString().substring(18, 19),
                settings.name.toString().substring(19),
              ),
              routeName: settingsName);
        }
      }
    }
    return value;
  }
}

class _GeneratePageRoute extends PageRouteBuilder {
  final Widget widget;
  final String routeName;
  _GeneratePageRoute({required this.widget, required this.routeName})
      : super(
            settings: RouteSettings(name: routeName),
            pageBuilder: (BuildContext context, Animation<double> animation,
                Animation<double> secondaryAnimation) {
              return widget;
            },
            transitionDuration: Duration(milliseconds: 0),
            transitionsBuilder: (BuildContext context,
                Animation<double> animation,
                Animation<double> secondaryAnimation,
                Widget child) {
              return child;
            });
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source