From 88959d1742037e537774f52f782a723dcf184fa4 Mon Sep 17 00:00:00 2001 From: Joe Stein <569991+jas14@users.noreply.github.com> Date: Sat, 14 Sep 2024 17:48:59 -0700 Subject: [PATCH] Disable Watch tab when offline --- lib/src/navigation.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/src/navigation.dart b/lib/src/navigation.dart index ccfb8e605d..4ff8a9a30b 100644 --- a/lib/src/navigation.dart +++ b/lib/src/navigation.dart @@ -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 = @@ -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) =>