Skip to content

Commit

Permalink
fix: do not fallback current index to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Yesterday17 committed Aug 24, 2024
1 parent d52744f commit 53e5688
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/ui/layout/layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class AnnixLayout extends HookConsumerWidget {
},
);

final currentIndex =
pages.indexOf(router.currentRoute).clamp(0, pages.length);
final currentIndex = pages.indexOf(router.currentRoute);
onDestinationSelected(final index) {
router.off(
name: pages[index],
Expand Down Expand Up @@ -176,7 +175,7 @@ class AnnixLayout extends HookConsumerWidget {
),
),
labelType: NavigationRailLabelType.all,
selectedIndex: currentIndex,
selectedIndex: currentIndex >= 0 ? currentIndex : null,
onDestinationSelected: onDestinationSelected,
destinations: destinations
.map(
Expand Down

0 comments on commit 53e5688

Please sign in to comment.