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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user