diff --git a/lib/src/app.dart b/lib/src/app.dart index 516e27b54b..b6e4eaf8c7 100644 --- a/lib/src/app.dart +++ b/lib/src/app.dart @@ -90,6 +90,7 @@ class _AppState extends ConsumerState { navigatorObservers: [ immersiveModeRouteObserver, wakelockRouteObserver, + tvRouteObserver, ], ); } diff --git a/lib/src/navigation.dart b/lib/src/navigation.dart index fecffc630d..f22e9d44b7 100644 --- a/lib/src/navigation.dart +++ b/lib/src/navigation.dart @@ -79,7 +79,7 @@ final puzzlesScrollController = ScrollController(debugLabel: 'PuzzlesScroll'); final watchScrollController = ScrollController(debugLabel: 'WatchScroll'); final profileScrollController = ScrollController(debugLabel: 'ProfileScroll'); -final RouteObserver> watchTabRouteObserver = +final RouteObserver> tvRouteObserver = RouteObserver>(); final tabsProvider = Provider>((ref) { @@ -201,7 +201,6 @@ class BottomNavScaffold extends ConsumerWidget { case 2: return _MaterialTabView( navigatorKey: watchNavigatorKey, - navigatorObservers: [watchTabRouteObserver], builder: (context) => const WatchTabScreen(), ); case 3: @@ -234,7 +233,6 @@ class BottomNavScaffold extends ConsumerWidget { return CupertinoTabView( defaultTitle: context.l10n.watch, navigatorKey: watchNavigatorKey, - navigatorObservers: [watchTabRouteObserver], builder: (context) => const WatchTabScreen(), ); case 3: diff --git a/lib/src/view/watch/live_tv_channels_screen.dart b/lib/src/view/watch/live_tv_channels_screen.dart index 00d0ce173b..55b7639cb9 100644 --- a/lib/src/view/watch/live_tv_channels_screen.dart +++ b/lib/src/view/watch/live_tv_channels_screen.dart @@ -74,14 +74,14 @@ class _TvChannelsScreenState extends ConsumerState super.didChangeDependencies(); final route = ModalRoute.of(context); if (route != null && route is PageRoute) { - watchTabRouteObserver.subscribe(this, route); + tvRouteObserver.subscribe(this, route); } } @override void dispose() { WidgetsBinding.instance.removeObserver(this); - watchTabRouteObserver.unsubscribe(this); + tvRouteObserver.unsubscribe(this); super.dispose(); } @@ -109,10 +109,7 @@ class _Body extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final currentBottomTab = ref.watch(currentBottomTabProvider); - final gamesAsync = currentBottomTab == BottomTab.watch - ? ref.watch(liveTvChannelsProvider) - : const AsyncLoading(); + final gamesAsync = ref.watch(liveTvChannelsProvider); return gamesAsync.when( data: (games) { final list = [ @@ -127,6 +124,7 @@ class _Body extends ConsumerWidget { onTap: () { pushPlatformRoute( context, + rootNavigator: true, builder: (_) => TvScreen( channel: game.channel, initialGame: (game.id, game.orientation), diff --git a/lib/src/view/watch/tv_screen.dart b/lib/src/view/watch/tv_screen.dart index 05f9d75324..add03847f0 100644 --- a/lib/src/view/watch/tv_screen.dart +++ b/lib/src/view/watch/tv_screen.dart @@ -98,14 +98,14 @@ class _TvScreenState extends ConsumerState super.didChangeDependencies(); final route = ModalRoute.of(context); if (route != null && route is PageRoute) { - watchTabRouteObserver.subscribe(this, route); + tvRouteObserver.subscribe(this, route); } } @override void dispose() { WidgetsBinding.instance.removeObserver(this); - watchTabRouteObserver.unsubscribe(this); + tvRouteObserver.unsubscribe(this); super.dispose(); } @@ -143,10 +143,7 @@ class _Body extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final currentBottomTab = ref.watch(currentBottomTabProvider); - final asyncGame = currentBottomTab == BottomTab.watch - ? ref.watch(tvControllerProvider(channel, initialGame)) - : const AsyncLoading(); + final asyncGame = ref.watch(tvControllerProvider(channel, initialGame)); return SafeArea( child: Center( diff --git a/lib/src/view/watch/watch_tab_screen.dart b/lib/src/view/watch/watch_tab_screen.dart index 5b286823b3..4246609ba1 100644 --- a/lib/src/view/watch/watch_tab_screen.dart +++ b/lib/src/view/watch/watch_tab_screen.dart @@ -191,6 +191,7 @@ class _WatchTvWidget extends ConsumerWidget { headerTrailing: NoPaddingTextButton( onPressed: () => pushPlatformRoute( context, + rootNavigator: true, builder: (context) => const LiveTvChannelsScreen(), ).then((_) => _refreshData(ref)), child: Text( @@ -208,6 +209,7 @@ class _WatchTvWidget extends ConsumerWidget { ), onTap: () => pushPlatformRoute( context, + rootNavigator: true, builder: (context) => TvScreen(channel: snapshot.channel), ).then((_) => _refreshData(ref)), );