diff --git a/uni/lib/main.dart b/uni/lib/main.dart index a21e099b4..21dfe91fd 100644 --- a/uni/lib/main.dart +++ b/uni/lib/main.dart @@ -29,7 +29,7 @@ import 'package:uni/model/providers/plausible/plausible_provider.dart'; import 'package:uni/model/providers/startup/profile_provider.dart'; import 'package:uni/model/providers/startup/session_provider.dart'; import 'package:uni/model/providers/state_providers.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/academic_path/academic_path.dart'; import 'package:uni/view/bus_stop_next_arrivals/bus_stop_next_arrivals.dart'; import 'package:uni/view/calendar/calendar.dart'; @@ -42,8 +42,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/transports/transports.dart'; @@ -226,68 +228,79 @@ class ApplicationState extends State { GlobalCupertinoLocalizations.delegate, ], supportedLocales: S.delegate.supportedLocales, + initialRoute: '/${NavigationItem.navPersonalArea.route}', home: widget.initialWidget, navigatorObservers: navigatorObservers, onGenerateRoute: (RouteSettings settings) { final transitions = { - '/${DrawerItem.navPersonalArea.title}': + '/${NavigationItem.navPersonalArea.route}': PageTransition.makePageTransition( page: const HomePageView(), settings: settings, ), - '/${DrawerItem.navSchedule.title}': + '/${NavigationItem.navSchedule.route}': PageTransition.makePageTransition( page: const SchedulePage(), settings: settings, ), - '/${DrawerItem.navExams.title}': PageTransition.makePageTransition( + '/${NavigationItem.navExams.route}': + PageTransition.makePageTransition( page: const ExamsPageView(), settings: settings, ), - '/${DrawerItem.navStops.title}': PageTransition.makePageTransition( + '/${NavigationItem.navStops.route}': + PageTransition.makePageTransition( page: const BusStopNextArrivalsPage(), settings: settings, ), - '/${DrawerItem.navCourseUnits.title}': + '/${NavigationItem.navCourseUnits.route}': PageTransition.makePageTransition( page: const CourseUnitsPageView(), settings: settings, ), - '/${DrawerItem.navLocations.title}': + '/${NavigationItem.navLocations.route}': PageTransition.makePageTransition( page: const LocationsPage(), settings: settings, ), - '/${DrawerItem.navRestaurants.title}': + '/${NavigationItem.navRestaurants.route}': PageTransition.makePageTransition( page: const RestaurantPageView(), settings: settings, ), - '/${DrawerItem.navCalendar.title}': + '/${NavigationItem.navCalendar.route}': PageTransition.makePageTransition( page: const CalendarPageView(), settings: settings, ), - '/${DrawerItem.navLibrary.title}': + '/${NavigationItem.navLibrary.route}': PageTransition.makePageTransition( page: const LibraryPage(), settings: settings, ), - '/${DrawerItem.navFaculty.title}': + '/${NavigationItem.navFaculty.route}': PageTransition.makePageTransition( page: const FacultyPageView(), settings: settings, ), - '/${DrawerItem.navAcademicPath.title}': + '/${NavigationItem.navAcademicPath.route}': PageTransition.makePageTransition( page: const AcademicPathPageView(), settings: settings, ), - '/${DrawerItem.navTransports.title}': + '/${NavigationItem.navTransports.route}': PageTransition.makePageTransition( page: const TransportsPageView(), settings: settings, ), + '/${NavigationItem.navProfile.route}': + MaterialPageRoute( + builder: (__) => const ProfilePageView(), + ), + '/${NavigationItem.navSettings.route}': + MaterialPageRoute( + builder: (_) => const SettingsPage(), + ), }; return transitions[settings.name]; }, diff --git a/uni/lib/utils/navbar_items.dart b/uni/lib/utils/navbar_items.dart new file mode 100644 index 000000000..01c7785c4 --- /dev/null +++ b/uni/lib/utils/navbar_items.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; +import 'package:uni/utils/navigation_items.dart'; + +enum NavbarItem { + navPersonalArea( + Icons.home_outlined, + Icons.home, + NavigationItem.navPersonalArea, + ), + navAcademicPath( + Icons.school_outlined, + Icons.school, + NavigationItem.navAcademicPath, + ), + navRestaurants( + Icons.local_cafe_outlined, + Icons.local_cafe, + NavigationItem.navRestaurants, + ), + navFaculty(Icons.domain_outlined, Icons.domain, NavigationItem.navFaculty), + navTransports(Icons.map_outlined, Icons.map, NavigationItem.navTransports); + + const NavbarItem(this.unselectedIcon, this.selectedIcon, this.item); + + final IconData unselectedIcon; + final IconData selectedIcon; + final NavigationItem item; + + BottomNavigationBarItem toUnselectedBottomNavigationBarItem() { + return BottomNavigationBarItem( + icon: Icon(unselectedIcon), + label: '', + ); + } + + BottomNavigationBarItem toSelectedBottomNavigationBarItem() { + return BottomNavigationBarItem( + icon: Icon(selectedIcon), + label: '', + ); + } + + String get route { + return item.route; + } +} diff --git a/uni/lib/utils/drawer_items.dart b/uni/lib/utils/navigation_items.dart similarity index 80% rename from uni/lib/utils/drawer_items.dart rename to uni/lib/utils/navigation_items.dart index 064a717f4..67078affc 100644 --- a/uni/lib/utils/drawer_items.dart +++ b/uni/lib/utils/navigation_items.dart @@ -1,4 +1,4 @@ -enum DrawerItem { +enum NavigationItem { navPersonalArea('area'), navSchedule('horario'), navExams('exames'), @@ -10,11 +10,13 @@ enum DrawerItem { navLibrary('biblioteca', faculties: {'feup'}), navFaculty('faculdade'), navAcademicPath('percurso_academico'), + navProfile('perfil'), + navSettings('definicoes'), navTransports('transportes'); - const DrawerItem(this.title, {this.faculties}); + const NavigationItem(this.route, {this.faculties}); - final String title; + final String route; final Set? faculties; bool isVisible(List userFaculties) { diff --git a/uni/lib/view/about/about.dart b/uni/lib/view/about/about.dart index a0c17a67c..037e195bc 100644 --- a/uni/lib/view/about/about.dart +++ b/uni/lib/view/about/about.dart @@ -37,4 +37,9 @@ class AboutPageViewState extends SecondaryPageViewState { @override Future onRefresh(BuildContext context) async {} + + @override + String? getTitle() { + return null; + } } diff --git a/uni/lib/view/academic_path/academic_path.dart b/uni/lib/view/academic_path/academic_path.dart index e06ef1d65..9e4bff366 100644 --- a/uni/lib/view/academic_path/academic_path.dart +++ b/uni/lib/view/academic_path/academic_path.dart @@ -1,9 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:uni/generated/l10n.dart'; -import 'package:uni/utils/drawer_items.dart'; import 'package:uni/view/academic_path/widgets/course_units_card.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; import 'package:uni/view/home/widgets/exam_card.dart'; import 'package:uni/view/home/widgets/schedule_card.dart'; @@ -26,14 +23,7 @@ class AcademicPathPageViewState extends GeneralPageViewState { @override Widget getBody(BuildContext context) { return ListView( - children: [ - PageTitle( - name: S.of(context).nav_title(DrawerItem.navAcademicPath.title), - ), - Column( - children: academicPathCards, - ), - ], + children: academicPathCards, ); } diff --git a/uni/lib/view/academic_path/widgets/course_units_card.dart b/uni/lib/view/academic_path/widgets/course_units_card.dart index e2553b683..828f3e43b 100644 --- a/uni/lib/view/academic_path/widgets/course_units_card.dart +++ b/uni/lib/view/academic_path/widgets/course_units_card.dart @@ -4,7 +4,7 @@ import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/course_units/course_unit.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/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; import 'package:uni/view/course_units/widgets/course_unit_card.dart'; import 'package:uni/view/lazy_consumer.dart'; @@ -73,9 +73,9 @@ class CourseUnitsCard extends GenericCard { @override String getTitle(BuildContext context) => - S.of(context).nav_title(DrawerItem.navCourseUnits.title); + S.of(context).nav_title(NavigationItem.navCourseUnits.route); @override Future onClick(BuildContext context) => - Navigator.pushNamed(context, '/${DrawerItem.navCourseUnits.title}'); + Navigator.pushNamed(context, '/${NavigationItem.navCourseUnits.route}'); } diff --git a/uni/lib/view/bug_report/bug_report.dart b/uni/lib/view/bug_report/bug_report.dart index 26b9ae931..413c1859e 100644 --- a/uni/lib/view/bug_report/bug_report.dart +++ b/uni/lib/view/bug_report/bug_report.dart @@ -22,4 +22,9 @@ class BugReportPageViewState extends SecondaryPageViewState { @override Future onRefresh(BuildContext context) async {} + + @override + String? getTitle() { + return null; + } } diff --git a/uni/lib/view/bus_stop_next_arrivals/bus_stop_next_arrivals.dart b/uni/lib/view/bus_stop_next_arrivals/bus_stop_next_arrivals.dart index c0eda0b68..1c32963da 100644 --- a/uni/lib/view/bus_stop_next_arrivals/bus_stop_next_arrivals.dart +++ b/uni/lib/view/bus_stop_next_arrivals/bus_stop_next_arrivals.dart @@ -5,13 +5,12 @@ import 'package:provider/provider.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/bus_stop.dart'; import 'package:uni/model/providers/lazy/bus_stop_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/bus_stop_next_arrivals/widgets/bus_stop_row.dart'; import 'package:uni/view/bus_stop_selection/bus_stop_selection.dart'; import 'package:uni/view/common_widgets/expanded_image_label.dart'; import 'package:uni/view/common_widgets/last_update_timestamp.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; -import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; +import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/lazy_consumer.dart'; class BusStopNextArrivalsPage extends StatefulWidget { @@ -23,18 +22,12 @@ class BusStopNextArrivalsPage extends StatefulWidget { /// Manages the 'Bus arrivals' section inside the user's personal area class BusStopNextArrivalsPageState - extends GeneralPageViewState { + extends SecondaryPageViewState { @override Widget getBody(BuildContext context) { return SingleChildScrollView( child: Column( children: [ - Container( - padding: const EdgeInsets.only(bottom: 12), - child: PageTitle( - name: S.of(context).nav_title(DrawerItem.navStops.title), - ), - ), Container( padding: const EdgeInsets.all(8), child: Row( @@ -104,6 +97,9 @@ class BusStopNextArrivalsPageState return Provider.of(context, listen: false) .forceRefresh(context); } + + @override + String? getTitle() => S.of(context).nav_title(NavigationItem.navStops.route); } class NextArrivals extends StatefulWidget { diff --git a/uni/lib/view/bus_stop_selection/bus_stop_selection.dart b/uni/lib/view/bus_stop_selection/bus_stop_selection.dart index 14c689c5c..99b7d530f 100644 --- a/uni/lib/view/bus_stop_selection/bus_stop_selection.dart +++ b/uni/lib/view/bus_stop_selection/bus_stop_selection.dart @@ -6,7 +6,6 @@ import 'package:uni/model/entities/bus_stop.dart'; import 'package:uni/model/providers/lazy/bus_stop_provider.dart'; import 'package:uni/view/bus_stop_selection/widgets/bus_stop_search.dart'; import 'package:uni/view/bus_stop_selection/widgets/bus_stop_selection_row.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; class BusStopSelectionPage extends StatefulWidget { @@ -49,7 +48,6 @@ class BusStopSelectionPageState bottom: 20, ), children: [ - PageTitle(name: S.of(context).configured_buses), Container( padding: const EdgeInsets.all(20), child: Text( @@ -85,4 +83,7 @@ class BusStopSelectionPageState @override Future onRefresh(BuildContext context) async {} + + @override + String? getTitle() => S.of(context).configured_buses; } diff --git a/uni/lib/view/calendar/calendar.dart b/uni/lib/view/calendar/calendar.dart index 39526d3fa..e65739d68 100644 --- a/uni/lib/view/calendar/calendar.dart +++ b/uni/lib/view/calendar/calendar.dart @@ -4,10 +4,9 @@ import 'package:timelines/timelines.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/calendar_event.dart'; import 'package:uni/model/providers/lazy/calendar_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/calendar/widgets/calendar_tile.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; -import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; +import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/lazy_consumer.dart'; class CalendarPageView extends StatefulWidget { @@ -17,47 +16,40 @@ class CalendarPageView extends StatefulWidget { State createState() => CalendarPageViewState(); } -class CalendarPageViewState extends GeneralPageViewState { +class CalendarPageViewState extends SecondaryPageViewState { @override Widget getBody(BuildContext context) { - return ListView( - children: [ - Container( - padding: const EdgeInsets.only(bottom: 6), - child: PageTitle( - name: S.of(context).nav_title(DrawerItem.navCalendar.title), - ), + return LazyConsumer>( + builder: getTimeline, + hasContent: (calendar) => calendar.isNotEmpty, + onNullContent: const Center( + child: Text( + 'Nenhum evento encontrado', + style: TextStyle(fontSize: 18), ), - LazyConsumer>( - builder: getTimeline, - hasContent: (calendar) => calendar.isNotEmpty, - onNullContent: const Center( - child: Text( - 'Nenhum evento encontrado', - style: TextStyle(fontSize: 18), - ), - ), - ), - ], + ), ); } Widget getTimeline(BuildContext context, List calendar) { - return FixedTimeline.tileBuilder( - theme: TimelineTheme.of(context).copyWith( - connectorTheme: TimelineTheme.of(context) - .connectorTheme - .copyWith(thickness: 2, color: Theme.of(context).dividerColor), - indicatorTheme: TimelineTheme.of(context) - .indicatorTheme - .copyWith(size: 15, color: Theme.of(context).primaryColor), - ), - builder: TimelineTileBuilder.fromStyle( - contentsAlign: ContentsAlign.alternating, - contentsBuilder: (_, index) => CalendarTile(text: calendar[index].name), - oppositeContentsBuilder: (_, index) => - CalendarTile(text: calendar[index].date, isOpposite: true), - itemCount: calendar.length, + return SingleChildScrollView( + child: FixedTimeline.tileBuilder( + theme: TimelineTheme.of(context).copyWith( + connectorTheme: TimelineTheme.of(context) + .connectorTheme + .copyWith(thickness: 2, color: Theme.of(context).dividerColor), + indicatorTheme: TimelineTheme.of(context) + .indicatorTheme + .copyWith(size: 15, color: Theme.of(context).primaryColor), + ), + builder: TimelineTileBuilder.fromStyle( + contentsAlign: ContentsAlign.alternating, + contentsBuilder: (_, index) => + CalendarTile(text: calendar[index].name), + oppositeContentsBuilder: (_, index) => + CalendarTile(text: calendar[index].date, isOpposite: true), + itemCount: calendar.length, + ), ), ); } @@ -67,4 +59,8 @@ class CalendarPageViewState extends GeneralPageViewState { return Provider.of(context, listen: false) .forceRefresh(context); } + + @override + String? getTitle() => + S.of(context).nav_title(NavigationItem.navCalendar.route); } diff --git a/uni/lib/view/calendar/widgets/calendar_card.dart b/uni/lib/view/calendar/widgets/calendar_card.dart index 064879479..e0b2131e8 100644 --- a/uni/lib/view/calendar/widgets/calendar_card.dart +++ b/uni/lib/view/calendar/widgets/calendar_card.dart @@ -4,7 +4,7 @@ import 'package:provider/provider.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/calendar_event.dart'; import 'package:uni/model/providers/lazy/calendar_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/calendar/calendar.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; import 'package:uni/view/lazy_consumer.dart'; @@ -20,11 +20,11 @@ class CalendarCard extends GenericCard { @override String getTitle(BuildContext context) => - S.of(context).nav_title(DrawerItem.navCalendar.title); + S.of(context).nav_title(NavigationItem.navCalendar.route); @override Future onClick(BuildContext context) => - Navigator.pushNamed(context, '/${DrawerItem.navCalendar.title}'); + Navigator.pushNamed(context, '/${NavigationItem.navCalendar.route}'); @override void onRefresh(BuildContext context) { diff --git a/uni/lib/view/common_widgets/page_title.dart b/uni/lib/view/common_widgets/page_title.dart index af5bbeccd..b0c97610f 100644 --- a/uni/lib/view/common_widgets/page_title.dart +++ b/uni/lib/view/common_widgets/page_title.dart @@ -21,7 +21,7 @@ class PageTitle extends StatelessWidget { ), ); return Container( - padding: pad ? const EdgeInsets.fromLTRB(20, 20, 20, 10) : null, + padding: pad ? const EdgeInsets.fromLTRB(20, 30, 20, 10) : null, alignment: center ? Alignment.center : null, child: title, ); 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 dcd888115..d658d897c 100644 --- a/uni/lib/view/common_widgets/pages_layouts/general/general.dart +++ b/uni/lib/view/common_widgets/pages_layouts/general/general.dart @@ -7,14 +7,12 @@ import 'package:provider/provider.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:uni/model/providers/startup/profile_provider.dart'; import 'package:uni/model/providers/startup/session_provider.dart'; -import 'package:uni/view/common_widgets/pages_layouts/general/widgets/app_bar.dart'; -import 'package:uni/view/common_widgets/pages_layouts/general/widgets/navigation_drawer.dart'; -import 'package:uni/view/common_widgets/pages_layouts/general/widgets/profile_button.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/refresh_state.dart'; +import 'package:uni/view/common_widgets/pages_layouts/general/widgets/top_navigation_bar.dart'; /// Page with a hamburger menu and the user profile picture abstract class GeneralPageViewState extends State { - final double borderMargin = 18; bool _loadedOnce = false; bool _loading = true; @@ -116,15 +114,13 @@ abstract class GeneralPageViewState extends State { Widget getScaffold(BuildContext context, Widget body) { return Scaffold( - appBar: CustomAppBar(getTopRightButton: getTopRightButton), - drawer: AppNavigationDrawer( - parentContext: context, - ), + appBar: getTopNavbar(context), + bottomNavigationBar: const AppBottomNavbar(), body: RefreshState(onRefresh: onRefresh, child: body), ); } - /// Gets a round shaped button with the photo of the current user. - Widget getTopRightButton(BuildContext context) => - ProfileButton(getProfileDecorationImage: getProfileDecorationImage); + AppTopNavbar? getTopNavbar(BuildContext context) { + return null; + } } diff --git a/uni/lib/view/common_widgets/pages_layouts/general/widgets/app_bar.dart b/uni/lib/view/common_widgets/pages_layouts/general/widgets/app_bar.dart deleted file mode 100644 index 578c223e8..000000000 --- a/uni/lib/view/common_widgets/pages_layouts/general/widgets/app_bar.dart +++ /dev/null @@ -1,71 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:uni/utils/drawer_items.dart'; - -/// Upper bar of the app. -/// -/// This widget consists on an instance of `AppBar` containing the app's logo, -/// an option button and a button with the user's picture. -class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { - const CustomAppBar({required this.getTopRightButton, super.key}); - - static const double borderMargin = 18; - - final Widget Function(BuildContext) getTopRightButton; - - @override - Size get preferredSize => const Size.fromHeight(kToolbarHeight); - - @override - AppBar build(BuildContext context) { - final queryData = MediaQuery.of(context); - - return AppBar( - bottom: PreferredSize( - preferredSize: Size.zero, - child: Container( - color: Theme.of(context).dividerColor, - margin: const EdgeInsets.only( - left: borderMargin, - right: borderMargin, - ), - height: 1.5, - ), - ), - elevation: 0, - iconTheme: Theme.of(context).iconTheme, - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - titleSpacing: 0, - title: ButtonTheme( - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: const RoundedRectangleBorder(), - child: Builder( - builder: (context) => TextButton( - onPressed: () { - final currentRouteName = ModalRoute.of(context)!.settings.name; - if (currentRouteName != '/${DrawerItem.navPersonalArea.title}') { - Navigator.pushNamed( - context, - '/${DrawerItem.navPersonalArea.title}', - ); - } else { - Scaffold.of(context).openDrawer(); - } - }, - child: SvgPicture.asset( - colorFilter: ColorFilter.mode( - Theme.of(context).primaryColor, - BlendMode.srcIn, - ), - 'assets/images/logo_dark.svg', - height: queryData.size.height / 25, - ), - ), - ), - ), - actions: [ - getTopRightButton(context), - ], - ); - } -} 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 new file mode 100644 index 000000000..9b4a89614 --- /dev/null +++ b/uni/lib/view/common_widgets/pages_layouts/general/widgets/bottom_navigation_bar.dart @@ -0,0 +1,66 @@ +import 'package:flutter/material.dart'; +import 'package:uni/utils/navbar_items.dart'; + +class AppBottomNavbar extends StatelessWidget { + const AppBottomNavbar({super.key}); + + String? _getCurrentRoute(BuildContext context) => + ModalRoute.of(context)!.settings.name?.substring(1); + + int _getCurrentIndex(BuildContext context) { + final currentRoute = _getCurrentRoute(context); + if (_getCurrentRoute(context) == null) { + return -1; + } + + for (final item in NavbarItem.values) { + if (item.route == currentRoute) { + return item.index; + } + } + + return -1; + } + + void _onItemTapped(BuildContext context, int index) { + final prev = _getCurrentRoute(context); + final item = NavbarItem.values[index]; + final key = item.route; + + if (prev != key) { + Navigator.pushNamed( + context, + '/$key', + ); + } + } + + @override + Widget build(BuildContext context) { + final currentIndex = _getCurrentIndex(context); + final navbarItems = []; + for (var index = 0; index < NavbarItem.values.length; index++) { + final item = NavbarItem.values[index]; + navbarItems.insert( + index, + index == currentIndex + ? item.toSelectedBottomNavigationBarItem() + : item.toUnselectedBottomNavigationBarItem(), + ); + } + + return BottomNavigationBar( + items: navbarItems, + onTap: (int index) => _onItemTapped(context, index), + currentIndex: currentIndex == -1 ? 0 : currentIndex, + type: BottomNavigationBarType.fixed, + iconSize: 32, + selectedItemColor: currentIndex == -1 + ? Theme.of(context).colorScheme.onSurface + : Theme.of(context).colorScheme.secondary, + unselectedItemColor: Theme.of(context).colorScheme.onSurface, + showSelectedLabels: false, + showUnselectedLabels: false, + ); + } +} diff --git a/uni/lib/view/common_widgets/pages_layouts/general/widgets/drawer_navigation_option.dart b/uni/lib/view/common_widgets/pages_layouts/general/widgets/drawer_navigation_option.dart index ec6d17ec4..b7092271d 100644 --- a/uni/lib/view/common_widgets/pages_layouts/general/widgets/drawer_navigation_option.dart +++ b/uni/lib/view/common_widgets/pages_layouts/general/widgets/drawer_navigation_option.dart @@ -1,14 +1,14 @@ import 'package:flutter/material.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; class DrawerNavigationOption extends StatelessWidget { const DrawerNavigationOption({required this.item, super.key}); - final DrawerItem item; + final NavigationItem item; String getCurrentRoute(BuildContext context) => ModalRoute.of(context)!.settings.name == null - ? DrawerItem.values.toList()[0].title + ? NavigationItem.values.toList()[0].route : ModalRoute.of(context)!.settings.name!.substring(1); void onSelectPage(String key, BuildContext context) { @@ -39,12 +39,12 @@ class DrawerNavigationOption extends StatelessWidget { Widget build(BuildContext context) { return DecoratedBox( decoration: - _getSelectionDecoration(item.title, context) ?? const BoxDecoration(), + _getSelectionDecoration(item.route, context) ?? const BoxDecoration(), child: ListTile( title: Container( padding: const EdgeInsets.only(bottom: 3, left: 20), child: Text( - item.title, + item.route, style: TextStyle( fontSize: 18, color: Theme.of(context).primaryColor, @@ -54,8 +54,8 @@ class DrawerNavigationOption extends StatelessWidget { ), dense: true, contentPadding: EdgeInsets.zero, - selected: item.title == getCurrentRoute(context), - onTap: () => onSelectPage(item.title, context), + selected: item.route == getCurrentRoute(context), + onTap: () => onSelectPage(item.route, context), ), ); } diff --git a/uni/lib/view/common_widgets/pages_layouts/general/widgets/navigation_drawer.dart b/uni/lib/view/common_widgets/pages_layouts/general/widgets/navigation_drawer.dart deleted file mode 100644 index 74283bb36..000000000 --- a/uni/lib/view/common_widgets/pages_layouts/general/widgets/navigation_drawer.dart +++ /dev/null @@ -1,105 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:provider/provider.dart'; -import 'package:uni/generated/l10n.dart'; -import 'package:uni/model/providers/startup/session_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; - -class AppNavigationDrawer extends StatefulWidget { - const AppNavigationDrawer({required this.parentContext, super.key}); - - final BuildContext parentContext; - - @override - State createState() { - return AppNavigationDrawerState(); - } -} - -class AppNavigationDrawerState extends State { - AppNavigationDrawerState(); - - Map drawerItems = {}; - - @override - void initState() { - super.initState(); - - drawerItems = {}; - for (final element in DrawerItem.values) { - drawerItems[element] = _onSelectPage; - } - } - - String getCurrentRoute() => - ModalRoute.of(widget.parentContext)!.settings.name == null - ? drawerItems.keys.toList()[0].title - : ModalRoute.of(widget.parentContext)!.settings.name!.substring(1); - - void _onSelectPage(String key) { - final prev = getCurrentRoute(); - Navigator.of(context).pop(); - if (prev != key) { - Navigator.pushNamed(context, '/$key'); - } - } - - BoxDecoration? _getSelectionDecoration(String name) { - return (name == getCurrentRoute()) - ? BoxDecoration( - border: Border( - left: BorderSide( - color: Theme.of(context).primaryColor, - width: 3, - ), - ), - color: Theme.of(context).dividerColor, - ) - : null; - } - - Widget createDrawerNavigationOption(DrawerItem d) { - return DecoratedBox( - decoration: _getSelectionDecoration(d.title) ?? const BoxDecoration(), - child: ListTile( - title: Container( - padding: const EdgeInsets.only(bottom: 3, left: 20), - child: Text( - S.of(context).nav_title(d.title), - style: TextStyle( - fontSize: 18, - color: Theme.of(context).primaryColor, - fontWeight: FontWeight.normal, - ), - ), - ), - dense: true, - contentPadding: EdgeInsets.zero, - selected: d.title == getCurrentRoute(), - onTap: () => drawerItems[d]!(d.title), - ), - ); - } - - @override - Widget build(BuildContext context) { - final userSession = context.read().state!; - - return Drawer( - child: Column( - children: [ - Expanded( - child: Container( - padding: const EdgeInsets.only(top: 55), - child: ListView( - children: drawerItems.keys - .where((key) => key.isVisible(userSession.faculties)) - .map(createDrawerNavigationOption) - .toList(), - ), - ), - ), - ], - ), - ); - } -} diff --git a/uni/lib/view/common_widgets/pages_layouts/general/widgets/profile_button.dart b/uni/lib/view/common_widgets/pages_layouts/general/widgets/profile_button.dart index 98666a694..6dd27146e 100644 --- a/uni/lib/view/common_widgets/pages_layouts/general/widgets/profile_button.dart +++ b/uni/lib/view/common_widgets/pages_layouts/general/widgets/profile_button.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:uni/model/providers/startup/profile_provider.dart'; import 'package:uni/model/providers/startup/session_provider.dart'; -import 'package:uni/view/profile/profile.dart'; +import 'package:uni/utils/navigation_items.dart'; class ProfileButton extends StatelessWidget { const ProfileButton({required this.getProfileDecorationImage, super.key}); @@ -36,16 +36,14 @@ class ProfileButton extends StatelessWidget { ) { return TextButton( onPressed: () => { - Navigator.push( + Navigator.pushNamed( context, - MaterialPageRoute( - builder: (__) => const ProfilePageView(), - ), + '/${NavigationItem.navProfile.route}', ), }, child: Container( - width: 40, - height: 40, + width: 50, + height: 50, decoration: BoxDecoration( shape: BoxShape.circle, image: decorationImage.data, diff --git a/uni/lib/view/common_widgets/pages_layouts/general/widgets/top_navigation_bar.dart b/uni/lib/view/common_widgets/pages_layouts/general/widgets/top_navigation_bar.dart new file mode 100644 index 000000000..78ed67669 --- /dev/null +++ b/uni/lib/view/common_widgets/pages_layouts/general/widgets/top_navigation_bar.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; +import 'package:uni/view/common_widgets/page_title.dart'; + +class AppTopNavbar extends StatelessWidget implements PreferredSizeWidget { + const AppTopNavbar({ + this.title, + this.rightButton, + this.leftButton, + super.key, + }); + + static const double borderMargin = 18; + + final String? title; + final Widget? rightButton; + final Widget? leftButton; + + @override + Size get preferredSize => const Size.fromHeight(kToolbarHeight); + + @override + AppBar build(BuildContext context) { + return AppBar( + automaticallyImplyLeading: false, + elevation: 0, + iconTheme: Theme.of(context).iconTheme, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + titleSpacing: 0, + title: Stack( + alignment: Alignment.center, + children: [ + Align( + alignment: Alignment.centerLeft, + child: leftButton, + ), + Center( + child: PageTitle( + name: title ?? '', + pad: false, + ), + ), + Align( + alignment: Alignment.centerRight, + child: rightButton, + ), + ], + ), + ); + } +} 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 30aaafec3..594ca87d7 100644 --- a/uni/lib/view/common_widgets/pages_layouts/secondary/secondary.dart +++ b/uni/lib/view/common_widgets/pages_layouts/secondary/secondary.dart @@ -1,7 +1,9 @@ +import 'package:flutter/foundation.dart'; 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/app_bar.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/refresh_state.dart'; +import 'package:uni/view/common_widgets/pages_layouts/general/widgets/top_navigation_bar.dart'; /// Page with a back button on top abstract class SecondaryPageViewState @@ -9,13 +11,28 @@ abstract class SecondaryPageViewState @override Scaffold getScaffold(BuildContext context, Widget body) { return Scaffold( - appBar: CustomAppBar(getTopRightButton: getTopRightButton), + appBar: getTopNavbar(context), + bottomNavigationBar: const AppBottomNavbar(), body: RefreshState(onRefresh: onRefresh, child: body), ); } + String? getTitle(); + + Widget? getTopRightButton(BuildContext context) { + return null; + } + @override - Widget getTopRightButton(BuildContext context) { - return Container(); + @nonVirtual + AppTopNavbar? getTopNavbar(BuildContext context) { + return AppTopNavbar( + title: getTitle(), + leftButton: const Padding( + padding: EdgeInsets.symmetric(horizontal: 8), + child: BackButton(), + ), + rightButton: getTopRightButton(context), + ); } } diff --git a/uni/lib/view/course_unit_info/course_unit_info.dart b/uni/lib/view/course_unit_info/course_unit_info.dart index c6d4d89be..d29aea7b8 100644 --- a/uni/lib/view/course_unit_info/course_unit_info.dart +++ b/uni/lib/view/course_unit_info/course_unit_info.dart @@ -144,4 +144,9 @@ class CourseUnitDetailPageViewState return CourseUnitClassesView(classes); } + + @override + String? getTitle() { + return null; + } } diff --git a/uni/lib/view/course_units/course_units.dart b/uni/lib/view/course_units/course_units.dart index d9e3fee01..8e9383405 100644 --- a/uni/lib/view/course_units/course_units.dart +++ b/uni/lib/view/course_units/course_units.dart @@ -5,9 +5,8 @@ import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/course_units/course_unit.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/page_title.dart'; -import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; +import 'package:uni/utils/navigation_items.dart'; +import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/course_units/widgets/course_unit_card.dart'; import 'package:uni/view/lazy_consumer.dart'; @@ -23,7 +22,7 @@ class CourseUnitsPageView extends StatefulWidget { } class CourseUnitsPageViewState - extends GeneralPageViewState { + extends SecondaryPageViewState { String? selectedSchoolYear; String? selectedSemester; @@ -53,7 +52,7 @@ class CourseUnitsPageViewState return Column( children: [ - _getPageTitleAndFilters(availableYears, availableSemesters), + _getFilters(availableYears, availableSemesters), _getPageView(courseUnits, availableYears, availableSemesters), ], ); @@ -61,7 +60,7 @@ class CourseUnitsPageViewState hasContent: (Profile profile) => profile.courseUnits.isNotEmpty, onNullContent: Column( children: [ - _getPageTitleAndFilters([], []), + _getFilters([], []), Center( heightFactor: 10, child: Text( @@ -94,16 +93,13 @@ class CourseUnitsPageViewState return _generateCourseUnitsCards(filteredCourseUnits, context); } - Widget _getPageTitleAndFilters( + Widget _getFilters( List availableYears, List availableSemesters, ) { return Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ - PageTitle( - name: S.of(context).nav_title(DrawerItem.navCourseUnits.title), - ), const Spacer(), DropdownButtonHideUnderline( child: DropdownButton( @@ -224,4 +220,8 @@ class CourseUnitsPageViewState return Provider.of(context, listen: false) .forceRefresh(context); } + + @override + String? getTitle() => + S.of(context).nav_title(NavigationItem.navCourseUnits.route); } diff --git a/uni/lib/view/exams/exams.dart b/uni/lib/view/exams/exams.dart index 604edcc7b..46b019d8f 100644 --- a/uni/lib/view/exams/exams.dart +++ b/uni/lib/view/exams/exams.dart @@ -5,10 +5,11 @@ import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/exam.dart'; import 'package:uni/model/providers/lazy/exam_provider.dart'; import 'package:uni/utils/date_time_formatter.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/expanded_image_label.dart'; -import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; +import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/common_widgets/row_container.dart'; -import 'package:uni/view/exams/widgets/exam_page_title.dart'; +import 'package:uni/view/exams/widgets/exam_filter_button.dart'; import 'package:uni/view/exams/widgets/exam_row.dart'; import 'package:uni/view/lazy_consumer.dart'; import 'package:uni/view/locale_notifier.dart'; @@ -20,7 +21,7 @@ class ExamsPageView extends StatefulWidget { State createState() => ExamsPageViewState(); } -class ExamsPageViewState extends GeneralPageViewState { +class ExamsPageViewState extends SecondaryPageViewState { List hiddenExams = PreferencesController.getHiddenExams(); Map filteredExamTypes = PreferencesController.getFilteredExams(); @@ -29,11 +30,6 @@ class ExamsPageViewState extends GeneralPageViewState { Widget getBody(BuildContext context) { return ListView( children: [ - ExamPageTitle( - () => setState(() { - filteredExamTypes = PreferencesController.getFilteredExams(); - }), - ), LazyConsumer>( builder: (context, exams) { return Column( @@ -166,4 +162,19 @@ class ExamsPageViewState extends GeneralPageViewState { return Provider.of(context, listen: false) .forceRefresh(context); } + + @override + String? getTitle() => S.of(context).nav_title(NavigationItem.navExams.route); + + @override + Widget? getTopRightButton(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: ExamFilterButton( + () => setState(() { + filteredExamTypes = PreferencesController.getFilteredExams(); + }), + ), + ); + } } diff --git a/uni/lib/view/exams/widgets/exam_filter_button.dart b/uni/lib/view/exams/widgets/exam_filter_button.dart new file mode 100644 index 000000000..b05f0ce61 --- /dev/null +++ b/uni/lib/view/exams/widgets/exam_filter_button.dart @@ -0,0 +1,28 @@ +import 'package:flutter/material.dart'; +import 'package:uni/controller/local_storage/preferences_controller.dart'; +import 'package:uni/view/exams/widgets/exam_filter_form.dart'; + +class ExamFilterButton extends StatelessWidget { + const ExamFilterButton(this.onDismissFilterDialog, {super.key}); + + final void Function() onDismissFilterDialog; + + @override + Widget build(BuildContext context) { + return IconButton( + icon: const Icon(Icons.filter_list), + onPressed: () { + showDialog( + context: context, + builder: (_) { + final filteredExamsTypes = PreferencesController.getFilteredExams(); + return ExamFilterForm( + Map.from(filteredExamsTypes), + onDismissFilterDialog, + ); + }, + ); + }, + ); + } +} diff --git a/uni/lib/view/exams/widgets/exam_page_title.dart b/uni/lib/view/exams/widgets/exam_page_title.dart deleted file mode 100644 index 2eb175645..000000000 --- a/uni/lib/view/exams/widgets/exam_page_title.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:uni/controller/local_storage/preferences_controller.dart'; -import 'package:uni/generated/l10n.dart'; -import 'package:uni/utils/drawer_items.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; -import 'package:uni/view/exams/widgets/exam_filter_form.dart'; - -class ExamPageTitle extends StatelessWidget { - const ExamPageTitle(this.onDismissFilterDialog, {super.key}); - - final void Function() onDismissFilterDialog; - - @override - Widget build(BuildContext context) { - return Container( - padding: const EdgeInsets.fromLTRB(20, 20, 20, 10), - alignment: Alignment.center, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - PageTitle( - name: S.of(context).nav_title(DrawerItem.navExams.title), - center: false, - pad: false, - ), - IconButton( - icon: const Icon(Icons.filter_alt), - onPressed: () { - showDialog( - context: context, - builder: (_) { - final filteredExamsTypes = - PreferencesController.getFilteredExams(); - return ExamFilterForm( - Map.from(filteredExamsTypes), - onDismissFilterDialog, - ); - }, - ); - }, - ), - ], - ), - ); - } -} diff --git a/uni/lib/view/faculty/faculty.dart b/uni/lib/view/faculty/faculty.dart index 252ec7ae8..c8786f83f 100644 --- a/uni/lib/view/faculty/faculty.dart +++ b/uni/lib/view/faculty/faculty.dart @@ -1,11 +1,8 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:uni/generated/l10n.dart'; import 'package:uni/model/providers/lazy/library_occupation_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; import 'package:uni/view/calendar/widgets/calendar_card.dart'; import 'package:uni/view/common_widgets/generic_expansion_card.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; import 'package:uni/view/faculty/widgets/academic_services_card.dart'; import 'package:uni/view/faculty/widgets/copy_center_card.dart'; @@ -28,7 +25,6 @@ class FacultyPageViewState extends GeneralPageViewState { Widget getBody(BuildContext context) { return ListView( children: [ - PageTitle(name: S.of(context).nav_title(DrawerItem.navFaculty.title)), LibraryOccupationCard(), CalendarCard(), ...getUtilsSection(), diff --git a/uni/lib/view/faculty/widgets/academic_services_card.dart b/uni/lib/view/faculty/widgets/academic_services_card.dart index be0df0857..535df4280 100644 --- a/uni/lib/view/faculty/widgets/academic_services_card.dart +++ b/uni/lib/view/faculty/widgets/academic_services_card.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:uni/generated/l10n.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_expansion_card.dart'; import 'package:uni/view/faculty/widgets/text_components.dart'; @@ -12,7 +12,7 @@ class AcademicServicesCard extends GenericExpansionCard { return Column( children: [ h1( - S.of(context).nav_title(DrawerItem.navSchedule.title), + S.of(context).nav_title(NavigationItem.navSchedule.route), context, initial: true, ), diff --git a/uni/lib/view/faculty/widgets/copy_center_card.dart b/uni/lib/view/faculty/widgets/copy_center_card.dart index 69a803872..b555df81a 100644 --- a/uni/lib/view/faculty/widgets/copy_center_card.dart +++ b/uni/lib/view/faculty/widgets/copy_center_card.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:uni/generated/l10n.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_expansion_card.dart'; import 'package:uni/view/faculty/widgets/text_components.dart'; @@ -12,7 +12,7 @@ class CopyCenterCard extends GenericExpansionCard { return Column( children: [ h1( - S.of(context).nav_title(DrawerItem.navSchedule.title), + S.of(context).nav_title(NavigationItem.navSchedule.route), context, initial: true, ), diff --git a/uni/lib/view/faculty/widgets/dona_bia_card.dart b/uni/lib/view/faculty/widgets/dona_bia_card.dart index 061232f8e..fdabeeb2f 100644 --- a/uni/lib/view/faculty/widgets/dona_bia_card.dart +++ b/uni/lib/view/faculty/widgets/dona_bia_card.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:uni/generated/l10n.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_expansion_card.dart'; import 'package:uni/view/faculty/widgets/text_components.dart'; @@ -12,7 +12,7 @@ class DonaBiaCard extends GenericExpansionCard { return Column( children: [ h1( - S.of(context).nav_title(DrawerItem.navSchedule.title), + S.of(context).nav_title(NavigationItem.navSchedule.route), context, initial: true, ), diff --git a/uni/lib/view/faculty/widgets/infodesk_card.dart b/uni/lib/view/faculty/widgets/infodesk_card.dart index 968f1bfd0..a256ff999 100644 --- a/uni/lib/view/faculty/widgets/infodesk_card.dart +++ b/uni/lib/view/faculty/widgets/infodesk_card.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:uni/generated/l10n.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_expansion_card.dart'; import 'package:uni/view/faculty/widgets/text_components.dart'; @@ -12,7 +12,7 @@ class InfoDeskCard extends GenericExpansionCard { return Column( children: [ h1( - S.of(context).nav_title(DrawerItem.navSchedule.title), + S.of(context).nav_title(NavigationItem.navSchedule.route), context, initial: true, ), diff --git a/uni/lib/view/faculty/widgets/multimedia_center_card.dart b/uni/lib/view/faculty/widgets/multimedia_center_card.dart index c71cb328d..66c2f7406 100644 --- a/uni/lib/view/faculty/widgets/multimedia_center_card.dart +++ b/uni/lib/view/faculty/widgets/multimedia_center_card.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:uni/generated/l10n.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_expansion_card.dart'; import 'package:uni/view/faculty/widgets/text_components.dart'; @@ -12,7 +12,7 @@ class MultimediaCenterCard extends GenericExpansionCard { return Column( children: [ h1( - S.of(context).nav_title(DrawerItem.navSchedule.title), + S.of(context).nav_title(NavigationItem.navSchedule.route), context, initial: true, ), diff --git a/uni/lib/view/home/home.dart b/uni/lib/view/home/home.dart index 93812aba3..860eeb62c 100644 --- a/uni/lib/view/home/home.dart +++ b/uni/lib/view/home/home.dart @@ -2,8 +2,11 @@ import 'package:flutter/material.dart'; import 'package:uni/controller/local_storage/preferences_controller.dart'; import 'package:uni/utils/favorite_widget_type.dart'; import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; +import 'package:uni/view/common_widgets/pages_layouts/general/widgets/profile_button.dart'; +import 'package:uni/view/common_widgets/pages_layouts/general/widgets/top_navigation_bar.dart'; import 'package:uni/view/home/widgets/main_cards_list.dart'; import 'package:uni/view/home/widgets/tracking_banner.dart'; +import 'package:uni/view/home/widgets/uni_icon.dart'; class HomePageView extends StatefulWidget { const HomePageView({super.key}); @@ -69,4 +72,20 @@ class HomePageViewState extends GeneralPageViewState { card.onRefresh(context); } } + + @override + AppTopNavbar? getTopNavbar(BuildContext context) { + return AppTopNavbar( + leftButton: const Padding( + padding: EdgeInsets.symmetric(horizontal: 8), + child: UniIcon(), + ), + rightButton: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: ProfileButton( + getProfileDecorationImage: getProfileDecorationImage, + ), + ), + ); + } } diff --git a/uni/lib/view/home/widgets/bus_stop_card.dart b/uni/lib/view/home/widgets/bus_stop_card.dart index d77c4326c..70a8e9218 100644 --- a/uni/lib/view/home/widgets/bus_stop_card.dart +++ b/uni/lib/view/home/widgets/bus_stop_card.dart @@ -3,7 +3,7 @@ import 'package:provider/provider.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/bus_stop.dart'; import 'package:uni/model/providers/lazy/bus_stop_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/bus_stop_next_arrivals/widgets/bus_stop_row.dart'; import 'package:uni/view/bus_stop_selection/bus_stop_selection.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; @@ -22,11 +22,11 @@ class BusStopCard extends GenericCard { @override String getTitle(BuildContext context) => - S.of(context).nav_title(DrawerItem.navStops.title); + S.of(context).nav_title(NavigationItem.navStops.route); @override Future onClick(BuildContext context) => - Navigator.pushNamed(context, '/${DrawerItem.navStops.title}'); + Navigator.pushNamed(context, '/${NavigationItem.navStops.route}'); @override Widget buildCardContent(BuildContext context) { diff --git a/uni/lib/view/home/widgets/exam_card.dart b/uni/lib/view/home/widgets/exam_card.dart index d9ed6f049..9e7e89473 100644 --- a/uni/lib/view/home/widgets/exam_card.dart +++ b/uni/lib/view/home/widgets/exam_card.dart @@ -3,7 +3,7 @@ import 'package:provider/provider.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/exam.dart'; import 'package:uni/model/providers/lazy/exam_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; import 'package:uni/view/home/widgets/exam_card_shimmer.dart'; import 'package:uni/view/home/widgets/next_exams_card.dart'; @@ -23,11 +23,11 @@ class ExamCard extends GenericCard { @override String getTitle(BuildContext context) => - S.of(context).nav_title(DrawerItem.navExams.title); + S.of(context).nav_title(NavigationItem.navExams.route); @override Future onClick(BuildContext context) => - Navigator.pushNamed(context, '/${DrawerItem.navExams.title}'); + Navigator.pushNamed(context, '/${NavigationItem.navExams.route}'); @override void onRefresh(BuildContext context) { diff --git a/uni/lib/view/home/widgets/main_cards_list.dart b/uni/lib/view/home/widgets/main_cards_list.dart index 421981e4b..8ba1227e7 100644 --- a/uni/lib/view/home/widgets/main_cards_list.dart +++ b/uni/lib/view/home/widgets/main_cards_list.dart @@ -184,9 +184,9 @@ class MainCardsListState extends State { BuildContext context, ) { final userSession = - Provider.of(context, listen: false).state!; + Provider.of(context, listen: false).state; return cardTypes - .where((type) => type.isVisible(userSession.faculties)) + .where((type) => type.isVisible(userSession?.faculties ?? [])) .where((type) => MainCardsList.cardCreators.containsKey(type)) .map((type) { final i = cardTypes.indexOf(type); diff --git a/uni/lib/view/home/widgets/restaurant_card.dart b/uni/lib/view/home/widgets/restaurant_card.dart index 46dcac5ce..ac16adc59 100644 --- a/uni/lib/view/home/widgets/restaurant_card.dart +++ b/uni/lib/view/home/widgets/restaurant_card.dart @@ -6,7 +6,7 @@ import 'package:uni/model/entities/meal.dart'; import 'package:uni/model/entities/restaurant.dart'; import 'package:uni/model/providers/lazy/restaurant_provider.dart'; import 'package:uni/model/utils/day_of_week.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; import 'package:uni/view/lazy_consumer.dart'; import 'package:uni/view/restaurant/widgets/restaurant_slot.dart'; @@ -22,11 +22,11 @@ class RestaurantCard extends GenericCard { @override String getTitle(BuildContext context) => - S.of(context).nav_title(DrawerItem.navRestaurants.title); + S.of(context).nav_title(NavigationItem.navRestaurants.route); @override Future onClick(BuildContext context) => - Navigator.pushNamed(context, '/${DrawerItem.navRestaurants.title}'); + Navigator.pushNamed(context, '/${NavigationItem.navRestaurants.route}'); @override void onRefresh(BuildContext context) { @@ -62,7 +62,7 @@ class RestaurantCard extends GenericCard { OutlinedButton( onPressed: () => Navigator.pushNamed( context, - '/${DrawerItem.navRestaurants.title}', + '/${NavigationItem.navRestaurants.route}', ), child: Text(S.of(context).add), ), diff --git a/uni/lib/view/home/widgets/schedule_card.dart b/uni/lib/view/home/widgets/schedule_card.dart index 3f0ecd86d..edac76541 100644 --- a/uni/lib/view/home/widgets/schedule_card.dart +++ b/uni/lib/view/home/widgets/schedule_card.dart @@ -6,7 +6,7 @@ import 'package:provider/provider.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/lecture.dart'; import 'package:uni/model/providers/lazy/lecture_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/date_rectangle.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; import 'package:uni/view/home/widgets/schedule_card_shimmer.dart'; @@ -119,9 +119,9 @@ class ScheduleCard extends GenericCard { @override String getTitle(BuildContext context) => - S.of(context).nav_title(DrawerItem.navSchedule.title); + S.of(context).nav_title(NavigationItem.navSchedule.route); @override Future onClick(BuildContext context) => - Navigator.pushNamed(context, '/${DrawerItem.navSchedule.title}'); + Navigator.pushNamed(context, '/${NavigationItem.navSchedule.route}'); } diff --git a/uni/lib/view/home/widgets/uni_icon.dart b/uni/lib/view/home/widgets/uni_icon.dart new file mode 100644 index 000000000..bfc4ee7f7 --- /dev/null +++ b/uni/lib/view/home/widgets/uni_icon.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; + +class UniIcon extends StatelessWidget { + const UniIcon({super.key}); + + @override + Widget build(BuildContext context) { + return ButtonTheme( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: const RoundedRectangleBorder(), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 12), + child: SvgPicture.asset( + colorFilter: ColorFilter.mode( + Theme.of(context).primaryColor, + BlendMode.srcIn, + ), + 'assets/images/logo_dark.svg', + height: 35, + ), + ), + ); + } +} diff --git a/uni/lib/view/library/library.dart b/uni/lib/view/library/library.dart index 562ee2b4c..a86bc19c0 100644 --- a/uni/lib/view/library/library.dart +++ b/uni/lib/view/library/library.dart @@ -4,9 +4,9 @@ import 'package:provider/provider.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/library_occupation.dart'; import 'package:uni/model/providers/lazy/library_occupation_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/page_title.dart'; -import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; +import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/lazy_consumer.dart'; import 'package:uni/view/library/widgets/library_occupation_card.dart'; @@ -17,13 +17,12 @@ class LibraryPage extends StatefulWidget { State createState() => LibraryPageState(); } -class LibraryPageState extends GeneralPageViewState { +class LibraryPageState extends SecondaryPageViewState { @override Widget getBody(BuildContext context) { return ListView( shrinkWrap: true, children: [ - PageTitle(name: S.of(context).nav_title(DrawerItem.navLibrary.title)), LibraryOccupationCard(), PageTitle(name: S.of(context).floors), LazyConsumer( @@ -123,4 +122,8 @@ class LibraryPageState extends GeneralPageViewState { return Provider.of(context, listen: false) .forceRefresh(context); } + + @override + String? getTitle() => + S.of(context).nav_title(NavigationItem.navLibrary.route); } diff --git a/uni/lib/view/library/widgets/library_occupation_card.dart b/uni/lib/view/library/widgets/library_occupation_card.dart index 49fedb3a3..d167efdf2 100644 --- a/uni/lib/view/library/widgets/library_occupation_card.dart +++ b/uni/lib/view/library/widgets/library_occupation_card.dart @@ -4,7 +4,7 @@ import 'package:provider/provider.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/library_occupation.dart'; import 'package:uni/model/providers/lazy/library_occupation_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; import 'package:uni/view/lazy_consumer.dart'; @@ -23,7 +23,7 @@ class LibraryOccupationCard extends GenericCard { @override Future onClick(BuildContext context) => - Navigator.pushNamed(context, '/${DrawerItem.navLibrary.title}'); + Navigator.pushNamed(context, '/${NavigationItem.navLibrary.route}'); @override void onRefresh(BuildContext context) { diff --git a/uni/lib/view/locations/locations.dart b/uni/lib/view/locations/locations.dart index b6019305d..0d8dd55b7 100644 --- a/uni/lib/view/locations/locations.dart +++ b/uni/lib/view/locations/locations.dart @@ -4,9 +4,8 @@ import 'package:flutter_map/flutter_map.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/location_group.dart'; import 'package:uni/model/providers/lazy/faculty_locations_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; -import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; +import 'package:uni/utils/navigation_items.dart'; +import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/lazy_consumer.dart'; import 'package:uni/view/locations/widgets/faculty_map.dart'; @@ -17,7 +16,7 @@ class LocationsPage extends StatefulWidget { LocationsPageState createState() => LocationsPageState(); } -class LocationsPageState extends GeneralPageViewState +class LocationsPageState extends SecondaryPageViewState with SingleTickerProviderStateMixin { ScrollController? scrollViewController; @@ -36,6 +35,10 @@ class LocationsPageState extends GeneralPageViewState @override Future onRefresh(BuildContext context) async {} + + @override + String? getTitle() => + S.of(context).nav_title(NavigationItem.navLocations.route); } class LocationsPageView extends StatefulWidget { @@ -56,18 +59,12 @@ class LocationsPageViewState extends State { @override Widget build(BuildContext context) { - return Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + return LayoutBuilder( + builder: (context, constraints) { + return Column( children: [ - PageTitle( - name: '${S.of(context).nav_title(DrawerItem.navLocations.title)}:' - ' ${getLocation()}', - center: false, - ), Container( - width: 150, + width: constraints.maxWidth - 40, height: 40, margin: const EdgeInsets.fromLTRB(20, 10, 20, 0), child: TextFormField( @@ -87,27 +84,28 @@ class LocationsPageViewState extends State { ), ), ), - ], - ), - const SizedBox(height: 10), - Expanded( - child: Container( - height: 10, - padding: const EdgeInsets.fromLTRB(20, 0, 20, 0), - alignment: Alignment.center, - child: FacultyMap( - faculty: getLocation(), - locations: widget.locations, - searchFilter: searchTerms, - interactiveFlags: InteractiveFlag.all - InteractiveFlag.rotate, - // TODO(bdmendes): add support for multiple faculties + const SizedBox(height: 10), + Expanded( + child: Container( + height: 10, + padding: const EdgeInsets.fromLTRB(20, 0, 20, 0), + alignment: Alignment.center, + child: FacultyMap( + faculty: getLocation(), + locations: widget.locations, + searchFilter: searchTerms, + interactiveFlags: + InteractiveFlag.all - InteractiveFlag.rotate, + // TODO(bdmendes): add support for multiple faculties + ), + ), + ), + const SizedBox( + height: 20, ), - ), - ), - const SizedBox( - height: 20, - ), - ], + ], + ); + }, ); } diff --git a/uni/lib/view/login/login.dart b/uni/lib/view/login/login.dart index 17d1076b7..c1451e9f5 100644 --- a/uni/lib/view/login/login.dart +++ b/uni/lib/view/login/login.dart @@ -9,7 +9,7 @@ import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/login_exceptions.dart'; import 'package:uni/model/providers/startup/session_provider.dart'; import 'package:uni/model/providers/state_providers.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/toast_message.dart'; import 'package:uni/view/home/widgets/exit_app_dialog.dart'; import 'package:uni/view/login/widgets/inputs.dart'; @@ -64,7 +64,7 @@ class LoginPageViewState extends State { if (context.mounted) { await Navigator.pushReplacementNamed( context, - '/${DrawerItem.navPersonalArea.title}', + '/${NavigationItem.navPersonalArea.route}', ); setState(() { _loggingIn = false; diff --git a/uni/lib/view/profile/profile.dart b/uni/lib/view/profile/profile.dart index 9f0d02085..0fd3e272a 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/navigation_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}); @@ -58,14 +58,12 @@ class ProfilePageViewState extends SecondaryPageViewState { @override Widget getTopRightButton(BuildContext context) { return Container( - padding: const EdgeInsets.fromLTRB(0, 10, 20, 10), + padding: const EdgeInsets.fromLTRB(0, 10, 8, 10), child: IconButton( icon: const Icon(Icons.settings), - onPressed: () => Navigator.push( + onPressed: () => Navigator.pushNamed( context, - MaterialPageRoute( - builder: (_) => const SettingsPage(), - ), + '/${NavigationItem.navSettings.route}', ), ), ); @@ -76,4 +74,9 @@ class ProfilePageViewState extends SecondaryPageViewState { return Provider.of(context, listen: false) .forceRefresh(context); } + + @override + String? getTitle() { + return null; + } } diff --git a/uni/lib/view/restaurant/restaurant_page_view.dart b/uni/lib/view/restaurant/restaurant_page_view.dart index 2a894a5da..000477fe0 100644 --- a/uni/lib/view/restaurant/restaurant_page_view.dart +++ b/uni/lib/view/restaurant/restaurant_page_view.dart @@ -5,8 +5,6 @@ import 'package:uni/model/entities/meal.dart'; import 'package:uni/model/entities/restaurant.dart'; import 'package:uni/model/providers/lazy/restaurant_provider.dart'; import 'package:uni/model/utils/day_of_week.dart'; -import 'package:uni/utils/drawer_items.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; import 'package:uni/view/lazy_consumer.dart'; import 'package:uni/view/locale_notifier.dart'; @@ -40,41 +38,24 @@ class _RestaurantPageViewState extends GeneralPageViewState Widget getBody(BuildContext context) { return Column( children: [ - ListView( - shrinkWrap: true, - children: [ - Container( - padding: const EdgeInsets.fromLTRB(20, 20, 20, 10), - alignment: Alignment.center, - child: PageTitle( - name: S.of(context).nav_title(DrawerItem.navRestaurants.title), - center: false, - pad: false, - ), - ), - TabBar( - controller: tabController, - isScrollable: true, - tabs: createTabs(context), - ), - ], + TabBar( + controller: tabController, + isScrollable: true, + tabs: createTabs(context), + padding: const EdgeInsets.only(top: 40), ), - const SizedBox(height: 10), - Expanded( - child: LazyConsumer>( - builder: (context, restaurants) => createTabViewBuilder( - restaurants, - context, - ), - onNullContent: Center( - child: Text( - S.of(context).no_menus, - style: const TextStyle(fontSize: 18), - ), + LazyConsumer>( + builder: (context, restaurants) => createTabViewBuilder( + restaurants, + context, + ), + onNullContent: Center( + child: Text( + S.of(context).no_menus, + style: const TextStyle(fontSize: 18), ), - hasContent: (List restaurants) => - restaurants.isNotEmpty, ), + hasContent: (List restaurants) => restaurants.isNotEmpty, ), ], ); @@ -99,7 +80,7 @@ class _RestaurantPageViewState extends GeneralPageViewState ), ); } - return ListView(children: restaurantsWidgets); + return ListView(padding: EdgeInsets.zero, children: restaurantsWidgets); }).toList(); return Expanded( @@ -150,7 +131,7 @@ class _RestaurantPageViewState extends GeneralPageViewState final meals = restaurant.getMealsOfDay(day); if (meals.isEmpty) { return Container( - margin: const EdgeInsets.only(top: 10, bottom: 5), + margin: const EdgeInsets.only(bottom: 5), key: Key('restaurant-page-day-column-$day'), child: Column( mainAxisSize: MainAxisSize.min, diff --git a/uni/lib/view/schedule/schedule.dart b/uni/lib/view/schedule/schedule.dart index 47f266ab7..bccfe528a 100644 --- a/uni/lib/view/schedule/schedule.dart +++ b/uni/lib/view/schedule/schedule.dart @@ -3,10 +3,9 @@ import 'package:provider/provider.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/lecture.dart'; import 'package:uni/model/providers/lazy/lecture_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/expanded_image_label.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; -import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; +import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/lazy_consumer.dart'; import 'package:uni/view/locale_notifier.dart'; import 'package:uni/view/schedule/widgets/schedule_slot.dart'; @@ -18,24 +17,13 @@ class SchedulePage extends StatefulWidget { SchedulePageState createState() => SchedulePageState(); } -class SchedulePageState extends GeneralPageViewState { +class SchedulePageState extends SecondaryPageViewState { @override Widget getBody(BuildContext context) { - return Column( - children: [ - PageTitle( - name: S.of(context).nav_title( - DrawerItem.navSchedule.title, - ), - ), - Expanded( - child: LazyConsumer>( - builder: (context, lectures) => SchedulePageView(lectures), - hasContent: (lectures) => lectures.isNotEmpty, - onNullContent: const SchedulePageView([]), - ), - ), - ], + return LazyConsumer>( + builder: (context, lectures) => SchedulePageView(lectures), + hasContent: (lectures) => lectures.isNotEmpty, + onNullContent: const SchedulePageView([]), ); } @@ -43,6 +31,10 @@ class SchedulePageState extends GeneralPageViewState { Future onRefresh(BuildContext context) async { await context.read().forceRefresh(context); } + + @override + String? getTitle() => + S.of(context).nav_title(NavigationItem.navSchedule.route); } class SchedulePageView extends StatefulWidget { diff --git a/uni/lib/view/settings/settings.dart b/uni/lib/view/settings/settings.dart index c1f0210a9..0354ea919 100644 --- a/uni/lib/view/settings/settings.dart +++ b/uni/lib/view/settings/settings.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/view/about/about.dart'; import 'package:uni/view/bug_report/bug_report.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; import 'package:uni/view/common_widgets/pages_layouts/secondary/secondary.dart'; import 'package:uni/view/settings/widgets/locale_switch_button.dart'; import 'package:uni/view/settings/widgets/logout_confirm_dialog.dart'; @@ -24,8 +23,7 @@ class SettingsPageState extends SecondaryPageViewState { Widget getBody(BuildContext context) { return Column( children: [ - PageTitle(name: S.of(context).settings), - const Padding(padding: EdgeInsets.only(top: 10)), + const Padding(padding: EdgeInsets.only(top: 50)), Expanded( child: Container( padding: const EdgeInsets.symmetric(horizontal: 20), @@ -95,4 +93,7 @@ class SettingsPageState extends SecondaryPageViewState { @override Future onRefresh(BuildContext context) async {} + + @override + String? getTitle() => S.of(context).settings; } diff --git a/uni/lib/view/theme.dart b/uni/lib/view/theme.dart index c7c0f37f8..72585db48 100644 --- a/uni/lib/view/theme.dart +++ b/uni/lib/view/theme.dart @@ -9,6 +9,7 @@ const Color _strongGrey = Color.fromARGB(255, 90, 90, 90); const Color _mildBlack = Color.fromARGB(255, 43, 43, 43); const Color _darkishBlack = Color.fromARGB(255, 43, 43, 43); const Color _darkBlack = Color.fromARGB(255, 27, 27, 27); +const Color _lightBlue = Color.fromARGB(255, 172, 193, 206); const _textTheme = TextTheme( displayLarge: TextStyle(fontSize: 40, fontWeight: FontWeight.w400), @@ -54,7 +55,7 @@ ThemeData applicationDarkTheme = ThemeData( background: _darkBlack, primary: _lightGrey, onPrimary: _darkishBlack, - secondary: _lightGrey, + secondary: _lightBlue, onSecondary: _darkishBlack, tertiary: _lightGrey, onTertiary: _darkishBlack, diff --git a/uni/lib/view/transports/transports.dart b/uni/lib/view/transports/transports.dart index 2e9a47b96..ff6fa3cf3 100644 --- a/uni/lib/view/transports/transports.dart +++ b/uni/lib/view/transports/transports.dart @@ -1,8 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:uni/generated/l10n.dart'; -import 'package:uni/utils/drawer_items.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; -import 'package:uni/view/common_widgets/page_title.dart'; import 'package:uni/view/common_widgets/pages_layouts/general/general.dart'; import 'package:uni/view/home/widgets/bus_stop_card.dart'; import 'package:uni/view/transports/widgets/map_snapshot_card.dart'; @@ -24,14 +21,7 @@ class TransportsPageViewState extends GeneralPageViewState { @override Widget getBody(BuildContext context) { return ListView( - children: [ - PageTitle( - name: S.of(context).nav_title(DrawerItem.navTransports.title), - ), - Column( - children: transportsCards, - ), - ], + children: transportsCards, ); } diff --git a/uni/lib/view/transports/widgets/map_snapshot_card.dart b/uni/lib/view/transports/widgets/map_snapshot_card.dart index df946b14f..5ba79c1f5 100644 --- a/uni/lib/view/transports/widgets/map_snapshot_card.dart +++ b/uni/lib/view/transports/widgets/map_snapshot_card.dart @@ -4,7 +4,7 @@ import 'package:provider/provider.dart'; import 'package:uni/generated/l10n.dart'; import 'package:uni/model/entities/location_group.dart'; import 'package:uni/model/providers/lazy/faculty_locations_provider.dart'; -import 'package:uni/utils/drawer_items.dart'; +import 'package:uni/utils/navigation_items.dart'; import 'package:uni/view/common_widgets/generic_card.dart'; import 'package:uni/view/lazy_consumer.dart'; import 'package:uni/view/locations/widgets/faculty_map.dart'; @@ -20,11 +20,11 @@ class MapCard extends GenericCard { @override String getTitle(BuildContext context) => - '${S.of(context).nav_title(DrawerItem.navLocations.title)}: FEUP'; + '${S.of(context).nav_title(NavigationItem.navLocations.route)}: FEUP'; @override Future onClick(BuildContext context) => - Navigator.pushNamed(context, '/${DrawerItem.navLocations.title}'); + Navigator.pushNamed(context, '/${NavigationItem.navLocations.route}'); @override Widget buildCardContent(BuildContext context) { @@ -44,7 +44,7 @@ class MapCard extends GenericCard { Widget buildMapView(BuildContext context, List locations) { return GestureDetector( onTap: () => - Navigator.pushNamed(context, '/${DrawerItem.navLocations.title}'), + Navigator.pushNamed(context, '/${NavigationItem.navLocations.route}'), child: AbsorbPointer( child: Container( padding: const EdgeInsets.fromLTRB(20, 20, 20, 20), diff --git a/uni/lib/view/useful_info/useful_info.dart b/uni/lib/view/useful_info/useful_info.dart new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/uni/lib/view/useful_info/useful_info.dart @@ -0,0 +1 @@ + diff --git a/uni/test/integration/src/exams_page_test.dart b/uni/test/integration/src/exams_page_test.dart index b85d95c45..c0bb1160b 100644 --- a/uni/test/integration/src/exams_page_test.dart +++ b/uni/test/integration/src/exams_page_test.dart @@ -132,13 +132,13 @@ void main() async { await tester.pumpAndSettle(); expect(find.byKey(Key('$sdisExam-exam')), findsOneWidget); expect(find.byKey(Key('$sopeExam-exam')), findsOneWidget); - expect(find.byIcon(Icons.filter_alt), findsOneWidget); + expect(find.byIcon(Icons.filter_list), findsOneWidget); filteredExams['ExamDoesNotExist'] = true; await tester.pumpAndSettle(); - final filterButton = find.widgetWithIcon(IconButton, Icons.filter_alt); + final filterButton = find.widgetWithIcon(IconButton, Icons.filter_list); expect(filterButton, findsOneWidget); await tester.tap(filterButton);