From 401a6d3e4dafcc1fef14b909911373a6049c8bf5 Mon Sep 17 00:00:00 2001 From: "Bryant, Charles" Date: Thu, 7 Apr 2022 21:01:15 -0700 Subject: [PATCH] Revert "Merge pull request #1759 from UCSD/scrollfix" This reverts commit 14270fc43629af314abc1f0c7ce062e02211ad12, reversing changes made to e9b424a139dbb5a02659eb0b040c589463b8f079. --- lib/app_router.dart | 74 ++++++++++++++++++------------------ lib/ui/home/home.dart | 1 - lib/ui/navigator/bottom.dart | 11 +----- lib/ui/navigator/top.dart | 9 ++--- 4 files changed, 41 insertions(+), 54 deletions(-) diff --git a/lib/app_router.dart b/lib/app_router.dart index ad4fa084b..476fe1843 100644 --- a/lib/app_router.dart +++ b/lib/app_router.dart @@ -48,47 +48,47 @@ class Router { static Route generateRoute(RouteSettings settings) { switch (settings.name) { case RoutePaths.BottomNavigationBar: - return MaterialPageRoute(settings: settings, builder: (_) => BottomTabBar()); + return MaterialPageRoute(builder: (_) => BottomTabBar()); case RoutePaths.OnboardingInitial: - return MaterialPageRoute(settings: settings, builder: (_) => OnboardingInitial()); + return MaterialPageRoute(builder: (_) => OnboardingInitial()); case RoutePaths.Onboarding: - return MaterialPageRoute(settings: settings, builder: (_) => OnboardingScreen()); + return MaterialPageRoute(builder: (_) => OnboardingScreen()); case RoutePaths.OnboardingAffiliations: - return MaterialPageRoute(settings: settings, builder: (_) => OnboardingAffiliations()); + return MaterialPageRoute(builder: (_) => OnboardingAffiliations()); case RoutePaths.OnboardingLogin: - return MaterialPageRoute(settings: settings, builder: (_) => OnboardingLogin()); + return MaterialPageRoute(builder: (_) => OnboardingLogin()); case RoutePaths.Home: - return MaterialPageRoute(settings: settings, builder: (_) => Home()); + return MaterialPageRoute(builder: (_) => Home()); case RoutePaths.Map: - return MaterialPageRoute(settings: settings, builder: (_) => prefix0.Maps()); + return MaterialPageRoute(builder: (_) => prefix0.Maps()); case RoutePaths.MapSearch: - return MaterialPageRoute(settings: settings, builder: (_) => MapSearchView()); + return MaterialPageRoute(builder: (_) => MapSearchView()); case RoutePaths.Notifications: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return NotificationsListView(); }); case RoutePaths.Profile: - return MaterialPageRoute(settings: settings, builder: (_) => Profile()); + return MaterialPageRoute(builder: (_) => Profile()); case RoutePaths.NewsViewAll: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return NewsList(); }); case RoutePaths.EventsViewAll: - return MaterialPageRoute(settings: settings, builder: (context) { + return MaterialPageRoute(builder: (context) { Provider.of(context).changeTitle(settings.name); return EventsList(); }); case RoutePaths.NewsDetailView: Item newsItem = settings.arguments as Item; - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return NewsDetailView(data: newsItem); }); case RoutePaths.EventDetailView: EventModel data = settings.arguments as EventModel; - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return EventDetailView(data: data); }); @@ -98,37 +98,37 @@ class Router { return EventsAll(); }); case RoutePaths.ManageAvailabilityView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return ManageAvailabilityView(); }); case RoutePaths.VentilationBuildings: List data = settings.arguments as List; - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return VentilationBuildings(data); }); case RoutePaths.VentilationFloors: List data = settings.arguments as List; - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return VentilationFloors(data); }); case RoutePaths.VentilationRooms: List data = settings.arguments as List; - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return VentilationRooms(data); }); case RoutePaths.DiningViewAll: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return DiningList(); }); case RoutePaths.DiningDetailView: DiningModel data = settings.arguments as DiningModel; - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return DiningDetailView(data: data); }); @@ -139,83 +139,83 @@ class Router { String? disclaimer = arguments['disclaimer'] as String?; String? disclaimerEmail = arguments['disclaimerEmail'] as String?; return MaterialPageRoute( - settings: settings, builder: (_) => NutritionFactsView( + builder: (_) => NutritionFactsView( data: data, disclaimer: disclaimer, disclaimerEmail: disclaimerEmail, )); case RoutePaths.ManageParkingView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return ManageParkingView(); }); case RoutePaths.SpotTypesView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return SpotTypesView(); }); case RoutePaths.CardsView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return CardsView(); }); case RoutePaths.NotificationsSettingsView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return NotificationsSettingsView(); }); case RoutePaths.BluetoothPermissionsView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return AdvancedWayfindingPermission(); }); case RoutePaths.AutomaticBluetoothLoggerView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return AutomaticBluetoothLoggerView(); }); case RoutePaths.ClassScheduleViewAll: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return ClassList(); }); case RoutePaths.ManageParkingView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return ManageParkingView(); }); case RoutePaths.ParkingLotsView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name, done: true); return ParkingLotsView(); }); case RoutePaths.ParkingStructureView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name, done: true); return ParkingStructureView(); }); case RoutePaths.NeighborhoodsView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name, done: true); return NeighborhoodsView(); }); case RoutePaths.NeighborhoodsLotsView: List data = settings.arguments as List; - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name, done: true); return NeighborhoodLotsView(data); }); case RoutePaths.SpotTypesView: - return MaterialPageRoute(settings: settings, builder: (_) { + return MaterialPageRoute(builder: (_) { Provider.of(_).changeTitle(settings.name); return SpotTypesView(); }); case RoutePaths.BeaconView: - return MaterialPageRoute(settings: settings, builder: (_) => BeaconView()); + return MaterialPageRoute(builder: (_) => BeaconView()); case RoutePaths.ScanditScanner: - return MaterialPageRoute(settings: settings, builder: (_) => ScanditScanner()); + return MaterialPageRoute(builder: (_) => ScanditScanner()); default: - return MaterialPageRoute(settings: settings, builder: (_) => Home()); + return MaterialPageRoute(builder: (_) => Home()); } } } diff --git a/lib/ui/home/home.dart b/lib/ui/home/home.dart index 6e0c7628f..87c37fba0 100644 --- a/lib/ui/home/home.dart +++ b/lib/ui/home/home.dart @@ -94,7 +94,6 @@ class _HomeState extends State { padding: EdgeInsets.only( top: cardMargin + 2.0, right: 0.0, bottom: 0.0, left: 0.0), children: createList(context), - key: PageStorageKey('homePage'), ), ); } diff --git a/lib/ui/navigator/bottom.dart b/lib/ui/navigator/bottom.dart index f263aff74..ae51b4647 100644 --- a/lib/ui/navigator/bottom.dart +++ b/lib/ui/navigator/bottom.dart @@ -29,16 +29,7 @@ class _BottomTabBarState extends State { appBar: PreferredSize( preferredSize: Size.fromHeight(42), child: Provider.of(context).appBar), - body: IndexedStack( - children: [ - PushNotificationWrapper(child: Home()), - PushNotificationWrapper(child: prefix0.Maps()), - PushNotificationWrapper(child: NotificationsListView()), - PushNotificationWrapper(child: Profile()), - ], - - index: provider.currentIndex, - ), + body: PushNotificationWrapper(child: currentTab[provider.currentIndex]), bottomNavigationBar: BottomNavigationBar( type: BottomNavigationBarType.fixed, currentIndex: provider.currentIndex, diff --git a/lib/ui/navigator/top.dart b/lib/ui/navigator/top.dart index 82384181f..f6b33a1ec 100644 --- a/lib/ui/navigator/top.dart +++ b/lib/ui/navigator/top.dart @@ -47,12 +47,9 @@ class CMAppBar extends StatelessWidget { .currentIndex = NavigatorConstants.HomeTab; // Navigate to Home tab - Navigator.popUntil(context, (route) { - if (route.settings.name != 'bottom_navigation_bar') { - return false; - } - return true; - }); + Navigator.of(context).pushNamedAndRemoveUntil( + RoutePaths.BottomNavigationBar, + (Route route) => false); // change the appBar title to the ucsd logo Provider.of(context, listen: false)