only show gesture tile with active tab

This commit is contained in:
Fabian Freund
2026-06-06 08:05:32 +02:00
parent 7614f5ea9f
commit b0ac6c97b0
@@ -111,9 +111,6 @@ class _BrowserMenuSheet extends HookConsumerWidget {
final colorScheme = Theme.of(context).colorScheme; final colorScheme = Theme.of(context).colorScheme;
final selectedTabId = ref.watch(selectedTabProvider); final selectedTabId = ref.watch(selectedTabProvider);
final settings = ref.watch(generalSettingsWithDefaultsProvider); final settings = ref.watch(generalSettingsWithDefaultsProvider);
final gesturesEnabled = ref.watch(
gestureSettingsWithDefaultsProvider.select((s) => s.enabled),
);
return DraggableScrollableSheet( return DraggableScrollableSheet(
initialChildSize: 0.85, initialChildSize: 0.85,
@@ -148,7 +145,7 @@ class _BrowserMenuSheet extends HookConsumerWidget {
), ),
children: [ children: [
// Quick toggles (Desktop / Reader / Gestures) // Quick toggles (Desktop / Reader / Gestures)
if (selectedTabId != null || gesturesEnabled) ...[ if (selectedTabId != null) ...[
_QuickTogglesGrid(selectedTabId: selectedTabId), _QuickTogglesGrid(selectedTabId: selectedTabId),
const SizedBox(height: 16), const SizedBox(height: 16),
], ],
@@ -583,9 +580,9 @@ class _PageActionsCard extends HookConsumerWidget {
// ─── Quick Toggles Grid ─── // ─── Quick Toggles Grid ───
/// Unified bar of quick toggles. Page-scoped toggles (Desktop / Reader) appear /// Unified bar of quick toggles (Desktop / Reader / Gestures). These appear
/// only when a tab is selected; the global Gestures toggle appears whenever the /// only when a tab is selected; the Gestures toggle additionally requires the
/// gesture master switch is on. They are laid out as a connected, equal-width /// gesture master switch to be on. They are laid out as a connected, equal-width
/// segmented bar (icon over label) that wraps to a new row past four toggles. /// segmented bar (icon over label) that wraps to a new row past four toggles.
class _QuickTogglesGrid extends ConsumerWidget { class _QuickTogglesGrid extends ConsumerWidget {
final String? selectedTabId; final String? selectedTabId;
@@ -652,27 +649,27 @@ class _QuickTogglesGrid extends ConsumerWidget {
}, },
), ),
); );
}
if (gestureSettings.enabled) { if (gestureSettings.enabled) {
toggles.add( toggles.add(
_QuickToggle( _QuickToggle(
icon: MdiIcons.gestureSwipe, icon: MdiIcons.gestureSwipe,
label: 'Gestures', label: 'Gestures',
active: gestureSettings.active, active: gestureSettings.active,
onTap: () async { onTap: () async {
await ref await ref
.read(gestureSettingsRepositoryProvider.notifier) .read(gestureSettingsRepositoryProvider.notifier)
.updateSettings( .updateSettings(
(s) => s.copyWith(active: !gestureSettings.active), (s) => s.copyWith(active: !gestureSettings.active),
); );
}, },
onLongPress: () { onLongPress: () {
Navigator.pop(context); Navigator.pop(context);
unawaited(GestureSettingsRoute().push(context)); unawaited(GestureSettingsRoute().push(context));
}, },
), ),
); );
}
} }
if (toggles.isEmpty) return const SizedBox.shrink(); if (toggles.isEmpty) return const SizedBox.shrink();