Merge commit '2da375ccce14528305d19416678bc2667520afa9' into pipelines/run-20261111-1951-material-cleanup-chat-workspace-and-sess-8fd9

This commit is contained in:
2026-11-11 21:01:24 +00:00
17 changed files with 228 additions and 71 deletions
@@ -2,6 +2,8 @@ import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../ui/adaptive/app_popups.dart';
import '../../../ui/adaptive/floating_bar_layout.dart'; import '../../../ui/adaptive/floating_bar_layout.dart';
import '../actions/artifact_file_actions.dart'; import '../actions/artifact_file_actions.dart';
import '../actions/artifact_file_bridge.dart'; import '../actions/artifact_file_bridge.dart';
@@ -168,9 +170,8 @@ class ArtifactViewerInfoAction extends StatelessWidget {
final Widget facts; final Widget facts;
void _show(BuildContext context) { void _show(BuildContext context) {
showModalBottomSheet<void>( showAppDetails<void>(
context: context, context,
showDragHandle: true,
builder: (context) => SafeArea( builder: (context) => SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
@@ -33,7 +33,6 @@ class NeedsYouBell extends StatefulWidget {
required this.onOpen, required this.onOpen,
required this.onDismiss, required this.onDismiss,
required this.onClearAll, required this.onClearAll,
this.cupertino,
}); });
final List<AttentionEntry> entries; final List<AttentionEntry> entries;
@@ -41,10 +40,6 @@ class NeedsYouBell extends StatefulWidget {
final ValueChanged<AttentionEntry> onDismiss; final ValueChanged<AttentionEntry> onDismiss;
final ValueChanged<List<AttentionEntry>> onClearAll; 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 @override
State<NeedsYouBell> createState() => _NeedsYouBellState(); State<NeedsYouBell> createState() => _NeedsYouBellState();
} }
@@ -132,7 +127,6 @@ class _NeedsYouBellState extends State<NeedsYouBell> {
onOpen: _activate, onOpen: _activate,
onDismiss: widget.onDismiss, onDismiss: widget.onDismiss,
onClearAll: widget.onClearAll, onClearAll: widget.onClearAll,
cupertino: widget.cupertino,
); );
if (!mounted || _openedRun) return; if (!mounted || _openedRun) return;
// The browser returns focus to the bell after the sheet closes; do the same // 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.syncToken = 0,
this.store = const SharedPreferencesAttentionStore(), this.store = const SharedPreferencesAttentionStore(),
this.now, this.now,
this.cupertino,
this.notifications, this.notifications,
this.attention, this.attention,
}); });
@@ -48,10 +47,6 @@ class NeedsYouRunsHeading extends StatefulWidget {
/// Injected clock for deterministic local-day windows. /// Injected clock for deterministic local-day windows.
final DateTime Function()? now; 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 app-level notification capability. Absent in fixtures that only draw
/// the bell, so no store or platform bridge is touched there. /// the bell, so no store or platform bridge is touched there.
final NotificationController? notifications; final NotificationController? notifications;
@@ -163,7 +158,6 @@ class _NeedsYouRunsHeadingState extends State<NeedsYouRunsHeading> {
animation: _attention, animation: _attention,
builder: (context, _) => NeedsYouBell( builder: (context, _) => NeedsYouBell(
entries: _attention.entries, entries: _attention.entries,
cupertino: widget.cupertino,
onOpen: widget.onOpen, onOpen: widget.onOpen,
onDismiss: (entry) { onDismiss: (entry) {
unawaited(_attention.dismiss(entry)); unawaited(_attention.dismiss(entry));
@@ -1,6 +1,7 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../ui/adaptive/app_popups.dart';
import '../domain/attention_models.dart'; import '../domain/attention_models.dart';
import 'needs_you_sheet_material.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 /// only on it, so an entry that arrives while the sheet is open is shown but is
/// never silently cleared. /// 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 /// 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 /// system back are native route behaviour. Narrow windows use a Material
/// bottom sheet; [cupertino] is retained for callers that still pass it. /// bottom sheet; wide windows use a bounded Material dialog.
Future<void> showNeedsYouSheet({ Future<void> showNeedsYouSheet({
required BuildContext context, required BuildContext context,
required ValueListenable<List<AttentionEntry>> entries, required ValueListenable<List<AttentionEntry>> entries,
required ValueChanged<AttentionEntry> onOpen, required ValueChanged<AttentionEntry> onOpen,
required ValueChanged<AttentionEntry> onDismiss, required ValueChanged<AttentionEntry> onDismiss,
required ValueChanged<List<AttentionEntry>> onClearAll, required ValueChanged<List<AttentionEntry>> onClearAll,
bool? cupertino,
}) { }) {
final snapshot = attentionDismissalSnapshot(entries.value); 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>( return showModalBottomSheet<void>(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
@@ -60,7 +60,6 @@ class MaterialNeedsYouSheet extends StatelessWidget {
children: [ children: [
AppSheetHeader( AppSheetHeader(
title: attentionSheetTitle, title: attentionSheetTitle,
cupertino: false,
doneKey: attentionDoneKey, doneKey: attentionDoneKey,
actions: [ actions: [
if (rows.isNotEmpty) if (rows.isNotEmpty)
@@ -2,6 +2,8 @@ import 'dart:math' as math;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../ui/adaptive/app_popups.dart';
enum DiffForm { rendered, raw } enum DiffForm { rendered, raw }
const diffFormLabels = <DiffForm, String>{ const diffFormLabels = <DiffForm, String>{
@@ -48,7 +50,7 @@ Widget diffFormControl(
); );
} }
/// Native action sheet/bottom sheet when fixed segment labels cannot fit. /// An anchored desktop menu or narrow sheet when segment labels cannot fit.
Widget diffFormMenu( Widget diffFormMenu(
BuildContext context, { BuildContext context, {
required DiffForm form, required DiffForm form,
@@ -59,9 +61,8 @@ Widget diffFormMenu(
constraints: const BoxConstraints(minWidth: 48, minHeight: 48), constraints: const BoxConstraints(minWidth: 48, minHeight: 48),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
icon: const Icon(Icons.more_vert, size: 28), icon: const Icon(Icons.more_vert, size: 28),
onPressed: () => showModalBottomSheet<void>( onPressed: () => showAppChoiceMenu<void>(
context: context, context,
showDragHandle: true,
builder: (sheetContext) => SafeArea( builder: (sheetContext) => SafeArea(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@@ -77,13 +78,13 @@ Widget diffFormMenu(
), ),
), ),
for (final entry in diffFormLabels.entries) for (final entry in diffFormLabels.entries)
ListTile( AppChoiceMenuItem(
title: Text(entry.value),
selected: entry.key == form, selected: entry.key == form,
onTap: () { onTap: () {
Navigator.of(sheetContext).pop(); Navigator.of(sheetContext).pop();
onChanged(entry.key); onChanged(entry.key);
}, },
child: Text(entry.value),
), ),
], ],
), ),
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../../ui/adaptive/app_popups.dart';
import '../../../../ui/layout/app_sheet_header.dart'; import '../../../../ui/layout/app_sheet_header.dart';
import '../../domain/chat_colors.dart'; import '../../domain/chat_colors.dart';
import 'chat_color_palette.dart'; import 'chat_color_palette.dart';
@@ -135,7 +136,6 @@ Future<void> showChatColorPicker(
children: [ children: [
AppSheetHeader( AppSheetHeader(
title: 'Colour for $title', title: 'Colour for $title',
cupertino: false,
doneKey: const Key('chat-color-done'), doneKey: const Key('chat-color-done'),
), ),
Padding( Padding(
@@ -144,11 +144,9 @@ Future<void> showChatColorPicker(
), ),
], ],
); );
await showModalBottomSheet<void>( await showAppDetails<void>(
context: context, context,
showDragHandle: true, maxWidth: 420,
isScrollControlled: true,
useSafeArea: true,
builder: (sheet) => SingleChildScrollView(child: content(sheet)), builder: (sheet) => SingleChildScrollView(child: content(sheet)),
); );
} }
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../ui/adaptive/app_popups.dart';
import '../../../ui/input/app_search_field.dart'; import '../../../ui/input/app_search_field.dart';
import '../../../ui/layout/app_sheet_header.dart'; import '../../../ui/layout/app_sheet_header.dart';
import '../../pipelines/pipeline_format.dart' show runStateLabel; import '../../pipelines/pipeline_format.dart' show runStateLabel;
@@ -18,6 +19,22 @@ Future<void> showRunsFilterSheet(
BuildContext context, BuildContext context,
RunsController controller, 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>( return showModalBottomSheet<void>(
context: context, context: context,
isScrollControlled: true, isScrollControlled: true,
@@ -94,7 +111,6 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> {
final field = AppSearchField( final field = AppSearchField(
fieldKey: const ValueKey('runs.filter.query'), fieldKey: const ValueKey('runs.filter.query'),
controller: _text, controller: _text,
cupertino: false,
placeholder: 'Filter runs', placeholder: 'Filter runs',
onChanged: controller.setQuery, onChanged: controller.setQuery,
); );
@@ -113,7 +129,6 @@ class _RunsFilterSheetState extends State<_RunsFilterSheet> {
children: [ children: [
AppSheetHeader( AppSheetHeader(
title: runsFilterTitle, title: runsFilterTitle,
cupertino: false,
doneKey: runsFilterDoneKey, doneKey: runsFilterDoneKey,
actions: [if (active) _clearButton()], actions: [if (active) _clearButton()],
), ),
@@ -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.
@@ -14,3 +14,11 @@
Material widgets and layouts. Material widgets and layouts.
- Remaining shared compatibility metadata/flags are outside this focused edit - Remaining shared compatibility metadata/flags are outside this focused edit
and should be removed only after all callers migrate during final integration. and should be removed only after all callers migrate during final integration.
## Remaining desktop popups
The manager completed two additional unconditional-sheet paths from the audit:
diff-form choices now use the shared anchored choice menu on desktop, and
artifact facts use the shared bounded details dialog. Narrow layouts retain
Material bottom sheets. Wide/narrow selection and dismissal regressions plus
the artifact viewer page tests passed: 24 tests, zero failures.
@@ -35,7 +35,6 @@ void main() {
onOpen: (_) {}, onOpen: (_) {},
now: () => attentionNow, now: () => attentionNow,
notifications: notify, notifications: notify,
cupertino: false,
), ),
), ),
); );
@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.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 'package:pipelines_app/features/attention/ui/needs_you_keys.dart';
import 'needs_you_test_support.dart'; import 'needs_you_test_support.dart';
@@ -106,32 +104,4 @@ void main() {
expect(find.byKey(attentionSheetKey), findsNothing); expect(find.byKey(attentionSheetKey), findsNothing);
expect(bellHasFocus(tester), isTrue); 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:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/attention/domain/attention_models.dart'; import 'package:pipelines_app/features/attention/domain/attention_models.dart';
import 'package:pipelines_app/features/attention/ui/needs_you_keys.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'; import 'needs_you_test_support.dart';
void main() { 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', ( testWidgets('Material sheet names every row and every dismiss action', (
tester, tester,
) async { ) async {
@@ -0,0 +1,74 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_body.dart';
import 'package:pipelines_app/features/changes/widgets/diff_form_control.dart';
void main() {
for (final width in [400.0, 1000.0]) {
testWidgets('diff choices adapt to app width $width', (tester) async {
tester.view.physicalSize = Size(width, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
DiffForm? selected;
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Align(
alignment: Alignment.topLeft,
child: Builder(
builder: (context) => diffFormMenu(
context,
form: DiffForm.rendered,
onChanged: (value) => selected = value,
),
),
),
),
),
);
await tester.tap(find.byTooltip('Diff form'));
await tester.pumpAndSettle();
expect(
find.byType(BottomSheet),
width < 600 ? findsOneWidget : findsNothing,
);
expect(
find.byKey(const ValueKey('app-choice-menu')),
width >= 600 ? findsOneWidget : findsNothing,
);
await tester.tap(find.text('Raw patch'));
await tester.pumpAndSettle();
expect(selected, DiffForm.raw);
expect(find.text('Raw patch'), findsNothing);
expect(tester.takeException(), isNull);
});
testWidgets('artifact details adapt to app width $width', (tester) async {
tester.view.physicalSize = Size(width, 900);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: ArtifactViewerInfoAction(
facts: Text('Recorded artifact facts'),
),
),
),
);
await tester.tap(find.byTooltip('Details'));
await tester.pumpAndSettle();
expect(find.text('Recorded artifact facts'), findsOneWidget);
expect(find.byType(Dialog), width >= 600 ? findsOneWidget : findsNothing);
expect(
find.byType(BottomSheet),
width < 600 ? findsOneWidget : findsNothing,
);
final context = tester.element(find.text('Recorded artifact facts'));
Navigator.of(context).pop();
await tester.pumpAndSettle();
expect(find.text('Recorded artifact facts'), findsNothing);
expect(tester.takeException(), isNull);
});
}
}
@@ -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', ( testWidgets('the selected coloured row keeps its colour and selection', (
tester, tester,
) async { ) async {
@@ -96,6 +96,23 @@ void main() {
expect(find.textContaining('Last 7 days'), findsOneWidget); 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', ( testWidgets('Material single-choice groups are check rows, not checkboxes', (
tester, tester,
) async { ) async {
@@ -136,10 +153,7 @@ void main() {
testWidgets('the usage page is honest when nothing was reported', ( testWidgets('the usage page is honest when nothing was reported', (
tester, tester,
) async { ) async {
await mount( await mount(tester, createdAt: DateTime(2020, 1, 1).toIso8601String());
tester,
createdAt: DateTime(2020, 1, 1).toIso8601String(),
);
await tester.tap(find.byKey(const ValueKey('runs.stats'))); await tester.tap(find.byKey(const ValueKey('runs.stats')));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
-1
View File
@@ -109,7 +109,6 @@ class _ProbeHomeState extends State<_ProbeHome> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final bell = NeedsYouBell( final bell = NeedsYouBell(
entries: _entries, entries: _entries,
cupertino: widget.cupertino,
onOpen: _open, onOpen: _open,
onDismiss: _dismiss, onDismiss: _dismiss,
onClearAll: _clearAll, onClearAll: _clearAll,