diff --git a/uni/lib/utils/navbar_items.dart b/uni/lib/utils/navbar_items.dart index 711021a11..130a99eb6 100644 --- a/uni/lib/utils/navbar_items.dart +++ b/uni/lib/utils/navbar_items.dart @@ -2,29 +2,28 @@ import 'package:flutter/material.dart'; enum NavbarItem { navPersonalArea( - 'Área Pessoal', Icons.home_outlined, - ['Área Pessoal'], + ['area'], ), - navStudentArea( - 'Área do Estudante', + navAcademicPath( Icons.school_outlined, - ['Horário', 'Exames', 'Cadeiras'], + ['horario', 'exames', 'cadeiras'], ), - navMap( - 'Mapa e Transportes', - Icons.map_outlined, - ['Autocarros', 'Locais'], + navTransports( + Icons.directions_bus_filled_outlined, + ['autocarros'] ), navFaculty( - 'Faculdade', Icons.domain_outlined, - ['Restaurantes', 'Calendário', 'Biblioteca', 'Úteis'], + ['locais', 'biblioteca', 'uteis'], + ), + navRestaurants( + Icons.local_cafe_outlined, + ['restaurantes'], ); - const NavbarItem(this.label, this.icon, this.routes); + const NavbarItem(this.icon, this.routes); - final String label; final IconData icon; final List routes; // TODO(Process-ing): Transform into single route when the new pages are done @@ -32,7 +31,7 @@ enum NavbarItem { BottomNavigationBarItem toBottomNavigationBarItem() { return BottomNavigationBarItem( icon: Icon(icon), - label: label, + label: '', ); } } 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 a1966bb8b..7eecbbfa5 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 @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:uni/utils/drawer_items.dart'; import 'package:uni/utils/navbar_items.dart'; class AppBottomNavbar extends StatefulWidget { @@ -21,7 +22,7 @@ class AppBottomNavbarState extends State { String _getCurrentRoute() => ModalRoute.of(widget.parentContext)!.settings.name == null - ? NavbarItem.values.toList()[0].label + ? DrawerItem.navPersonalArea.title : ModalRoute.of(widget.parentContext)!.settings.name!.substring(1); int _getCurrentIndex() { @@ -33,7 +34,7 @@ class AppBottomNavbarState extends State { } } - return NavbarItem.navPersonalArea.index; + return -1; } void _onItemTapped(int index) { @@ -41,7 +42,7 @@ class AppBottomNavbarState extends State { final item = NavbarItem.values[index]; final key = item.routes.isNotEmpty ? item.routes[0] - : NavbarItem.navPersonalArea.routes[0]; + : DrawerItem.navPersonalArea.title; if (prev != key) { Navigator.of(context).pop(); @@ -51,11 +52,18 @@ class AppBottomNavbarState extends State { @override Widget build(BuildContext context) { + final currentIndex = _getCurrentIndex(); return BottomNavigationBar( items: navbarItems, - currentIndex: _getCurrentIndex(), - selectedItemColor: Theme.of(context).primaryColor, + type: currentIndex == -1 ? BottomNavigationBarType.fixed + : BottomNavigationBarType.shifting, + currentIndex: currentIndex == -1 ? 0 : currentIndex, + selectedItemColor: currentIndex == -1 + ? Theme.of(context).colorScheme.onSurface + : Theme.of(context).primaryColor, unselectedItemColor: Theme.of(context).colorScheme.onSurface, + showSelectedLabels: false, + showUnselectedLabels: false, onTap: _onItemTapped, ); }