diff --git a/uni/lib/main.dart b/uni/lib/main.dart index a9f562604..5b55c4434 100644 --- a/uni/lib/main.dart +++ b/uni/lib/main.dart @@ -36,8 +36,10 @@ import 'package:uni/view/library/library.dart'; import 'package:uni/view/locale_notifier.dart'; import 'package:uni/view/locations/locations.dart'; import 'package:uni/view/login/login.dart'; +import 'package:uni/view/profile/profile.dart'; import 'package:uni/view/restaurant/restaurant_page_view.dart'; import 'package:uni/view/schedule/schedule.dart'; +import 'package:uni/view/settings/settings.dart'; import 'package:uni/view/theme.dart'; import 'package:uni/view/theme_notifier.dart'; import 'package:uni/view/useful_info/useful_info.dart'; @@ -242,6 +244,13 @@ class ApplicationState extends State { page: const UsefulInfoPageView(), settings: settings, ), + '/${DrawerItem.navProfile.title}': + MaterialPageRoute( + builder: (__) => const ProfilePageView(), + ), + '/${DrawerItem.navSettings.title}': MaterialPageRoute( + builder: (_) => const SettingsPage(), + ), }; return transitions[settings.name]; }, diff --git a/uni/lib/utils/drawer_items.dart b/uni/lib/utils/drawer_items.dart index 09d1e6f7d..58a0bd657 100644 --- a/uni/lib/utils/drawer_items.dart +++ b/uni/lib/utils/drawer_items.dart @@ -8,7 +8,9 @@ enum DrawerItem { navRestaurants('restaurantes'), navCalendar('calendario'), navLibrary('biblioteca', faculties: {'feup'}), - navUsefulInfo('uteis', faculties: {'feup'}); + navUsefulInfo('uteis', faculties: {'feup'}), + navProfile('perfil'), + navSettings('definicoes'); const DrawerItem(this.title, {this.faculties}); diff --git a/uni/lib/utils/navbar_items.dart b/uni/lib/utils/navbar_items.dart index 607705410..7b13ab60f 100644 --- a/uni/lib/utils/navbar_items.dart +++ b/uni/lib/utils/navbar_items.dart @@ -9,10 +9,7 @@ enum NavbarItem { Icons.school_outlined, ['horario', 'exames', 'cadeiras'], ), - navTransports( - Icons.directions_bus_filled_outlined, - ['autocarros'] - ), + navTransports(Icons.directions_bus_filled_outlined, ['autocarros']), navFaculty( Icons.domain_outlined, ['locais', 'biblioteca', 'uteis'], diff --git a/uni/lib/view/common_widgets/pages_layouts/general/general.dart b/uni/lib/view/common_widgets/pages_layouts/general/general.dart index 81dec89e2..c17650fc9 100644 --- a/uni/lib/view/common_widgets/pages_layouts/general/general.dart +++ b/uni/lib/view/common_widgets/pages_layouts/general/general.dart @@ -11,7 +11,6 @@ import 'package:uni/model/providers/startup/session_provider.dart'; import 'package:uni/utils/drawer_items.dart'; import 'package:uni/view/common_widgets/pages_layouts/general/widgets/bottom_navigation_bar.dart'; import 'package:uni/view/common_widgets/pages_layouts/general/widgets/navigation_drawer.dart'; -import 'package:uni/view/profile/profile.dart'; /// Page with a hamburger menu and the user profile picture abstract class GeneralPageViewState extends State { @@ -187,11 +186,9 @@ abstract class GeneralPageViewState extends State { ) { return TextButton( onPressed: () => { - Navigator.push( + Navigator.pushNamed( context, - MaterialPageRoute( - builder: (__) => const ProfilePageView(), - ), + '/${DrawerItem.navProfile.title}', ), }, child: Container( diff --git a/uni/lib/view/common_widgets/pages_layouts/general/widgets/bottom_navigation_bar.dart b/uni/lib/view/common_widgets/pages_layouts/general/widgets/bottom_navigation_bar.dart index 7eecbbfa5..cb6464220 100644 --- a/uni/lib/view/common_widgets/pages_layouts/general/widgets/bottom_navigation_bar.dart +++ b/uni/lib/view/common_widgets/pages_layouts/general/widgets/bottom_navigation_bar.dart @@ -55,16 +55,16 @@ class AppBottomNavbarState extends State { final currentIndex = _getCurrentIndex(); return BottomNavigationBar( items: navbarItems, - type: currentIndex == -1 ? BottomNavigationBarType.fixed - : BottomNavigationBarType.shifting, + onTap: _onItemTapped, currentIndex: currentIndex == -1 ? 0 : currentIndex, + type: BottomNavigationBarType.fixed, + iconSize: 32, selectedItemColor: currentIndex == -1 ? Theme.of(context).colorScheme.onSurface : Theme.of(context).primaryColor, unselectedItemColor: Theme.of(context).colorScheme.onSurface, showSelectedLabels: false, showUnselectedLabels: false, - onTap: _onItemTapped, ); } } diff --git a/uni/lib/view/common_widgets/pages_layouts/secondary/secondary.dart b/uni/lib/view/common_widgets/pages_layouts/secondary/secondary.dart index 9266ffc0c..652f04ede 100644 --- a/uni/lib/view/common_widgets/pages_layouts/secondary/secondary.dart +++ b/uni/lib/view/common_widgets/pages_layouts/secondary/secondary.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; +import 'package:uni/view/common_widgets/pages_layouts/general/widgets/bottom_navigation_bar.dart'; /// Page with a back button on top abstract class SecondaryPageViewState @@ -8,6 +9,9 @@ abstract class SecondaryPageViewState Scaffold getScaffold(BuildContext context, Widget body) { return Scaffold( appBar: buildAppBar(context), + bottomNavigationBar: AppBottomNavbar( + parentContext: context, + ), body: refreshState(context, body), ); } diff --git a/uni/lib/view/profile/profile.dart b/uni/lib/view/profile/profile.dart index 210ad2f5a..3df656afd 100644 --- a/uni/lib/view/profile/profile.dart +++ b/uni/lib/view/profile/profile.dart @@ -3,13 +3,13 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:uni/model/entities/profile.dart'; import 'package:uni/model/providers/startup/profile_provider.dart'; +import 'package:uni/utils/drawer_items.dart'; import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/lazy_consumer.dart'; import 'package:uni/view/profile/widgets/account_info_card.dart'; import 'package:uni/view/profile/widgets/course_info_card.dart'; import 'package:uni/view/profile/widgets/print_info_card.dart'; import 'package:uni/view/profile/widgets/profile_overview.dart'; -import 'package:uni/view/settings/settings.dart'; class ProfilePageView extends StatefulWidget { const ProfilePageView({super.key}); @@ -60,11 +60,9 @@ class ProfilePageViewState extends SecondaryPageViewState { padding: const EdgeInsets.fromLTRB(0, 10, 20, 10), child: IconButton( icon: const Icon(Icons.settings), - onPressed: () => Navigator.push( + onPressed: () => Navigator.pushNamed( context, - MaterialPageRoute( - builder: (_) => const SettingsPage(), - ), + '/${DrawerItem.navSettings.title}', ), ), );