From caf89bb6796156ffe4cda9fe11fdfc135dac97d3 Mon Sep 17 00:00:00 2001 From: Yuta1409 Date: Fri, 15 Mar 2024 09:56:53 +0100 Subject: [PATCH] fix: menu --- frontend/app_student/.run/main_dev.run.xml | 2 +- frontend/app_student/.run/main_prod.run.xml | 2 +- frontend/app_student/lib/menu/menu_view.dart | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/frontend/app_student/.run/main_dev.run.xml b/frontend/app_student/.run/main_dev.run.xml index b98f49e..9664ec2 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/.run/main_prod.run.xml b/frontend/app_student/.run/main_prod.run.xml index 7a31433..8efd9b5 100644 --- a/frontend/app_student/.run/main_prod.run.xml +++ b/frontend/app_student/.run/main_prod.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 5c1c4cb..cb4894e 100644 --- a/frontend/app_student/lib/menu/menu_view.dart +++ b/frontend/app_student/lib/menu/menu_view.dart @@ -11,7 +11,24 @@ class MenuBarView extends StatefulWidget { } class MenuBarViewState extends State { - int _selectedIndex = 0; + int _selectedIndex = 1; + + @override + void initState() { + super.initState(); + _setSelectedIndex(); + } + + void _setSelectedIndex() { + final route = GoRouter.of(context).overridePlatformDefaultLocation; + if(route == AppRoutes.loginPage){ + _selectedIndex = 0; + } else if(route == AppRoutes.schedulePage){ + _selectedIndex = 1; + } else if(route == AppRoutes.profilPage){ + _selectedIndex = 2; + } + } void _onItemTapped(int index) { setState(() {