mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
split tablet channel content
Signed-off-by: kenny lopez <klopez4212@gmail.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user