diff --git a/mobile/lib/features/channels/channels_page.dart b/mobile/lib/features/channels/channels_page.dart index 48bdf147f..8390b9509 100644 --- a/mobile/lib/features/channels/channels_page.dart +++ b/mobile/lib/features/channels/channels_page.dart @@ -57,6 +57,7 @@ part 'channels_page/community.dart'; part 'channels_page/quick_actions.dart'; part 'channels_page/quick_actions_launcher.dart'; part 'channels_page/wide_navigation.dart'; +part 'channels_page/wide_channel_content.dart'; enum _QuickAction { createChannel, newDm } diff --git a/mobile/lib/features/channels/channels_page/wide_channel_content.dart b/mobile/lib/features/channels/channels_page/wide_channel_content.dart new file mode 100644 index 000000000..4ea8137d7 --- /dev/null +++ b/mobile/lib/features/channels/channels_page/wide_channel_content.dart @@ -0,0 +1,37 @@ +part of '../channels_page.dart'; + +/// Nested tablet channel detail surface resolved from a selected channel ID. +class WideChannelContent extends HookConsumerWidget { + final String channelId; + final VoidCallback onChannelLeft; + + const WideChannelContent({ + super.key, + required this.channelId, + required this.onChannelLeft, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final channels = ref.watch(channelsProvider).asData?.value; + final channel = channels?.cast().firstWhere( + (channel) => channel?.id == channelId, + orElse: () => null, + ); + if (channel == null) return const SizedBox.shrink(); + final navigatorKey = useMemoized(GlobalKey.new, [ + channelId, + ]); + return NavigatorPopHandler( + key: ValueKey('wide-channel-detail-$channelId'), + onPopWithResult: (_) => navigatorKey.currentState?.maybePop(), + child: Navigator( + key: navigatorKey, + onGenerateRoute: (_) => MaterialPageRoute( + builder: (_) => + ChannelDetailPage(channel: channel, onChannelLeft: onChannelLeft), + ), + ), + ); + } +} diff --git a/mobile/lib/features/channels/channels_page/wide_navigation.dart b/mobile/lib/features/channels/channels_page/wide_navigation.dart index a2d5da120..d501b2585 100644 --- a/mobile/lib/features/channels/channels_page/wide_navigation.dart +++ b/mobile/lib/features/channels/channels_page/wide_navigation.dart @@ -794,42 +794,6 @@ class _WideChannelDestination extends StatelessWidget { } } -/// Nested tablet channel detail surface resolved from a selected channel ID. -class WideChannelContent extends HookConsumerWidget { - final String channelId; - final VoidCallback onChannelLeft; - - const WideChannelContent({ - super.key, - required this.channelId, - required this.onChannelLeft, - }); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final channels = ref.watch(channelsProvider).asData?.value; - final channel = channels?.cast().firstWhere( - (channel) => channel?.id == channelId, - orElse: () => null, - ); - if (channel == null) return const SizedBox.shrink(); - final navigatorKey = useMemoized(GlobalKey.new, [ - channelId, - ]); - return NavigatorPopHandler( - key: ValueKey('wide-channel-detail-$channelId'), - onPopWithResult: (_) => navigatorKey.currentState?.maybePop(), - child: Navigator( - key: navigatorKey, - onGenerateRoute: (_) => MaterialPageRoute( - builder: (_) => - ChannelDetailPage(channel: channel, onChannelLeft: onChannelLeft), - ), - ), - ); - } -} - class _WideNavigationDestination extends StatelessWidget { final WideNavigationDestination destination; final bool selected;