split tablet channel content

Signed-off-by: kenny lopez <klopez4212@gmail.com>
This commit is contained in:
kenny lopez
2026-08-03 17:23:16 +01:00
parent 9974e9b9f1
commit 53d32207a8
3 changed files with 38 additions and 36 deletions
@@ -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 }
@@ -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<Channel?>().firstWhere(
(channel) => channel?.id == channelId,
orElse: () => null,
);
if (channel == null) return const SizedBox.shrink();
final navigatorKey = useMemoized(GlobalKey<NavigatorState>.new, [
channelId,
]);
return NavigatorPopHandler(
key: ValueKey('wide-channel-detail-$channelId'),
onPopWithResult: (_) => navigatorKey.currentState?.maybePop(),
child: Navigator(
key: navigatorKey,
onGenerateRoute: (_) => MaterialPageRoute<void>(
builder: (_) =>
ChannelDetailPage(channel: channel, onChannelLeft: onChannelLeft),
),
),
);
}
}
@@ -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<Channel?>().firstWhere(
(channel) => channel?.id == channelId,
orElse: () => null,
);
if (channel == null) return const SizedBox.shrink();
final navigatorKey = useMemoized(GlobalKey<NavigatorState>.new, [
channelId,
]);
return NavigatorPopHandler(
key: ValueKey('wide-channel-detail-$channelId'),
onPopWithResult: (_) => navigatorKey.currentState?.maybePop(),
child: Navigator(
key: navigatorKey,
onGenerateRoute: (_) => MaterialPageRoute<void>(
builder: (_) =>
ChannelDetailPage(channel: channel, onChannelLeft: onChannelLeft),
),
),
);
}
}
class _WideNavigationDestination extends StatelessWidget {
final WideNavigationDestination destination;
final bool selected;