Last active
May 17, 2023 09:41
-
-
Save Meghatronics/e4ffd10f09ffcad418ad3f5c85940f9b to your computer and use it in GitHub Desktop.
This adds a simple navigator observer to your flutter app, and prints activities of the nav in your debug console. Note that there are some more methods in `NavigatorObserver` that were not overridden. You may need to override them, depending on how you use the navigator, however this gist should is sufficient for most popular cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| debugShowCheckedModeBanner: false, | |
| title: ThisApp._env.appName, | |
| navigatorKey: AppNavigator.key, | |
| navigatorObservers: [ | |
| AppNavigatorObserver.instance, | |
| ], | |
| routes: AppRoutes.routes, | |
| onGenerateRoute: AppRoutes.generateRoutes, | |
| home: const SplashView(), | |
| theme: ThemeData( | |
| fontFamily: AppStyles.walsheimFontFamily, | |
| extensions: [AppStyles(), AppColors()], | |
| bottomSheetTheme: const BottomSheetThemeData( | |
| clipBehavior: Clip.hardEdge, | |
| shape: RoundedRectangleBorder( | |
| borderRadius: BorderRadius.vertical( | |
| top: Radius.circular(40), | |
| ), | |
| ), | |
| ), | |
| ), | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment