Show chat details and file details as dialogs on desktop

Phase 2b.4 of docs/plans/floating-windows.md: both use showAppDetails (a
dialog on a wide app, a bottom sheet on a phone). Implemented by pipeline
run 305; landed by hand after its UI review found the dialog clipped, which
the helper now scrolls.
This commit is contained in:
2026-11-10 22:21:15 +00:00
parent 31f495fc18
commit 286506310c
5 changed files with 107 additions and 90 deletions
@@ -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';
@@ -11,11 +10,6 @@ Widget _host(Widget child) => MaterialApp(
home: Scaffold(body: child),
);
Widget _cupertinoHost(Widget child) => CupertinoApp(
theme: const CupertinoThemeData(brightness: Brightness.dark),
home: CupertinoPageScaffold(child: child),
);
JsonMap _usageFrame(JsonMap usage) => {
'session_id': 's',
'kind': 'usage',
@@ -24,7 +18,7 @@ JsonMap _usageFrame(JsonMap usage) => {
Future<FakeChatGateway> _thread(
WidgetTester tester, {
bool cupertino = false,
Size size = const Size(800, 600),
}) async {
final gateway = FakeChatGateway();
addTearDown(gateway.close);
@@ -34,7 +28,10 @@ Future<FakeChatGateway> _thread(
sessionId: 's',
onBack: () {},
);
await tester.pumpWidget(cupertino ? _cupertinoHost(thread) : _host(thread));
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(_host(thread));
await tester.pumpAndSettle();
return gateway;
}
@@ -146,9 +143,21 @@ void main() {
expect(find.text('\$0.0000'), findsOneWidget);
});
testWidgets('the native sheet dismisses from Done and the barrier', (
tester,
) async {
testWidgets('wide details use a dialog', (tester) async {
await _thread(tester, size: const Size(1280, 800));
await _openInfo(tester);
expect(find.byType(Dialog), findsOneWidget);
expect(find.byType(BottomSheet), findsNothing);
});
testWidgets('phone details use a bottom sheet', (tester) async {
await _thread(tester, size: const Size(430, 900));
await _openInfo(tester);
expect(find.byType(BottomSheet), findsOneWidget);
expect(find.byType(Dialog), findsNothing);
});
testWidgets('details dismiss from Done and the barrier', (tester) async {
final gateway = await _thread(tester);
gateway.emitEvent(_usageFrame({'scope': 'session', 'total_tokens': 5}));
await tester.pump();
@@ -170,22 +179,4 @@ void main() {
expect(find.byKey(const Key('chat-info-sheet')), findsNothing);
expect(find.byKey(const Key('chat-info')), findsOneWidget);
});
testWidgets('the Cupertino host opens and closes the native popup', (
tester,
) async {
final gateway = await _thread(tester, cupertino: true);
gateway.emitEvent(_usageFrame({'scope': 'session', 'total_tokens': 42}));
await tester.pump();
await _openInfo(tester);
expect(find.text('Chat information'), findsOneWidget);
expect(find.text('Done'), findsOneWidget);
expect(find.text('42'), findsOneWidget);
await tester.tap(find.byKey(const Key('chat-info-close')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('chat-info-sheet')), findsNothing);
expect(find.byKey(const Key('chat-info')), findsOneWidget);
});
}