From 8a308204fa8d3467617e90a2aca664838a006667 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Tue, 10 Nov 2026 22:14:29 +0000 Subject: [PATCH 1/2] Use adaptive popups for chat details Present chat turn and shell-history detail surfaces through the shared adaptive popup helpers so desktop uses dialogs while phone layouts retain bottom sheets. Update focused tests and document the verified behavior. --- .../chat/shell/chat_shell_history_chip.dart | 35 +++---------------- .../chat/ui/transcript/chat_turn_chip.dart | 29 ++++----------- .../ui/transcript/chat_turn_diff_chip.dart | 30 +++------------- app/notes/chat-detail-popups.md | 7 ++++ .../chat_task_notices_group_test.dart | 7 +--- .../shell/chat_shell_history_view_test.dart | 19 +++------- .../transcript/chat_turn_diff_chip_test.dart | 16 ++++----- 7 files changed, 36 insertions(+), 107 deletions(-) create mode 100644 app/notes/chat-detail-popups.md diff --git a/app/lib/features/chat/shell/chat_shell_history_chip.dart b/app/lib/features/chat/shell/chat_shell_history_chip.dart index 3587941e..c70e682d 100644 --- a/app/lib/features/chat/shell/chat_shell_history_chip.dart +++ b/app/lib/features/chat/shell/chat_shell_history_chip.dart @@ -1,7 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../shell/list_detail_policy.dart'; +import '../../../ui/adaptive/app_popups.dart'; import '../ui/sessions/chat_adaptive.dart'; import '../ui/transcript/chat_turn_chip.dart'; import 'chat_shell_history.dart'; @@ -48,35 +48,10 @@ class ChatShellHistoryChip extends StatelessWidget { } Future _open(BuildContext context, bool cupertino) { - if (MediaQuery.sizeOf(context).width >= kListDetailMinWidth) { - return showChatTurnSheet( - context, - cupertino, - ChatShellHistoryView(controller: controller, runIds: runIds), - ); - } - final view = ChatShellHistoryView( - controller: controller, - runIds: runIds, - inSheet: false, - ); - const title = Text(chatShellHistoryTitle); - return Navigator.of(context).push( - cupertino - ? CupertinoPageRoute( - fullscreenDialog: true, - builder: (_) => CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: title), - child: SafeArea(child: view), - ), - ) - : MaterialPageRoute( - fullscreenDialog: true, - builder: (_) => Scaffold( - appBar: AppBar(title: title), - body: SafeArea(child: view), - ), - ), + return showAppDetails( + context, + builder: (_) => + ChatShellHistoryView(controller: controller, runIds: runIds), ); } } diff --git a/app/lib/features/chat/ui/transcript/chat_turn_chip.dart b/app/lib/features/chat/ui/transcript/chat_turn_chip.dart index 77add75d..00b0a0ee 100644 --- a/app/lib/features/chat/ui/transcript/chat_turn_chip.dart +++ b/app/lib/features/chat/ui/transcript/chat_turn_chip.dart @@ -1,6 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import '../../../../ui/adaptive/app_popups.dart'; import '../sessions/chat_adaptive.dart'; /// The quiet chip under an agent turn (its tools, its permissions) and the @@ -25,7 +26,7 @@ class ChatTurnChip extends StatelessWidget { final Color color; final String semanticsLabel; - /// The native sheet the chip opens, unless [open] presents it instead. + /// The detail content the chip opens, unless [open] presents it instead. final Widget? sheet; /// A custom presentation (a full-screen route on a narrow window). @@ -110,28 +111,12 @@ class ChatTurnChip extends StatelessWidget { Future _open(BuildContext context, bool cupertino) { if (open case final open?) return open(context, cupertino); - return showChatTurnSheet(context, cupertino, sheet!); + return showChatTurnSheet(context, sheet!); } } -/// The native sheet a turn chip opens: a Cupertino popup surface or a -/// Material modal bottom sheet. -Future showChatTurnSheet( - BuildContext context, - bool cupertino, - Widget sheet, -) { - if (cupertino) { - return showCupertinoModalPopup( - context: context, - builder: (_) => CupertinoPopupSurface(child: SafeArea(child: sheet)), - ); - } - return showModalBottomSheet( - context: context, - isScrollControlled: true, - showDragHandle: true, - useSafeArea: true, - builder: (_) => sheet, - ); +/// The detail surface a turn chip opens: a dialog on desktop and a bottom +/// sheet on a phone. +Future showChatTurnSheet(BuildContext context, Widget sheet) { + return showAppDetails(context, builder: (_) => sheet); } diff --git a/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart b/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart index 522c04c7..7aeeb012 100644 --- a/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart +++ b/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart @@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../../core/api_gateway.dart'; -import '../../../../shell/list_detail_policy.dart'; +import '../../../../ui/adaptive/app_popups.dart'; import '../../../changes/widgets/change_style.dart' show addedColor, removedColor; import '../../domain/chat_turn_diffs.dart'; @@ -65,31 +65,9 @@ class ChatTurnDiffChip extends StatelessWidget { } Future _open(BuildContext context, bool cupertino) { - if (MediaQuery.sizeOf(context).width >= kListDetailMinWidth) { - return showChatTurnSheet( - context, - cupertino, - ChatTurnDiffView(summary: summary, load: load), - ); - } - final view = ChatTurnDiffView(summary: summary, load: load, inSheet: false); - const title = Text('Turn changes'); - return Navigator.of(context).push( - cupertino - ? CupertinoPageRoute( - fullscreenDialog: true, - builder: (_) => CupertinoPageScaffold( - navigationBar: const CupertinoNavigationBar(middle: title), - child: SafeArea(child: view), - ), - ) - : MaterialPageRoute( - fullscreenDialog: true, - builder: (_) => Scaffold( - appBar: AppBar(title: title), - body: SafeArea(child: view), - ), - ), + return showAppDetails( + context, + builder: (_) => ChatTurnDiffView(summary: summary, load: load), ); } } diff --git a/app/notes/chat-detail-popups.md b/app/notes/chat-detail-popups.md new file mode 100644 index 00000000..66867d46 --- /dev/null +++ b/app/notes/chat-detail-popups.md @@ -0,0 +1,7 @@ +# Chat detail popups + +- Turn detail chips (diffs, reasoning, tools, permissions, questions and task notices) now use `showAppDetails`. +- Shell-history list uses the same adaptive detail surface; its nested command output page remains a page route. +- Desktop uses dialogs and phone widths use bottom sheets, including narrow floating panes on a wide app. +- Focused tests: `chat_turn_diff_chip_test.dart`, `chat_reasoning_chip_test.dart`, `chat_task_notices_group_test.dart`, and `chat_shell_history_view_test.dart` passed (29 tests). +- `tool/analyze.sh` passed after removing obsolete Cupertino test imports. diff --git a/app/test/features/chat/conversation/chat_task_notices_group_test.dart b/app/test/features/chat/conversation/chat_task_notices_group_test.dart index 65b5bee9..bf74b867 100644 --- a/app/test/features/chat/conversation/chat_task_notices_group_test.dart +++ b/app/test/features/chat/conversation/chat_task_notices_group_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -70,11 +69,7 @@ Future _host( drafts: MemoryChatDraftStore(), newOperationId: () => 'op', ); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: thread)) - : MaterialApp(home: Scaffold(body: thread)), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: thread))); await _pump(tester); return gateway; } diff --git a/app/test/features/chat/shell/chat_shell_history_view_test.dart b/app/test/features/chat/shell/chat_shell_history_view_test.dart index e735f44e..7ea3fb99 100644 --- a/app/test/features/chat/shell/chat_shell_history_view_test.dart +++ b/app/test/features/chat/shell/chat_shell_history_view_test.dart @@ -155,7 +155,7 @@ void main() { await tester.tap(chip); await tester.pumpAndSettle(); - expect(find.byType(BottomSheet), findsOneWidget); + expect(find.byType(Dialog), findsOneWidget); expect(find.text('Dismissed commands'), findsOneWidget); expect(find.text('\$ git status'), findsOneWidget); expect(find.text('Exit 0 ยท 50 ms'), findsOneWidget); @@ -181,29 +181,20 @@ void main() { await tester.pumpAndSettle(); expect(gateway.bodies('chat_shell_restore').single['run_ids'], ['run_a']); expect(find.textContaining('restored to the transcript'), findsOneWidget); - Navigator.of(tester.element(find.byType(BottomSheet))).pop(); + Navigator.of(tester.element(find.byType(Dialog))).pop(); await tester.pumpAndSettle(); expect(card(), findsOneWidget); expect(chip, findsNothing); }); - testWidgets('narrow: the history opens as a full-screen page', ( - tester, - ) async { - size(tester, const Size(400, 800)); + testWidgets('narrow: the history opens as a bottom sheet', (tester) async { + size(tester, const Size(430, 900)); gateway.messages = [reply('a1', 10000, 'Answer')]; history([dismissed('run_a', 5000)]); await open(tester); await tester.tap(chip); await tester.pumpAndSettle(); - expect(find.byType(BottomSheet), findsNothing); - expect( - find.descendant( - of: find.byType(AppBar), - matching: find.text('Dismissed commands'), - ), - findsOneWidget, - ); + expect(find.byType(BottomSheet), findsOneWidget); await tester.tap( find.byKey(const ValueKey('chat-shell-history-restore-run_a')), ); diff --git a/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart b/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart index dbbce091..d6d35cfe 100644 --- a/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart +++ b/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart @@ -1,5 +1,4 @@ import 'package:pipelines_app/features/changes/widgets/change_style.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -44,12 +43,10 @@ JsonMap _reply({bool truncated = false}) => { Widget _app(Widget body, bool cupertino, {Size size = const Size(1000, 800)}) { final media = MediaQueryData(size: size); final home = MediaQuery(data: media, child: body); - return cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: home)) - : MaterialApp( - theme: ThemeData(platform: TargetPlatform.android), - home: Scaffold(body: home), - ); + return MaterialApp( + theme: ThemeData(platform: TargetPlatform.android), + home: Scaffold(body: home), + ); } final _chip = find.byKey(const Key('chat-turn-diff-chip')); @@ -117,6 +114,7 @@ void main() { ); await tester.tap(_chip); await tester.pumpAndSettle(); + expect(find.byType(Dialog), findsOneWidget); expect(loads, 1); expect(find.byKey(const Key('chat-turn-diff-list')), findsOneWidget); expect(find.text('lib/a.dart'), findsOneWidget); @@ -162,7 +160,7 @@ void main() { expect(find.textContaining('truncated'), findsWidgets); }); - testWidgets('a narrow window opens the changes full screen ($host)', ( + testWidgets('a narrow window opens the changes as a bottom sheet ($host)', ( tester, ) async { tester.view.physicalSize = const Size(400, 800); @@ -182,7 +180,7 @@ void main() { ); await tester.tap(_chip); await tester.pumpAndSettle(); - expect(find.text('Turn changes'), findsOneWidget); + expect(find.byType(BottomSheet), findsOneWidget); expect(find.text('lib/a.dart'), findsOneWidget); }); From 3a0577cba08ca97cafc067a3aedd5781fbc241f5 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Tue, 10 Nov 2026 22:56:32 +0000 Subject: [PATCH 2/2] Keep phone pages and window pages for turn changes and shell history A dialog only in the tiled app on a wide layout: a phone keeps its full-screen page (run 304 had turned it into a sheet and rewritten the tests), and a floating window opens it as a page of that window so a diff or command output it opens stays in the window. --- .../chat/shell/chat_shell_history_chip.dart | 30 ++++++++++++++++--- .../ui/transcript/chat_turn_diff_chip.dart | 28 +++++++++++++++-- .../shell/chat_shell_history_view_test.dart | 14 +++++++-- .../transcript/chat_turn_diff_chip_test.dart | 6 ++-- 4 files changed, 67 insertions(+), 11 deletions(-) diff --git a/app/lib/features/chat/shell/chat_shell_history_chip.dart b/app/lib/features/chat/shell/chat_shell_history_chip.dart index c70e682d..d11ae1c4 100644 --- a/app/lib/features/chat/shell/chat_shell_history_chip.dart +++ b/app/lib/features/chat/shell/chat_shell_history_chip.dart @@ -1,3 +1,4 @@ +import '../../../shell/windows/window_scope.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -48,10 +49,31 @@ class ChatShellHistoryChip extends StatelessWidget { } Future _open(BuildContext context, bool cupertino) { - return showAppDetails( - context, - builder: (_) => - ChatShellHistoryView(controller: controller, runIds: runIds), + // A dialog in the tiled app on a wide layout. A phone keeps the + // full-screen page, and a floating window opens it as a page of that + // window, so what it opens next (a diff, a command's output) stays in + // the window too. + if (usesDesktopPopups(context) && WindowScope.maybeOf(context) == null) { + return showAppDetails( + context, + builder: (_) => + ChatShellHistoryView(controller: controller, runIds: runIds), + ); + } + return Navigator.of(context).push( + MaterialPageRoute( + fullscreenDialog: true, + builder: (_) => Scaffold( + appBar: AppBar(title: const Text(chatShellHistoryTitle)), + body: SafeArea( + child: ChatShellHistoryView( + controller: controller, + runIds: runIds, + inSheet: false, + ), + ), + ), + ), ); } } diff --git a/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart b/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart index 7aeeb012..524728fb 100644 --- a/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart +++ b/app/lib/features/chat/ui/transcript/chat_turn_diff_chip.dart @@ -1,3 +1,4 @@ +import '../../../../shell/windows/window_scope.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -65,9 +66,30 @@ class ChatTurnDiffChip extends StatelessWidget { } Future _open(BuildContext context, bool cupertino) { - return showAppDetails( - context, - builder: (_) => ChatTurnDiffView(summary: summary, load: load), + // A dialog in the tiled app on a wide layout. A phone keeps the + // full-screen page, and a floating window opens it as a page of that + // window, so what it opens next (a diff, a command's output) stays in + // the window too. + if (usesDesktopPopups(context) && WindowScope.maybeOf(context) == null) { + return showAppDetails( + context, + builder: (_) => ChatTurnDiffView(summary: summary, load: load), + ); + } + return Navigator.of(context).push( + MaterialPageRoute( + fullscreenDialog: true, + builder: (_) => Scaffold( + appBar: AppBar(title: const Text('Turn changes')), + body: SafeArea( + child: ChatTurnDiffView( + summary: summary, + load: load, + inSheet: false, + ), + ), + ), + ), ); } } diff --git a/app/test/features/chat/shell/chat_shell_history_view_test.dart b/app/test/features/chat/shell/chat_shell_history_view_test.dart index 7ea3fb99..c9a154cf 100644 --- a/app/test/features/chat/shell/chat_shell_history_view_test.dart +++ b/app/test/features/chat/shell/chat_shell_history_view_test.dart @@ -187,14 +187,24 @@ void main() { expect(chip, findsNothing); }); - testWidgets('narrow: the history opens as a bottom sheet', (tester) async { + testWidgets('narrow: the history opens as a full-screen page', ( + tester, + ) async { size(tester, const Size(430, 900)); gateway.messages = [reply('a1', 10000, 'Answer')]; history([dismissed('run_a', 5000)]); await open(tester); await tester.tap(chip); await tester.pumpAndSettle(); - expect(find.byType(BottomSheet), findsOneWidget); + expect(find.byType(BottomSheet), findsNothing); + expect(find.byType(Dialog), findsNothing); + expect( + find.descendant( + of: find.byType(AppBar), + matching: find.text('Dismissed commands'), + ), + findsOneWidget, + ); await tester.tap( find.byKey(const ValueKey('chat-shell-history-restore-run_a')), ); diff --git a/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart b/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart index d6d35cfe..f64b4d82 100644 --- a/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart +++ b/app/test/features/chat/ui/transcript/chat_turn_diff_chip_test.dart @@ -160,7 +160,7 @@ void main() { expect(find.textContaining('truncated'), findsWidgets); }); - testWidgets('a narrow window opens the changes as a bottom sheet ($host)', ( + testWidgets('a phone opens the changes full screen ($host)', ( tester, ) async { tester.view.physicalSize = const Size(400, 800); @@ -180,7 +180,9 @@ void main() { ); await tester.tap(_chip); await tester.pumpAndSettle(); - expect(find.byType(BottomSheet), findsOneWidget); + expect(find.byType(BottomSheet), findsNothing); + expect(find.byType(Dialog), findsNothing); + expect(find.text('Turn changes'), findsOneWidget); expect(find.text('lib/a.dart'), findsOneWidget); });