From 6433bee0624b4ca676e7db8efca8d0e31f7cb05d Mon Sep 17 00:00:00 2001 From: Jules Date: Fri, 15 Mar 2024 10:18:20 +0100 Subject: [PATCH] fix: get current route for menu --- frontend/app_student/.run/main_dev.run.xml | 2 +- frontend/app_student/lib/menu/menu_view.dart | 5 ++++- .../app_student/lib/week_schedule/views/week_schedule.dart | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/app_student/.run/main_dev.run.xml b/frontend/app_student/.run/main_dev.run.xml index 9664ec2..b98f49e 100644 --- a/frontend/app_student/.run/main_dev.run.xml +++ b/frontend/app_student/.run/main_dev.run.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/frontend/app_student/lib/menu/menu_view.dart b/frontend/app_student/lib/menu/menu_view.dart index 6124351..dd70ecd 100644 --- a/frontend/app_student/lib/menu/menu_view.dart +++ b/frontend/app_student/lib/menu/menu_view.dart @@ -19,8 +19,11 @@ class MenuBarViewState extends State { _setSelectedIndex(); } + + void _setSelectedIndex() { - final route = GoRouter.of(context).overridePlatformDefaultLocation; + final route = GoRouter.of(context).routeInformationProvider.value.uri.path; + if (route == AppRoutes.loginPage) { _selectedIndex = 0; } else if (route == AppRoutes.schedulePage) { diff --git a/frontend/app_student/lib/week_schedule/views/week_schedule.dart b/frontend/app_student/lib/week_schedule/views/week_schedule.dart index a68a809..c80475f 100644 --- a/frontend/app_student/lib/week_schedule/views/week_schedule.dart +++ b/frontend/app_student/lib/week_schedule/views/week_schedule.dart @@ -64,7 +64,7 @@ class WeekSchedulePage extends StatelessWidget { } }, ), - bottomNavigationBar: const MenuBarView(), + bottomNavigationBar: MenuBarView(), ), ), );