diff --git a/app/lib/features/attention/ui/needs_you_bell.dart b/app/lib/features/attention/ui/needs_you_bell.dart index 7048a799..0427d988 100644 --- a/app/lib/features/attention/ui/needs_you_bell.dart +++ b/app/lib/features/attention/ui/needs_you_bell.dart @@ -33,7 +33,6 @@ class NeedsYouBell extends StatefulWidget { required this.onOpen, required this.onDismiss, required this.onClearAll, - this.cupertino, }); final List entries; @@ -41,10 +40,6 @@ class NeedsYouBell extends StatefulWidget { final ValueChanged onDismiss; final ValueChanged> 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 createState() => _NeedsYouBellState(); } @@ -132,7 +127,6 @@ class _NeedsYouBellState extends State { 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 diff --git a/app/lib/features/attention/ui/needs_you_runs_heading.dart b/app/lib/features/attention/ui/needs_you_runs_heading.dart index 7c051807..f8d6e0b7 100644 --- a/app/lib/features/attention/ui/needs_you_runs_heading.dart +++ b/app/lib/features/attention/ui/needs_you_runs_heading.dart @@ -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 { animation: _attention, builder: (context, _) => NeedsYouBell( entries: _attention.entries, - cupertino: widget.cupertino, onOpen: widget.onOpen, onDismiss: (entry) { unawaited(_attention.dismiss(entry)); diff --git a/app/lib/features/attention/ui/needs_you_sheet.dart b/app/lib/features/attention/ui/needs_you_sheet.dart index bd4e0899..8f6852c8 100644 --- a/app/lib/features/attention/ui/needs_you_sheet.dart +++ b/app/lib/features/attention/ui/needs_you_sheet.dart @@ -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 showNeedsYouSheet({ required BuildContext context, required ValueListenable> entries, required ValueChanged onOpen, required ValueChanged onDismiss, required ValueChanged> onClearAll, - bool? cupertino, }) { final snapshot = attentionDismissalSnapshot(entries.value); + if (usesDesktopPopups(context)) { + return showDialog( + 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( context: context, isScrollControlled: true, diff --git a/app/lib/features/attention/ui/needs_you_sheet_material.dart b/app/lib/features/attention/ui/needs_you_sheet_material.dart index a4815c5c..fc1e7885 100644 --- a/app/lib/features/attention/ui/needs_you_sheet_material.dart +++ b/app/lib/features/attention/ui/needs_you_sheet_material.dart @@ -60,7 +60,6 @@ class MaterialNeedsYouSheet extends StatelessWidget { children: [ AppSheetHeader( title: attentionSheetTitle, - cupertino: false, doneKey: attentionDoneKey, actions: [ if (rows.isNotEmpty) diff --git a/app/lib/features/chat/ui/sessions/chat_color_picker.dart b/app/lib/features/chat/ui/sessions/chat_color_picker.dart index c7fff10d..80d7e414 100644 --- a/app/lib/features/chat/ui/sessions/chat_color_picker.dart +++ b/app/lib/features/chat/ui/sessions/chat_color_picker.dart @@ -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 showChatColorPicker( children: [ AppSheetHeader( title: 'Colour for $title', - cupertino: false, doneKey: const Key('chat-color-done'), ), Padding( @@ -144,11 +144,9 @@ Future showChatColorPicker( ), ], ); - await showModalBottomSheet( - context: context, - showDragHandle: true, - isScrollControlled: true, - useSafeArea: true, + await showAppDetails( + context, + maxWidth: 420, builder: (sheet) => SingleChildScrollView(child: content(sheet)), ); } diff --git a/app/lib/features/runs/ui/runs_filter_sheet.dart b/app/lib/features/runs/ui/runs_filter_sheet.dart index e1d517cd..e1a01719 100644 --- a/app/lib/features/runs/ui/runs_filter_sheet.dart +++ b/app/lib/features/runs/ui/runs_filter_sheet.dart @@ -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 showRunsFilterSheet( BuildContext context, RunsController controller, ) { + if (usesDesktopPopups(context)) { + return showDialog( + 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( 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()], ), diff --git a/app/notes/desktop-dialogs-remaining-sheets.md b/app/notes/desktop-dialogs-remaining-sheets.md new file mode 100644 index 00000000..16a78127 --- /dev/null +++ b/app/notes/desktop-dialogs-remaining-sheets.md @@ -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. diff --git a/app/test/features/attention/notify/notification_manager_wiring_test.dart b/app/test/features/attention/notify/notification_manager_wiring_test.dart index a308cad7..2c39cc13 100644 --- a/app/test/features/attention/notify/notification_manager_wiring_test.dart +++ b/app/test/features/attention/notify/notification_manager_wiring_test.dart @@ -35,7 +35,6 @@ void main() { onOpen: (_) {}, now: () => attentionNow, notifications: notify, - cupertino: false, ), ), ); diff --git a/app/test/features/attention/ui/needs_you_bell_test.dart b/app/test/features/attention/ui/needs_you_bell_test.dart index a6cf1859..d6010377 100644 --- a/app/test/features/attention/ui/needs_you_bell_test.dart +++ b/app/test/features/attention/ui/needs_you_bell_test.dart @@ -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()); - 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); - }); } diff --git a/app/test/features/attention/ui/needs_you_sheet_test.dart b/app/test/features/attention/ui/needs_you_sheet_test.dart index 2438d630..5a4d2107 100644 --- a/app/test/features/attention/ui/needs_you_sheet_test.dart +++ b/app/test/features/attention/ui/needs_you_sheet_test.dart @@ -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 { diff --git a/app/test/features/chat/ui/sessions/chat_color_test.dart b/app/test/features/chat/ui/sessions/chat_color_test.dart index 06f0a748..e1cd9cac 100644 --- a/app/test/features/chat/ui/sessions/chat_color_test.dart +++ b/app/test/features/chat/ui/sessions/chat_color_test.dart @@ -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 { diff --git a/app/test/features/runs/ui/runs_sheets_test.dart b/app/test/features/runs/ui/runs_sheets_test.dart index cd6f1d28..50a67cf0 100644 --- a/app/test/features/runs/ui/runs_sheets_test.dart +++ b/app/test/features/runs/ui/runs_sheets_test.dart @@ -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(); diff --git a/app/tool/attention_probe.dart b/app/tool/attention_probe.dart index 97a020f2..877ca652 100644 --- a/app/tool/attention_probe.dart +++ b/app/tool/attention_probe.dart @@ -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,