diff --git a/lib/src/navigation.dart b/lib/src/navigation.dart index ccfb8e605d..c2051da8ef 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) => @@ -161,8 +171,8 @@ class BottomNavScaffold extends ConsumerWidget { ); case TargetPlatform.iOS: final isOnline = - ref.watch(connectivityChangesProvider).valueOrNull?.isOnline ?? - true; + ref.watch(connectivityChangesProvider).valueOrNull?.isOnline ?? + true; return CupertinoTabScaffold( tabBuilder: _iOSTabBuilder, controller: _cupertinoTabController,