feat(chat): segmented chat header with back, title and model pills

The open conversation draws its own bar of separate rounded pieces: the
platform Back in a circle, a title pill with the folder that opens the
chat information, and a pill with the model and mode controls. Detail
pages drop only their app bar for it, keeping the body mounted.
This commit is contained in:
2026-10-30 23:43:00 +00:00
parent 498c6f17a6
commit 4a85a12cf7
8 changed files with 385 additions and 168 deletions
@@ -207,20 +207,22 @@ void main() {
expect(find.byKey(const Key('chat-turn-activity')), findsOneWidget);
expect(find.text('Kept behind a native disclosure.'), findsNothing);
// 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.
// The shell bar stays over the list and rail; the open chat draws its
// own floating 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), findsNWidgets(2));
expect(find.byType(CupertinoNavigationBar), findsOneWidget);
expect(find.byType(AppBar), findsNothing);
} else {
expect(find.byType(AppBar), findsNWidgets(2));
expect(find.byType(AppBar), findsOneWidget);
expect(find.byType(CupertinoNavigationBar), findsNothing);
}
expect(find.byKey(const Key('chat-thread-header')), findsOneWidget);
expect(findNativeBack(), findsNothing);
// A live frame updates the held thread.
@@ -240,8 +242,8 @@ void main() {
await tester.pump();
expect(find.text('A live line arrived.'), findsOneWidget);
// The pane bar carries the thread's controls: no second header row.
expect(find.byKey(const Key('chat-thread-header')), findsNothing);
// The thread's own bar carries its controls once: no second bar.
expect(find.byKey(const Key('chat-thread-header')), findsOneWidget);
// Browser Back to /chat clears the open pane and keeps the list.
await provider.didPushRouteInformation(
RouteInformation(uri: Uri.parse('/chat')),
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/conversation/chat_thread_view.dart';
import '../../../native_back.dart';
import 'chat_thread_fixtures.dart';
const _title = 'A conversation title long enough to need an ellipsis at 320px';
@@ -36,7 +37,7 @@ void main() {
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets('$host header keeps back, title, model and actions on one row', (
testWidgets('$host header keeps back, title pill and model on one row', (
tester,
) async {
_useNarrowText(tester);
@@ -70,23 +71,22 @@ void main() {
expect(info, findsOneWidget);
expect(back, findsOneWidget);
expect(tester.takeException(), isNull);
// The icon-only control still states its destination for assistive use.
if (cupertino) {
expect(find.bySemanticsLabel('Back to chats'), findsOneWidget);
} else {
expect(find.byTooltip('Back to chats'), findsOneWidget);
}
// Back is the platform's own control, as on every other page.
expect(
find.descendant(of: back, matching: findNativeBack()),
findsOneWidget,
);
// One row, in the web's order: back, title, model, information. A wrapped
// header would put the controls on a different line from the title.
// One floating row of separate pieces: the round Back, the title pill
// (which is the information control and holds the title), then the
// model in the trailing pill.
double centerY(Finder finder) => tester.getCenter(finder).dy;
expect((centerY(back) - centerY(title)).abs(), lessThan(16));
expect((centerY(model) - centerY(title)).abs(), lessThan(16));
expect((centerY(info) - centerY(title)).abs(), lessThan(16));
expect((centerY(back) - centerY(info)).abs(), lessThan(16));
expect((centerY(model) - centerY(info)).abs(), lessThan(16));
expect(find.descendant(of: info, matching: title), findsOneWidget);
double right(Finder finder) => tester.getTopRight(finder).dx;
expect(right(back), lessThanOrEqualTo(tester.getTopLeft(title).dx));
expect(right(title), lessThanOrEqualTo(tester.getTopLeft(model).dx));
expect(right(model), lessThanOrEqualTo(tester.getTopLeft(info).dx));
expect(right(back), lessThanOrEqualTo(tester.getTopLeft(info).dx));
expect(right(info), lessThanOrEqualTo(tester.getTopLeft(model).dx));
await tester.tap(back);
await tester.pump();