Fix for empty queryParameters

This commit is contained in:
PartyDonut 2024-10-05 19:52:05 +02:00
parent 249bd685b1
commit 69b3a77d17

View file

@ -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;
}
}
}