feat(chat): keep the rail and chat list beside the open chat on wide windows

This commit is contained in:
2026-10-24 14:31:24 +01:00
parent fb481ad740
commit c7852d27d1
9 changed files with 343 additions and 21 deletions
@@ -155,7 +155,7 @@ Future<void> replyHistory(
void main() {
for (final cupertino in [false, true]) {
testWidgets(
'a /chat/s1 deep link renders that thread and Back returns to /chat ($cupertino)',
'a wide /chat/s1 deep link shows that thread beside the list and route Back returns to /chat ($cupertino)',
(tester) async {
tester.view.physicalSize = const Size(900, 900);
tester.view.devicePixelRatio = 1;
@@ -207,14 +207,21 @@ void main() {
expect(find.text('1 tool'), findsOneWidget);
expect(find.text('Kept behind a native disclosure.'), findsNothing);
// One shell bar only: the embedded list/thread adds no second one.
// The shell bar stays over the list and rail; the open chat has its
// own bar in its pane, with no Back: the list beside it is the way out.
expect(find.byType(ChatSessionsScreen), findsOneWidget);
expect(
find.byType(NavigationRail),
cupertino ? findsNothing : findsOneWidget,
);
if (cupertino) {
expect(find.byType(CupertinoNavigationBar), findsOneWidget);
expect(find.byType(CupertinoNavigationBar), findsNWidgets(2));
expect(find.byType(AppBar), findsNothing);
} else {
expect(find.byType(AppBar), findsOneWidget);
expect(find.byType(AppBar), findsNWidgets(2));
expect(find.byType(CupertinoNavigationBar), findsNothing);
}
expect(findNativeBack(), findsNothing);
// A live frame updates the held thread.
channel.incoming.add(
@@ -233,16 +240,18 @@ void main() {
await tester.pump();
expect(find.text('A live line arrived.'), findsOneWidget);
// The open chat takes over the app bar: one Back there, and no
// second header row under it.
// The pane bar carries the thread's controls: no second header row.
expect(find.byKey(const Key('chat-thread-header')), findsNothing);
await tester.tap(findNativeBack());
// A real Navigator pop finishes its native reverse transition.
// Browser Back to /chat clears the open pane and keeps the list.
await provider.didPushRouteInformation(
RouteInformation(uri: Uri.parse('/chat')),
);
await tester.pumpAndSettle();
expect(provider.value.uri.path, '/chat');
expect(find.byType(ChatThreadView), findsNothing);
expect(find.byType(ChatSessionsScreen), findsOneWidget);
expect(find.text('Wire chat'), findsOneWidget);
expect(find.text('Select a chat to open it here.'), findsOneWidget);
// Browser Forward re-opens the same session through its route.
await provider.didPushRouteInformation(
@@ -29,7 +29,9 @@ class _Gateway extends FakeChatGateway {
}
void main() {
for (final width in [390.0, 840.0]) {
// Wide windows keep the chat beside its list instead of pushing a page; that
// layout is covered by test/features/chat/chat_list_detail_test.dart.
for (final width in [390.0]) {
testWidgets(
'list → chat → top → bottom → one system Back pops a real route at $width',
(tester) async {