Merge commit '551e403d48d51e4904387d2c299dcfd9ec62dbf9' into pipelines/run-20261111-1951-material-cleanup-shared-ui-primitives-65fb
This commit is contained in:
@@ -33,7 +33,6 @@ class NeedsYouBell extends StatefulWidget {
|
||||
required this.onOpen,
|
||||
required this.onDismiss,
|
||||
required this.onClearAll,
|
||||
this.cupertino,
|
||||
});
|
||||
|
||||
final List<AttentionEntry> entries;
|
||||
@@ -41,10 +40,6 @@ class NeedsYouBell extends StatefulWidget {
|
||||
final ValueChanged<AttentionEntry> onDismiss;
|
||||
final ValueChanged<List<AttentionEntry>> onClearAll;
|
||||
|
||||
/// Retained for callers that still pass it; the bell is the Material action
|
||||
/// whether this is set or not.
|
||||
final bool? cupertino;
|
||||
|
||||
@override
|
||||
State<NeedsYouBell> createState() => _NeedsYouBellState();
|
||||
}
|
||||
@@ -132,7 +127,6 @@ class _NeedsYouBellState extends State<NeedsYouBell> {
|
||||
onOpen: _activate,
|
||||
onDismiss: widget.onDismiss,
|
||||
onClearAll: widget.onClearAll,
|
||||
cupertino: widget.cupertino,
|
||||
);
|
||||
if (!mounted || _openedRun) return;
|
||||
// The browser returns focus to the bell after the sheet closes; do the same
|
||||
|
||||
@@ -25,7 +25,6 @@ class NeedsYouRunsHeading extends StatefulWidget {
|
||||
this.syncToken = 0,
|
||||
this.store = const SharedPreferencesAttentionStore(),
|
||||
this.now,
|
||||
this.cupertino,
|
||||
this.notifications,
|
||||
this.attention,
|
||||
});
|
||||
@@ -48,10 +47,6 @@ class NeedsYouRunsHeading extends StatefulWidget {
|
||||
/// Injected clock for deterministic local-day windows.
|
||||
final DateTime Function()? now;
|
||||
|
||||
/// Retained for callers that still pass it; the heading is always the
|
||||
/// Material bell whether this is set or not.
|
||||
final bool? cupertino;
|
||||
|
||||
/// The app-level notification capability. Absent in fixtures that only draw
|
||||
/// the bell, so no store or platform bridge is touched there.
|
||||
final NotificationController? notifications;
|
||||
@@ -163,7 +158,6 @@ class _NeedsYouRunsHeadingState extends State<NeedsYouRunsHeading> {
|
||||
animation: _attention,
|
||||
builder: (context, _) => NeedsYouBell(
|
||||
entries: _attention.entries,
|
||||
cupertino: widget.cupertino,
|
||||
onOpen: widget.onOpen,
|
||||
onDismiss: (entry) {
|
||||
unawaited(_attention.dismiss(entry));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/app_popups.dart';
|
||||
import '../domain/attention_models.dart';
|
||||
import 'needs_you_sheet_material.dart';
|
||||
|
||||
@@ -12,19 +13,40 @@ import 'needs_you_sheet_material.dart';
|
||||
/// only on it, so an entry that arrives while the sheet is open is shown but is
|
||||
/// never silently cleared.
|
||||
///
|
||||
/// The sheet stays open after Dismiss and Clear all, so several rows can be
|
||||
/// The surface stays open after Dismiss and Clear all, so several rows can be
|
||||
/// dealt with in one visit. Choosing a row closes it; Escape, the barrier and
|
||||
/// system back are native route behaviour. The sheet is always the Material
|
||||
/// bottom sheet; [cupertino] is retained for callers that still pass it.
|
||||
/// system back are native route behaviour. Narrow windows use a Material
|
||||
/// bottom sheet; wide windows use a bounded Material dialog.
|
||||
Future<void> showNeedsYouSheet({
|
||||
required BuildContext context,
|
||||
required ValueListenable<List<AttentionEntry>> entries,
|
||||
required ValueChanged<AttentionEntry> onOpen,
|
||||
required ValueChanged<AttentionEntry> onDismiss,
|
||||
required ValueChanged<List<AttentionEntry>> onClearAll,
|
||||
bool? cupertino,
|
||||
}) {
|
||||
final snapshot = attentionDismissalSnapshot(entries.value);
|
||||
if (usesDesktopPopups(context)) {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
builder: (dialog) => Dialog(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: 560,
|
||||
maxHeight: MediaQuery.sizeOf(dialog).height * 0.85,
|
||||
),
|
||||
child: MaterialNeedsYouSheet(
|
||||
entries: entries,
|
||||
snapshot: snapshot,
|
||||
onOpen: onOpen,
|
||||
onDismiss: onDismiss,
|
||||
onClearAll: onClearAll,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
|
||||
@@ -60,7 +60,6 @@ class MaterialNeedsYouSheet extends StatelessWidget {
|
||||
children: [
|
||||
AppSheetHeader(
|
||||
title: attentionSheetTitle,
|
||||
cupertino: false,
|
||||
doneKey: attentionDoneKey,
|
||||
actions: [
|
||||
if (rows.isNotEmpty)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/adaptive/app_popups.dart';
|
||||
import '../../../../ui/layout/app_sheet_header.dart';
|
||||
import '../../domain/chat_colors.dart';
|
||||
import 'chat_color_palette.dart';
|
||||
@@ -135,7 +136,6 @@ Future<void> showChatColorPicker(
|
||||
children: [
|
||||
AppSheetHeader(
|
||||
title: 'Colour for $title',
|
||||
cupertino: false,
|
||||
doneKey: const Key('chat-color-done'),
|
||||
),
|
||||
Padding(
|
||||
@@ -144,11 +144,9 @@ Future<void> showChatColorPicker(
|
||||
),
|
||||
],
|
||||
);
|
||||
await showModalBottomSheet<void>(
|
||||
context: context,
|
||||
showDragHandle: true,
|
||||
isScrollControlled: true,
|
||||
useSafeArea: true,
|
||||
await showAppDetails<void>(
|
||||
context,
|
||||
maxWidth: 420,
|
||||
builder: (sheet) => SingleChildScrollView(child: content(sheet)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/app_popups.dart';
|
||||
import '../../../ui/input/app_search_field.dart';
|
||||
import '../../../ui/layout/app_sheet_header.dart';
|
||||
import '../../pipelines/pipeline_format.dart' show runStateLabel;
|
||||
@@ -18,6 +19,22 @@ Future<void> showRunsFilterSheet(
|
||||
BuildContext context,
|
||||
RunsController controller,
|
||||
) {
|
||||
if (usesDesktopPopups(context)) {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
builder: (dialog) => Dialog(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: 560,
|
||||
maxHeight: MediaQuery.sizeOf(dialog).height * 0.85,
|
||||
),
|
||||
child: _RunsFilterSheet(controller: controller),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return showModalBottomSheet<void>(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
@@ -94,7 +111,6 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> {
|
||||
final field = AppSearchField(
|
||||
fieldKey: const ValueKey('runs.filter.query'),
|
||||
controller: _text,
|
||||
cupertino: false,
|
||||
placeholder: 'Filter runs',
|
||||
onChanged: controller.setQuery,
|
||||
);
|
||||
@@ -113,7 +129,6 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> {
|
||||
children: [
|
||||
AppSheetHeader(
|
||||
title: runsFilterTitle,
|
||||
cupertino: false,
|
||||
doneKey: runsFilterDoneKey,
|
||||
actions: [if (active) _clearButton()],
|
||||
),
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../ui/adaptive/app_popups.dart';
|
||||
import 'keyboard_shortcuts_registry.dart';
|
||||
|
||||
const keyboardShortcutsLabel = 'Keyboard shortcuts';
|
||||
|
||||
Future<void> showKeyboardShortcutsHelp(BuildContext context) =>
|
||||
showAppDetails<void>(
|
||||
context,
|
||||
maxWidth: 640,
|
||||
builder: (_) => const KeyboardShortcutsHelp(),
|
||||
);
|
||||
|
||||
class KeyboardShortcutsHelp extends StatelessWidget {
|
||||
const KeyboardShortcutsHelp({super.key, this.registry});
|
||||
|
||||
final KeyboardShortcutRegistry? registry;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final entries = (registry ?? KeyboardShortcutRegistry.current()).entries;
|
||||
final content = Semantics(
|
||||
scopesRoute: true,
|
||||
namesRoute: true,
|
||||
explicitChildNodes: true,
|
||||
label: 'Keyboard shortcuts help',
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(24, 8, 24, 24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
keyboardShortcutsLabel,
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Close keyboard shortcuts',
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Shortcuts available in the current app and browser environment.',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
for (final (index, entry) in entries.indexed) ...[
|
||||
if (index > 0) const Divider(height: 1),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: _ShortcutRow(entry: entry),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'On macOS, Option is shown for Alt. Browsers can reserve system or tab shortcuts.',
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
// The desktop details dialog supplies its own bounded scroll view. The
|
||||
// narrow details sheet does not, so keep the help readable at large text
|
||||
// scales and on short phone screens there as well.
|
||||
return usesDesktopPopups(context)
|
||||
? content
|
||||
: SingleChildScrollView(child: content);
|
||||
}
|
||||
}
|
||||
|
||||
class _ShortcutRow extends StatelessWidget {
|
||||
const _ShortcutRow({required this.entry});
|
||||
|
||||
final KeyboardShortcutEntry entry;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Semantics(
|
||||
container: true,
|
||||
label:
|
||||
'${entry.action}: ${entry.keys}${entry.caveat == null ? '' : '. ${entry.caveat}'}',
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: Text(entry.action)),
|
||||
const SizedBox(width: 16),
|
||||
Flexible(
|
||||
child: Text(
|
||||
entry.keys,
|
||||
textAlign: TextAlign.end,
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (entry.caveat case final caveat?) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(caveat, style: Theme.of(context).textTheme.bodySmall),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../chat/workspace/chat_center_stage_controller.dart';
|
||||
import '../chat/workspace/chat_float_shortcut.dart';
|
||||
import '../terminal/terminal_shortcuts.dart';
|
||||
import '../../shell/windows/window_shortcuts.dart';
|
||||
import '../../shell/shell_search_shortcut_labels.dart';
|
||||
|
||||
/// A shortcut entry shown in the in-app help. Keeping these entries together
|
||||
/// prevents the help page from inventing chords that the handlers do not use.
|
||||
class KeyboardShortcutEntry {
|
||||
const KeyboardShortcutEntry({
|
||||
required this.action,
|
||||
required this.keys,
|
||||
this.caveat,
|
||||
});
|
||||
|
||||
final String action;
|
||||
final String keys;
|
||||
final String? caveat;
|
||||
}
|
||||
|
||||
class KeyboardShortcutRegistry {
|
||||
const KeyboardShortcutRegistry({required this.platform, required this.web});
|
||||
|
||||
factory KeyboardShortcutRegistry.current() =>
|
||||
KeyboardShortcutRegistry(platform: defaultTargetPlatform, web: kIsWeb);
|
||||
|
||||
final TargetPlatform platform;
|
||||
final bool web;
|
||||
|
||||
bool get _apple =>
|
||||
platform == TargetPlatform.macOS || platform == TargetPlatform.iOS;
|
||||
|
||||
bool get _macOS => platform == TargetPlatform.macOS;
|
||||
|
||||
List<KeyboardShortcutEntry> get entries => [
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Show or hide terminal',
|
||||
keys: TerminalShortcutLabels(
|
||||
web: web,
|
||||
platform: platform,
|
||||
).toggle.join(', '),
|
||||
caveat: web
|
||||
? 'Browser tab shortcuts such as Cmd+T are not available to the app.'
|
||||
: null,
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Show or hide floating chats',
|
||||
keys: _apple
|
||||
? '${chatFloatShortcutLabel(platform)}, Ctrl+Y, Cmd+Y'
|
||||
: '${chatFloatShortcutLabel(platform)}, Ctrl+Y',
|
||||
caveat:
|
||||
'Brings a chat forward from Terminal and focuses its message input.',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Toggle Center Stage',
|
||||
keys:
|
||||
'${chatCenterStageShortcutLabel(platform)}${_apple ? ', Cmd+E' : ', Ctrl+E'}',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Open Search',
|
||||
keys: shellSearchShortcutLabels(platform).join(', '),
|
||||
caveat: web ? 'The browser may reserve some keyboard shortcuts.' : null,
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Cycle floating windows',
|
||||
keys:
|
||||
'${windowCycleShortcutLabel(platform)}, ${windowCycleShortcutLabel(platform)} with Shift',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Open a chat list item',
|
||||
keys: _macOS ? 'Cmd+1…9' : 'Ctrl+1…9',
|
||||
caveat:
|
||||
'Available when the Chat list is mounted; numbers select its visible item.',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Focus the active chat composer',
|
||||
keys: '/',
|
||||
caveat: 'Only outside text fields and other popup surfaces.',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Send a chat message',
|
||||
keys: _apple ? 'Cmd+Enter' : 'Ctrl+Enter',
|
||||
),
|
||||
if (!web)
|
||||
const KeyboardShortcutEntry(
|
||||
action: 'Move between terminal tabs',
|
||||
keys: 'Ctrl+Tab, Ctrl+Shift+Tab',
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'keyboard_shortcuts_help.dart';
|
||||
import 'settings_keys.dart';
|
||||
import 'settings_row.dart';
|
||||
|
||||
class SettingsKeyboardShortcutsSection extends StatelessWidget {
|
||||
const SettingsKeyboardShortcutsSection({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => SettingsRow(
|
||||
key: SettingsKeys.keyboardShortcuts,
|
||||
leading: const Icon(Icons.keyboard_outlined),
|
||||
title: const Text(keyboardShortcutsLabel),
|
||||
subtitle: const Text('See the shortcuts available on this platform.'),
|
||||
chevron: true,
|
||||
onTap: () => showKeyboardShortcutsHelp(context),
|
||||
);
|
||||
}
|
||||
@@ -11,4 +11,7 @@ abstract final class SettingsKeys {
|
||||
static const saveWorkspace = ValueKey<String>('settings.saveWorkspace');
|
||||
static const templates = ValueKey<String>('settings.templates');
|
||||
static const schedules = ValueKey<String>('settings.schedules');
|
||||
static const keyboardShortcuts = ValueKey<String>(
|
||||
'settings.keyboardShortcuts',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import 'settings_templates_section.dart';
|
||||
import 'server_connections.dart';
|
||||
import 'saved_servers_section.dart';
|
||||
import 'managed_connection_section.dart';
|
||||
import 'settings_keyboard_shortcuts_section.dart';
|
||||
|
||||
part 'settings_topic_pages.dart';
|
||||
|
||||
|
||||
@@ -82,6 +82,11 @@ extension _SettingsTopicPages on _SettingsScreenState {
|
||||
SettingsStorageSection(gateway: widget.client),
|
||||
),
|
||||
_single('Server', SettingsHealthSection(gateway: widget.client)),
|
||||
SettingsGroup(
|
||||
title: 'Help',
|
||||
leadingRows: true,
|
||||
children: const [SettingsKeyboardShortcutsSection()],
|
||||
),
|
||||
if (widget.onOpenSchedules != null || widget.onOpenTemplates != null)
|
||||
SettingsGroup(
|
||||
title: 'Library',
|
||||
|
||||
Reference in New Issue
Block a user