diff --git a/lib/widgets/navigation_scaffold/components/navigation_drawer.dart b/lib/widgets/navigation_scaffold/components/navigation_drawer.dart index ac908fd..a2f47c5 100644 --- a/lib/widgets/navigation_scaffold/components/navigation_drawer.dart +++ b/lib/widgets/navigation_scaffold/components/navigation_drawer.dart @@ -92,8 +92,7 @@ class NestedNavigationDrawer extends ConsumerWidget { ), ...views.map((library) => DrawerListButton( label: library.name, - selected: context.router.current.name == LibrarySearchRoute().routeName && - context.routeData.queryParams.getString('parentId') == library.id, + selected: checkLibrary(context, library.id), actions: [ ItemActionButton( label: Text(context.localized.scanLibrary), @@ -152,4 +151,12 @@ class NestedNavigationDrawer extends ConsumerWidget { ], ); } + + bool checkLibrary(BuildContext context, String id) { + try { + return context.routeData.queryParams.isNotEmpty && context.routeData.queryParams.getString('parentId') == id; + } catch (e) { + return false; + } + } }