From be50f8b293f8d45b538c25ab857a39314c563cfb Mon Sep 17 00:00:00 2001 From: Michael Thomas Date: Thu, 23 Mar 2023 12:23:24 -0400 Subject: [PATCH] fix home page state provider --- lib/src/routes/index.dart | 30 +++++++++++++++++------------- lib/src/routes/index.gr.dart | 2 +- lib/src/screens/home/index.dart | 3 ++- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/lib/src/routes/index.dart b/lib/src/routes/index.dart index 71a4a52..bc3b321 100644 --- a/lib/src/routes/index.dart +++ b/lib/src/routes/index.dart @@ -37,19 +37,23 @@ Route mapRouteBuilder(BuildContext context, Widget child, CustomPage pa replaceInRouteName: 'Screen,Route', routes: [ AutoRoute(path: "/", page: MainLayout, children: [ - AutoRoute(path: "home", name: "HomePageRouter", page: HomeScreen, children: [ - CustomRoute( - path: "", - page: HomePageHeader, - name: "HomeRoute", - transitionsBuilder: TransitionsBuilders.fadeIn, - ), - CustomRoute( - path: "student-id", - page: StudentIdScreen, - transitionsBuilder: TransitionsBuilders.fadeIn, - ), - ]), + AutoRoute( + path: "home", + name: "HomePageRouter", + page: HomeScreenProvider, + children: [ + CustomRoute( + path: "", + page: HomePageHeader, + name: "HomeRoute", + transitionsBuilder: TransitionsBuilders.fadeIn, + ), + CustomRoute( + path: "student-id", + page: StudentIdScreen, + transitionsBuilder: TransitionsBuilders.fadeIn, + ), + ]), AutoRoute(path: "map", page: MapScreen, children: [ CustomRoute( path: "", diff --git a/lib/src/routes/index.gr.dart b/lib/src/routes/index.gr.dart index 61af402..6b9bcd1 100644 --- a/lib/src/routes/index.gr.dart +++ b/lib/src/routes/index.gr.dart @@ -43,7 +43,7 @@ class AppRouter extends _i15.RootStackRouter { }, HomePageRouter.name: (routeData) { return _i15.MaterialPageX( - routeData: routeData, child: const _i2.HomeScreen()); + routeData: routeData, child: _i2.HomeScreenProvider()); }, MapRoute.name: (routeData) { return _i15.MaterialPageX( diff --git a/lib/src/screens/home/index.dart b/lib/src/screens/home/index.dart index 9a54a98..86a7c46 100644 --- a/lib/src/screens/home/index.dart +++ b/lib/src/screens/home/index.dart @@ -7,6 +7,8 @@ import 'package:furman_now/src/screens/home/state.dart'; import 'package:provider/provider.dart'; class HomeScreenProvider extends StatelessWidget { + const HomeScreenProvider({super.key}); + @override Widget build(BuildContext context) { return ChangeNotifierProvider( @@ -14,7 +16,6 @@ class HomeScreenProvider extends StatelessWidget { child: const HomeScreen(), ); } - } class HomeScreen extends StatefulWidget {