From b1a71c7bf94715a8ebe3e9422c4831069ffa49f8 Mon Sep 17 00:00:00 2001 From: Process-ing Date: Thu, 18 Jan 2024 19:12:44 +0000 Subject: [PATCH] Fix bottom navbar route handling --- .../general/widgets/bottom_navigation_bar.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 cb6464220..597dd0f36 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 @@ -20,13 +20,14 @@ class AppBottomNavbarState extends State { .map((item) => item.toBottomNavigationBarItem()) .toList(); - String _getCurrentRoute() => - ModalRoute.of(widget.parentContext)!.settings.name == null - ? DrawerItem.navPersonalArea.title - : ModalRoute.of(widget.parentContext)!.settings.name!.substring(1); + String? _getCurrentRoute() => + ModalRoute.of(widget.parentContext)!.settings.name?.substring(1); int _getCurrentIndex() { final currentRoute = _getCurrentRoute(); + if (_getCurrentRoute() == null) { + return -1; + } for (final item in NavbarItem.values) { if (item.routes.contains(currentRoute)) {