Merge commit '551e403d48d51e4904387d2c299dcfd9ec62dbf9' into pipelines/run-20261111-1951-material-cleanup-shared-ui-primitives-65fb

This commit is contained in:
2026-11-11 20:56:34 +00:00
37 changed files with 626 additions and 150 deletions
@@ -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',
+2 -1
View File
@@ -10,6 +10,7 @@ import 'list_detail.dart';
import 'list_pane_widths.dart';
import 'shell_bar.dart';
import 'shell_list_shortcuts.dart';
import 'shell_search_shortcut_labels.dart';
import 'tab_history.dart';
import '../ui/input/keyboard_owner.dart';
@@ -382,7 +383,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
IconButton(
key: const ValueKey('shell.search'),
onPressed: onSearch,
tooltip: 'Search',
tooltip: 'Search (${shellSearchShortcutLabels().join(', ')})',
icon: const Icon(Icons.search),
),
...widget.barActions,
+7 -4
View File
@@ -61,10 +61,13 @@ bool shellSearchShortcut(
TargetPlatform? platform,
}) =>
event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.slash &&
shellPrimaryModifier(keyboard, platform: platform) &&
!keyboard.isAltPressed &&
!keyboard.isShiftPressed;
!keyboard.isShiftPressed &&
(shellPrimaryModifier(keyboard, platform: platform)
? !keyboard.isAltPressed && event.logicalKey == LogicalKeyboardKey.slash
: keyboard.isAltPressed &&
!keyboard.isControlPressed &&
!keyboard.isMetaPressed &&
event.physicalKey == PhysicalKeyboardKey.slash);
const _digits = [
LogicalKeyboardKey.digit1,
@@ -0,0 +1,12 @@
import 'package:flutter/foundation.dart';
/// Search chords supported by the shell, independent of theme overrides.
List<String> shellSearchShortcutLabels([TargetPlatform? platform]) {
final target = platform ?? defaultTargetPlatform;
final apple = target == TargetPlatform.macOS || target == TargetPlatform.iOS;
return [
apple ? 'Option+/' : 'Alt+/',
if (target == TargetPlatform.macOS) 'Cmd+/',
'Ctrl+/',
];
}
@@ -0,0 +1,7 @@
# Desktop dialogs for remaining sheets
Added focused wide/narrow route regressions for the chat colour picker and the
Needs you surface. The existing runs filter test already covers the same split.
Wide layouts assert a Material `Dialog`; narrow layouts assert a Material
`BottomSheet`, while the existing interaction tests continue to cover selection,
dismissal, and live updates.
+26
View File
@@ -0,0 +1,26 @@
# Keyboard shortcuts help
Added a Settings → Tools → Help entry that opens a root-layered, bounded Material help
surface on desktop and the existing adaptive sheet on narrow layouts. The
registry reuses the terminal, floating-chat, Center Stage and window-cycle
label helpers, and records browser caveats for shortcuts that may be reserved.
Search and its tooltip share platform-aware labels for Option/Alt+/, macOS
Cmd+/, and Ctrl+/. The separately reviewed Search handler change (run 367)
is integrated into this candidate before landing the help.
Floating-chat help describes the new Terminal-to-composer focus handoff
instead of the obsolete macOS shell-yank exception.
Chat list numbering likewise uses Command only on macOS, matching the shell
rule on iOS and other platforms.
Focused verification:
- `tool/memwatch/full.sh 'test/features/settings/keyboard_shortcuts_help_test.dart test/features/settings/settings_screen_test.dart'`
— 15 passed, 0 failed.
- `tool/analyze.sh` — clean.
Browser/full-app capture was not run in this implementation stage; ui-review
should verify desktop light/dark, scaled text, keyboard traversal, and phone
constraints with the full-app fixture.
Manager merged-tree verification after Search integration: 24 focused help,
Settings, Search-shortcut and chat-keyboard tests passed; analysis was clean.
+34
View File
@@ -0,0 +1,34 @@
# Material-only fixture cleanup
Removed alternate Cupertino hosts and query switches from the search, saved-server,
and artifact-list browser fixtures. Their existing Material routes, callbacks,
text scaling, selection state, and retry behavior remain unchanged. Updated the
capture-kit documentation to describe the single Material fixture surface.
Focused verification: `artifact_visit_list_test.dart` and
`artifact_visit_list_semantics_test.dart` passed (14 tests); `tool/analyze.sh`
reported clean. No browser capture was run because the fixture chrome host was
only simplified, not visually redesigned.
## Review follow-up
Removed the remaining `platform=cupertino` branch from the full-app capture
fixture and its web/native route helper signatures. The fixture now always
constructs the Material app; the shared `PipelinesApp.cupertino` compatibility
parameter remains untouched for other callers.
Focused verification: the two artifact visit-list tests passed (14 tests), and
`tool/analyze.sh` reported clean. The first attempted test command used stale
paths and failed to load them; the corrected paths were then run successfully.
## Review follow-up
Removed the capture CLI's obsolete `--platform` option and URL forwarding,
including the script/example `platform` field. Capture routes now expose only
the Material fixture while retaining theme, search, sizing, and fixture params.
Focused verification: `artifact_visit_list_test.dart` and
`artifact_visit_list_semantics_test.dart` passed (14 tests); `tool/analyze.sh`
reported clean. `node tool/capture/capture.mjs --help` no longer lists a
platform option, and no platform/Cupertino capture option remains under
`tool/capture`.
+15
View File
@@ -0,0 +1,15 @@
# Open Search with Alt+/ and Command+/
- Updated `shellSearchShortcut` to accept an exact Alt+/ chord by physical
slash position, including macOS Option dead-key logical values.
- Existing Ctrl+/ and macOS Command+/ matching remains logical-slash based;
Shift and mixed/extra modifiers remain rejected.
- Search destination routing, focus, query retention, and composer drafts were
left unchanged.
- Focused checks: `tool/memwatch/full.sh 'test/shell/search_shortcuts_test.dart
test/shell/destination_shortcuts_test.dart test/shell/list_shortcuts_test.dart
test/features/chat/chat_keyboard_focus_test.dart'` — PASS (13 passed, 0
failed, 0 skipped).
- `tool/analyze.sh` — clean.
- Browser capture was not run in this implementation stage; UI review owns
full-app Alt+/ and Meta+/ interaction evidence.
@@ -35,7 +35,6 @@ void main() {
onOpen: (_) {},
now: () => attentionNow,
notifications: notify,
cupertino: false,
),
),
);
@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/attention/ui/needs_you_bell.dart';
import 'package:pipelines_app/features/attention/ui/needs_you_keys.dart';
import 'needs_you_test_support.dart';
@@ -106,32 +104,4 @@ void main() {
expect(find.byKey(attentionSheetKey), findsNothing);
expect(bellHasFocus(tester), isTrue);
});
testWidgets('a stale cupertino flag still draws the Material bell and sheet', (
tester,
) async {
await tester.pumpWidget(
attentionApp(
Scaffold(
body: Center(
child: NeedsYouBell(
entries: [attentionFixture()],
cupertino: true,
onOpen: (_) {},
onDismiss: (_) {},
onClearAll: (_) {},
),
),
),
),
);
expect(tester.widget(find.byKey(attentionBellKey)), isA<IconButton>());
expect(find.byIcon(Icons.notifications_outlined), findsOneWidget);
await tester.tap(find.byKey(attentionBellKey));
await tester.pumpAndSettle();
expect(find.byType(BottomSheet), findsOneWidget);
expect(find.byKey(attentionSheetKey), findsOneWidget);
});
}
@@ -1,4 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/attention/domain/attention_models.dart';
import 'package:pipelines_app/features/attention/ui/needs_you_keys.dart';
@@ -7,6 +7,29 @@ import 'package:pipelines_app/ui/status/run_status_icon.dart';
import 'needs_you_test_support.dart';
void main() {
testWidgets('Needs you uses a dialog wide and a bottom sheet narrow', (
tester,
) async {
final entry = attentionFixture(id: 1, title: 'Ship the release');
tester.view.physicalSize = const Size(800, 1400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await tester.pumpWidget(attentionApp(NeedsYouPage(entries: [entry])));
await tester.tap(find.byKey(attentionBellKey));
await tester.pumpAndSettle();
expect(find.byType(Dialog), findsOneWidget);
Navigator.of(tester.element(find.byKey(attentionSheetKey))).pop();
await tester.pumpAndSettle();
tester.view.physicalSize = const Size(500, 1400);
await tester.pump();
await tester.tap(find.byKey(attentionBellKey));
await tester.pumpAndSettle();
expect(find.byType(BottomSheet), findsOneWidget);
});
testWidgets('Material sheet names every row and every dismiss action', (
tester,
) async {
@@ -5,6 +5,8 @@ import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/chat/screen.dart';
import 'package:pipelines_app/features/chat/ui/sessions/session_actions.dart';
import 'package:pipelines_app/features/chat/workspace/chat_workspace.dart';
import 'package:pipelines_app/features/search/search_screen.dart';
import 'package:pipelines_app/features/search/ui/search_bar_controls.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/shell/destination.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -51,6 +53,11 @@ Future<void> _setup(WidgetTester tester) async {
destination: AppDestination.chat,
destinationBodies: {
AppDestination.chat: (_) => ChatScreen(gateway: gateway),
AppDestination.search: (_) => SearchScreen(
gateway: gateway,
onOpen: (_) {},
embedded: true,
),
},
),
),
@@ -104,8 +111,8 @@ void main() {
expect(await _slash(tester), isFalse);
expect(_editable(tester, 'a').focusNode.hasPrimaryFocus, isTrue);
// Shift+/ (a question mark) and Alt+/ are not the shortcut; Ctrl+/ is
// the shell's own Search chord.
// Shift+/ (a question mark) is not the shortcut. Alt+/ opens the Search
// destination, while Ctrl+/ remains the shell's own Search chord.
await _focusSidebar(tester);
await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.slash, character: '?');
@@ -114,7 +121,11 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.slash);
await tester.sendKeyUpEvent(LogicalKeyboardKey.altLeft);
await tester.pumpAndSettle();
expect(_editable(tester, 'a').focusNode.hasPrimaryFocus, isFalse);
expect(find.byKey(searchFieldKey), findsOneWidget);
expect(
tester.widget<TextField>(find.byKey(searchFieldKey)).focusNode!.hasFocus,
isTrue,
);
await tester.pumpWidget(const SizedBox.shrink());
});
@@ -155,6 +155,45 @@ void main() {
});
});
testWidgets('colour uses a dialog wide and a bottom sheet narrow', (
tester,
) async {
final gateway = _gateway();
tester.view.physicalSize = const Size(800, 1400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.resetPhysicalSize);
addTearDown(tester.view.resetDevicePixelRatio);
await _pump(tester, gateway, brightness: Brightness.light);
await tester.tap(
find.descendant(
of: find.byKey(const Key('chat-actions-s2')),
matching: find.byType(IconButton),
),
);
await tester.pumpAndSettle();
await tester.tap(find.text('Colour…'));
await tester.pumpAndSettle();
expect(find.byType(Dialog), findsOneWidget);
Navigator.of(
tester.element(find.byKey(const Key('chat-color-sheet'))),
).pop();
await tester.pumpAndSettle();
tester.view.physicalSize = const Size(500, 1400);
await tester.pump();
await tester.tap(
find.descendant(
of: find.byKey(const Key('chat-actions-s2')),
matching: find.byType(IconButton),
),
);
await tester.pumpAndSettle();
await tester.tap(find.text('Colour…'));
await tester.pumpAndSettle();
expect(find.byType(BottomSheet), findsOneWidget);
});
testWidgets('the selected coloured row keeps its colour and selection', (
tester,
) async {
@@ -96,6 +96,23 @@ void main() {
expect(find.textContaining('Last 7 days'), findsOneWidget);
});
testWidgets('filter uses a dialog wide and a bottom sheet narrow', (
tester,
) async {
await mount(tester);
await tester.tap(find.byKey(const ValueKey('runs.filter')));
await tester.pumpAndSettle();
expect(find.byType(Dialog), findsOneWidget);
await tester.tap(find.byKey(runsFilterDoneKey));
await tester.pumpAndSettle();
tester.view.physicalSize = const Size(500, 1400);
await tester.pump();
await tester.tap(find.byKey(const ValueKey('runs.filter')));
await tester.pumpAndSettle();
expect(find.byType(BottomSheet), findsOneWidget);
});
testWidgets('Material single-choice groups are check rows, not checkboxes', (
tester,
) async {
@@ -136,10 +153,7 @@ void main() {
testWidgets('the usage page is honest when nothing was reported', (
tester,
) async {
await mount(
tester,
createdAt: DateTime(2020, 1, 1).toIso8601String(),
);
await mount(tester, createdAt: DateTime(2020, 1, 1).toIso8601String());
await tester.tap(find.byKey(const ValueKey('runs.stats')));
await tester.pumpAndSettle();
@@ -0,0 +1,92 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/settings/keyboard_shortcuts_help.dart';
import 'package:pipelines_app/features/settings/keyboard_shortcuts_registry.dart';
void main() {
const registry = KeyboardShortcutRegistry(
platform: TargetPlatform.macOS,
web: true,
);
test('registry uses platform labels and browser caveats', () {
final entries = registry.entries;
final terminal = entries.firstWhere(
(entry) => entry.action == 'Show or hide terminal',
);
final search = entries.firstWhere((entry) => entry.action == 'Open Search');
expect(terminal.keys, contains('Option+T'));
expect(terminal.keys, isNot(contains('Cmd+T')));
expect(search.keys, 'Option+/, Cmd+/, Ctrl+/');
expect(search.caveat, contains('browser'));
});
test('uses the shell primary modifier rule on iOS', () {
final entries = const KeyboardShortcutRegistry(
platform: TargetPlatform.iOS,
web: false,
).entries;
expect(
entries
.firstWhere((entry) => entry.action == 'Open a chat list item')
.keys,
'Ctrl+1…9',
);
expect(
entries.firstWhere((entry) => entry.action == 'Open Search').keys,
'Option+/, Ctrl+/',
);
expect(
entries
.firstWhere((entry) => entry.action == 'Show or hide floating chats')
.caveat,
contains('focuses its message input'),
);
});
testWidgets('help is readable and keyboard traversable', (tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: SingleChildScrollView(
child: KeyboardShortcutsHelp(registry: registry),
),
),
),
);
expect(find.text('Keyboard shortcuts'), findsOneWidget);
expect(find.text('Show or hide floating chats'), findsOneWidget);
expect(find.text('Option+Y, Ctrl+Y, Cmd+Y'), findsOneWidget);
expect(
tester.getSemantics(find.bySemanticsLabel('Keyboard shortcuts help')),
matchesSemantics(
scopesRoute: true,
namesRoute: true,
label: 'Keyboard shortcuts help',
),
);
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
expect(find.byTooltip('Close keyboard shortcuts'), findsOneWidget);
});
testWidgets('narrow help content scrolls', (tester) async {
await tester.pumpWidget(
MediaQuery(
data: const MediaQueryData(
size: Size(400, 640),
textScaler: TextScaler.linear(2),
),
child: MaterialApp(
home: Scaffold(body: KeyboardShortcutsHelp(registry: registry)),
),
),
);
expect(find.byType(SingleChildScrollView), findsOneWidget);
expect(find.text('Keyboard shortcuts'), findsOneWidget);
});
}
+32
View File
@@ -75,6 +75,27 @@ void main() {
});
}
test('Alt+/ uses the physical slash key for Option dead-key delivery', () {
const event = KeyDownEvent(
physicalKey: PhysicalKeyboardKey.slash,
logicalKey: LogicalKeyboardKey(0x00BF),
character: '¿',
timeStamp: Duration.zero,
);
expect(shellSearchShortcut(event, _AltHeld()), isTrue);
expect(
shellSearchShortcut(
const KeyUpEvent(
physicalKey: PhysicalKeyboardKey.slash,
logicalKey: LogicalKeyboardKey(0x00BF),
timeStamp: Duration.zero,
),
_AltHeld(),
),
isFalse,
);
});
for (final platform in [TargetPlatform.macOS, TargetPlatform.windows]) {
testWidgets(
'Search chord opens and refocuses retained query on $platform',
@@ -130,3 +151,14 @@ void main() {
);
}
}
class _AltHeld extends HardwareKeyboard {
@override
bool get isAltPressed => true;
@override
bool get isControlPressed => false;
@override
bool get isMetaPressed => false;
@override
bool get isShiftPressed => false;
}
+2 -17
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart';
import 'package:pipelines_app/features/artifacts/domain/artifact_record.dart';
@@ -9,7 +8,6 @@ import 'package:pipelines_app/features/artifacts/ui/artifact_visit_list.dart';
/// line only echoes the widget's callback.
///
/// Query parameters:
/// platform=ios render the Cupertino host instead of Material
/// scale=1.5 large-text check
/// state=empty no recorded groups
/// state=disabled rows rendered without a selection callback
@@ -17,7 +15,7 @@ import 'package:pipelines_app/features/artifacts/ui/artifact_visit_list.dart';
void main() {
final params = Uri.base.queryParameters;
runApp(
_ProbeApp(cupertino: params['platform'] == 'ios', state: params['state']),
_ProbeApp(state: params['state']),
);
}
@@ -115,9 +113,8 @@ List<ArtifactGroup> _groupsFor(String? state) => switch (state) {
};
class _ProbeApp extends StatefulWidget {
const _ProbeApp({required this.cupertino, this.state});
const _ProbeApp({this.state});
final bool cupertino;
final String? state;
@override
@@ -173,18 +170,6 @@ class _ProbeAppState extends State<_ProbeApp> {
).copyWith(textScaler: TextScaler.linear(scale)),
child: child ?? const SizedBox.shrink(),
);
if (widget.cupertino) {
return CupertinoApp(
debugShowCheckedModeBanner: false,
builder: scaled,
home: CupertinoPageScaffold(
// Sections paint the grouped background; the page must match it or a
// white seam shows below the last section in light mode.
backgroundColor: CupertinoColors.systemGroupedBackground,
child: body,
),
);
}
return MaterialApp(
debugShowCheckedModeBanner: false,
builder: scaled,
-1
View File
@@ -109,7 +109,6 @@ class _ProbeHomeState extends State<_ProbeHome> {
Widget build(BuildContext context) {
final bell = NeedsYouBell(
entries: _entries,
cupertino: widget.cupertino,
onOpen: _open,
onDismiss: _dismiss,
onClearAll: _clearAll,
+5 -5
View File
@@ -29,8 +29,8 @@ change, from `app/`:
```
URL parameters (the kit sets them from `open=` and the options):
`route=<app route>`, `q=<search>`, `platform=material|cupertino`,
`theme=light|dark`; `--params` (or a step's or script's `params`) adds fixture
`route=<app route>`, `q=<search>`, `theme=light|dark`; `--params` (or a step's
or script's `params`) adds fixture
options such as `chats=2&rich=1`. Use `route=/settings` to open Settings and then
click `Server health`; the fixture channel returns `server_stats` automatically.
Without `theme`, the app follows the browser's colour
@@ -39,7 +39,7 @@ scheme. `--theme` also sets that colour scheme through Chrome emulation.
## Steps
You can pass steps on the command line as `verb=value`. With `--script`, they
go in a JSON array or in `{ "size", "platform", "theme", "q", "steps": [...] }`.
go in a JSON array or in `{ "size", "theme", "q", "steps": [...] }`.
In JSON, a step can also set `wait` (ms), `timeout`, `name`, `ms` and `frames`.
| step | effect |
@@ -84,8 +84,8 @@ Its bytes are served from the build, so copy the fixture in after building:
## Recipes (run from `app/` after building `build/probe-app`)
Capture a page at phone and fold widths. Use 560 for phone: headless Chrome
misrenders Flutter below about 500 px. The app has one Material UI; do not
capture `platform=cupertino`.
misrenders Flutter below about 500 px. The app has one Material UI. The fixture
is Material-only on every platform.
```sh
for size in 560x1000 880x1000; do
+3 -3
View File
@@ -16,7 +16,7 @@ import { contactSheet, pickFrames } from './sheet.mjs';
import { describe, flutterPage, parseTarget } from './page.mjs';
const USAGE = `usage: capture.mjs (--build <dir> | --url <url>) --out <dir> [options] [steps...]
options: --script <steps.json> --size WxH (880x1000) --platform material|cupertino
options: --script <steps.json> --size WxH (880x1000)
--theme light|dark --q <search> --wait <ms after actions, 1000>
--film-ms <ms, 900> --cdp http://127.0.0.1:<port> --probe true|false
--params <query, e.g. chats=2&rich=1, added to every open>
@@ -47,7 +47,7 @@ let steps = cliSteps;
if (opts.script) {
const script = JSON.parse(await readFile(opts.script, 'utf8'));
const list = Array.isArray(script) ? script : script.steps;
if (!Array.isArray(script)) for (const k of ['size', 'platform', 'theme', 'q', 'params']) if (script[k] && !opts[k]) opts[k] = script[k];
if (!Array.isArray(script)) for (const k of ['size', 'theme', 'q', 'params']) if (script[k] && !opts[k]) opts[k] = script[k];
steps = [...list, ...cliSteps];
}
// The default size applies only when neither the command line nor the script sets one.
@@ -74,7 +74,7 @@ const save = async (path, data) => { await writeFile(path, data); report.files.p
function routeUrl(step, base) {
const route = step.open;
const params = { platform: step.platform ?? opts.platform, theme: step.theme ?? opts.theme, q: step.q ?? opts.q };
const params = { theme: step.theme ?? opts.theme, q: step.q ?? opts.q };
let url;
if (/^https?:/.test(route)) url = new URL(route);
else if (probe) { url = new URL('/', base); url.searchParams.set('route', route); }
@@ -1,6 +1,5 @@
{
"size": "560x1000",
"platform": "material",
"theme": "dark",
"params": "chats=4&colors=1&header=1&rich=1",
"steps": [
@@ -35,7 +35,7 @@ Map<String, String> fixtureParams() {
void installHostProbes(Map<String, String> params) {}
/// The route goes through [fixtureRouteProvider] instead.
void openFixtureRoute(String route, {required bool cupertino}) {}
void openFixtureRoute(String route) {}
/// An explicit loopback endpoint; nothing connects to it but artifact fetches.
ServerEndpoint fixtureServer(Map<String, String> params) =>
+2 -4
View File
@@ -17,13 +17,11 @@ void installHostProbes(Map<String, String> params) {
}
/// Moves the browser to [route] before the app reads its location.
void openFixtureRoute(String route, {required bool cupertino}) {
final platform = cupertino ? 'platform=cupertino' : '';
final joiner = route.contains('?') ? '&' : '?';
void openFixtureRoute(String route) {
web.window.history.replaceState(
null,
'',
platform.isEmpty ? route : '$route$joiner$platform',
route,
);
}
+6 -34
View File
@@ -1,56 +1,34 @@
// Web-only fixture entrypoint for rendered search evidence. It is not part of
// the application's `main.dart`; build it explicitly with:
// flutter build web -t tool/search_fixture/main.dart
// `?cupertino=1` renders the same screen inside a CupertinoApp.
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/search/search_screen.dart';
void main() {
final cupertino = Uri.base.queryParameters['cupertino'] == '1';
runApp(
cupertino
? const CupertinoApp(
title: 'Search fixture',
home: _FixtureHost(cupertino: true),
)
: const MaterialApp(
title: 'Search fixture',
home: _FixtureHost(cupertino: false),
),
);
runApp(const MaterialApp(title: 'Search fixture', home: _FixtureHost()));
}
class _FixtureHost extends StatelessWidget {
const _FixtureHost({required this.cupertino});
final bool cupertino;
const _FixtureHost();
@override
Widget build(BuildContext context) => SearchScreen(
gateway: const _FixtureGateway(),
cupertino: cupertino,
onOpen: (hit) {
final route = cupertino
? CupertinoPageRoute<void>(
builder: (_) => _Opened(hit: hit, cupertino: true),
)
: MaterialPageRoute<void>(
builder: (_) => _Opened(hit: hit, cupertino: false),
);
Navigator.of(context).push(route);
Navigator.of(context).push(
MaterialPageRoute<void>(builder: (_) => _Opened(hit: hit)),
);
},
);
}
class _Opened extends StatelessWidget {
const _Opened({required this.hit, required this.cupertino});
const _Opened({required this.hit});
final JsonMap hit;
final bool cupertino;
@override
Widget build(BuildContext context) {
@@ -63,12 +41,6 @@ class _Opened extends StatelessWidget {
),
),
);
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(middle: Text('Opened')),
child: body,
);
}
return Scaffold(
appBar: AppBar(title: const Text('Opened')),
body: body,
+3 -8
View File
@@ -779,8 +779,6 @@ class _FixtureSink implements WebSocketSink {
/// `?html=1` adds an HTML artifact to run 7 (`release-dashboard.html`);
/// `?turn=1` adds run 7's debug turn files (input/memory/history/output.md);
/// `?q=release` types that query into Search once its field is shown;
/// `?platform=cupertino` renders the Cupertino host (`material`, the
/// default, renders Material as browsers do);
/// `?perf=1` prints frame timings (tool/perf/frame_log.dart);
/// `?hits=N`, `?chats=N` and `?graph=1` add bench data
/// (tool/perf/perf_fixture.dart);
@@ -827,10 +825,9 @@ Future<void> main() async {
_htmlArtifact = params['html'] == '1';
_warnings = params['warnings'] == '1';
_turnFiles = params['turn'] == '1';
final cupertino = params['platform'] == 'cupertino';
final route = params['route'];
final opensRoute = route != null && route.startsWith('/');
if (opensRoute) openFixtureRoute(route, cupertino: cupertino);
if (opensRoute) openFixtureRoute(route);
final query = params['q'];
if (query != null && query.isNotEmpty) _typeSearchWhenShown(query);
useAppUrlStrategy();
@@ -896,7 +893,6 @@ Future<void> main() async {
sourceName: 'Home Linux',
),
client: PipelinesClient(channelFactory: (_) => _FixtureChannel()),
cupertino: cupertino,
routeInformationProvider: fixtureRouteProvider(opensRoute ? route : null),
windows: probeWindows(params),
);
@@ -914,9 +910,8 @@ Future<void> main() async {
}
/// Pins the platform brightness below it. The app's own `MediaQuery.fromView`
/// takes platform fields from this ambient query, so `ThemeMode.system` (and
/// the Cupertino theme's null brightness) resolve to [brightness] while size,
/// padding and text scale still follow the real view.
/// takes platform fields from this ambient query, so `ThemeMode.system` resolves
/// to [brightness] while size, padding and text scale still follow the real view.
class _PinnedBrightness extends StatelessWidget {
const _PinnedBrightness({required this.brightness, required this.child});
+1 -7
View File
@@ -1,7 +1,6 @@
import 'dart:js_interop';
import 'dart:js_interop_unsafe';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:pipelines_app/core/servers/server_catalog.dart';
import 'package:pipelines_app/core/servers/server_catalog_store.dart';
@@ -11,7 +10,6 @@ import 'package:pipelines_app/features/settings/server_connections.dart';
// Isolated, in-memory browser fixture: first write fails, retry succeeds.
// No sockets, real storage, or production requests.
void main() {
final cupertino = Uri.base.queryParameters['host'] == 'cupertino';
final connections = ServerConnections(
store: _Store(),
onSelected: (_) async {},
@@ -21,11 +19,7 @@ void main() {
child: SavedServersSection(connections: connections),
),
);
runApp(
cupertino
? CupertinoApp(home: CupertinoPageScaffold(child: body))
: MaterialApp(home: Scaffold(body: body)),
);
runApp(MaterialApp(home: Scaffold(body: body)));
}
class _Store extends MemoryServerCatalogStore {