feat(navigation): Add configurable tablet drawer behavior
This commit is contained in:
@@ -1331,41 +1331,44 @@ class _ChatPageState extends ConsumerState<ChatPage> {
|
||||
),
|
||||
onPressed: _clearSelection,
|
||||
)
|
||||
: (isTablet
|
||||
? null // Hide menu button on tablets (drawer is always visible)
|
||||
: Builder(
|
||||
builder: (ctx) => Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: Spacing.inputPadding,
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
// Suppress auto-focus and dismiss keyboard, then open drawer
|
||||
try {
|
||||
ref
|
||||
.read(
|
||||
composerAutofocusEnabledProvider
|
||||
.notifier,
|
||||
)
|
||||
.set(false);
|
||||
FocusManager.instance.primaryFocus
|
||||
?.unfocus();
|
||||
SystemChannels.textInput.invokeMethod(
|
||||
'TextInput.hide',
|
||||
);
|
||||
} catch (_) {}
|
||||
ResponsiveDrawerLayout.of(ctx)?.open();
|
||||
},
|
||||
icon: Icon(
|
||||
Platform.isIOS
|
||||
? CupertinoIcons.line_horizontal_3
|
||||
: Icons.menu,
|
||||
color: context.conduitTheme.textPrimary,
|
||||
size: IconSize.appBar,
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
: Builder(
|
||||
builder: (ctx) => Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: Spacing.inputPadding,
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
final layout = ResponsiveDrawerLayout.of(ctx);
|
||||
if (layout == null) return;
|
||||
|
||||
final isDrawerOpen = layout.isOpen;
|
||||
if (!isDrawerOpen) {
|
||||
try {
|
||||
ref
|
||||
.read(
|
||||
composerAutofocusEnabledProvider
|
||||
.notifier,
|
||||
)
|
||||
.set(false);
|
||||
FocusManager.instance.primaryFocus
|
||||
?.unfocus();
|
||||
SystemChannels.textInput.invokeMethod(
|
||||
'TextInput.hide',
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
layout.toggle();
|
||||
},
|
||||
icon: Icon(
|
||||
Platform.isIOS
|
||||
? CupertinoIcons.line_horizontal_3
|
||||
: Icons.menu,
|
||||
color: context.conduitTheme.textPrimary,
|
||||
size: IconSize.appBar,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
title: _isSelectionMode
|
||||
? Text(
|
||||
'${_selectedMessageIds.length} selected',
|
||||
|
||||
@@ -1438,9 +1438,14 @@ class _ChatsDrawerState extends ConsumerState<ChatsDrawer> {
|
||||
container.read(chat.chatMessagesProvider.notifier).clearMessages();
|
||||
|
||||
// Close the slide drawer for faster perceived performance
|
||||
// (only on mobile; on tablet, drawer stays visible)
|
||||
// (only on mobile; keep tablet drawer unless user toggles it)
|
||||
if (mounted) {
|
||||
ResponsiveDrawerLayout.of(context)?.close();
|
||||
final mediaQuery = MediaQuery.maybeOf(context);
|
||||
final isTablet =
|
||||
mediaQuery != null && mediaQuery.size.shortestSide >= 600;
|
||||
if (!isTablet) {
|
||||
ResponsiveDrawerLayout.of(context)?.close();
|
||||
}
|
||||
}
|
||||
|
||||
// Load the full conversation details in the background
|
||||
|
||||
Reference in New Issue
Block a user