fix home page state provider

This commit is contained in:
Michael Thomas 2023-03-23 12:23:24 -04:00
parent 279532ba7c
commit be50f8b293
3 changed files with 20 additions and 15 deletions

View File

@ -37,19 +37,23 @@ Route<T> mapRouteBuilder<T>(BuildContext context, Widget child, CustomPage<T> pa
replaceInRouteName: 'Screen,Route', replaceInRouteName: 'Screen,Route',
routes: <AutoRoute>[ routes: <AutoRoute>[
AutoRoute(path: "/", page: MainLayout, children: [ AutoRoute(path: "/", page: MainLayout, children: [
AutoRoute(path: "home", name: "HomePageRouter", page: HomeScreen, children: [ AutoRoute(
CustomRoute( path: "home",
path: "", name: "HomePageRouter",
page: HomePageHeader, page: HomeScreenProvider,
name: "HomeRoute", children: [
transitionsBuilder: TransitionsBuilders.fadeIn, CustomRoute(
), path: "",
CustomRoute( page: HomePageHeader,
path: "student-id", name: "HomeRoute",
page: StudentIdScreen, transitionsBuilder: TransitionsBuilders.fadeIn,
transitionsBuilder: TransitionsBuilders.fadeIn, ),
), CustomRoute(
]), path: "student-id",
page: StudentIdScreen,
transitionsBuilder: TransitionsBuilders.fadeIn,
),
]),
AutoRoute(path: "map", page: MapScreen, children: [ AutoRoute(path: "map", page: MapScreen, children: [
CustomRoute( CustomRoute(
path: "", path: "",

View File

@ -43,7 +43,7 @@ class AppRouter extends _i15.RootStackRouter {
}, },
HomePageRouter.name: (routeData) { HomePageRouter.name: (routeData) {
return _i15.MaterialPageX<dynamic>( return _i15.MaterialPageX<dynamic>(
routeData: routeData, child: const _i2.HomeScreen()); routeData: routeData, child: _i2.HomeScreenProvider());
}, },
MapRoute.name: (routeData) { MapRoute.name: (routeData) {
return _i15.MaterialPageX<dynamic>( return _i15.MaterialPageX<dynamic>(

View File

@ -7,6 +7,8 @@ import 'package:furman_now/src/screens/home/state.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class HomeScreenProvider extends StatelessWidget { class HomeScreenProvider extends StatelessWidget {
const HomeScreenProvider({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ChangeNotifierProvider( return ChangeNotifierProvider(
@ -14,7 +16,6 @@ class HomeScreenProvider extends StatelessWidget {
child: const HomeScreen(), child: const HomeScreen(),
); );
} }
} }
class HomeScreen extends StatefulWidget { class HomeScreen extends StatefulWidget {