Skip to content

Commit

Permalink
Disable Watch tab when offline
Browse files Browse the repository at this point in the history
  • Loading branch information
jas14 committed Sep 15, 2024
1 parent 3326e08 commit 88959d1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/src/navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ enum BottomTab {
return Icons.settings;
}
}

bool enabled({required bool isOnline}) {
switch (this) {
case BottomTab.watch:
return isOnline;
default:
return true;
}
}
}

final currentBottomTabProvider =
Expand Down Expand Up @@ -151,6 +160,7 @@ class BottomNavScaffold extends ConsumerWidget {
NavigationDestination(
icon: Icon(tab == currentTab ? tab.activeIcon : tab.icon),
label: tab.label(context.l10n),
enabled: tab.enabled(isOnline: isOnline),
),
],
onDestinationSelected: (i) =>
Expand Down

0 comments on commit 88959d1

Please sign in to comment.