fix(app): chat rows put the state word on the title line and recency in the meta, as on the web

This commit is contained in:
2026-10-23 12:40:37 +01:00
parent ad51437fbb
commit c5119146f2
6 changed files with 69 additions and 107 deletions
@@ -154,22 +154,27 @@ void main() {
isUnseen: (session) => session['id'] == 's1',
);
// The unread word trails the muted meta line; the recency trails the title.
// As on the web: the unread word trails the title; the muted meta line
// leads with the recency.
expect(find.text('Starred chat'), findsOneWidget);
expect(find.text('/work · model-a'), findsOneWidget);
expect(find.text('5 min ago'), findsOneWidget);
expect(find.text('5 min ago · /work · model-a'), findsOneWidget);
expect(find.text('New'), findsOneWidget);
expect(find.text('/work'), findsOneWidget);
expect(find.text('2 hr ago'), findsOneWidget);
expect(find.text('2 hr ago · /work'), findsOneWidget);
expect(
(tester.getCenter(find.text('Starred chat')).dy -
tester.getCenter(find.text('New')).dy)
.abs(),
lessThan(4),
);
// The meta line keeps `CupertinoListTile`'s native 12pt subtitle style; it
// must not be rendered at the title's body size. The colour-only style the
// row passes merges with the tile's own `DefaultTextStyle`.
final titleStyle = _styleOf(tester, 'Starred chat');
final metaStyle = _styleOf(tester, '/work · model-a');
final metaStyle = _styleOf(tester, '5 min ago · /work · model-a');
expect(metaStyle.fontSize, lessThan(titleStyle.fontSize!));
expect(metaStyle.fontSize, 12.0);
expect(_styleOf(tester, 'New').fontSize, metaStyle.fontSize);
expect(_styleOf(tester, 'New').fontSize, titleStyle.fontSize);
// Each session is still its own native tile with its own actions, so the
// inset group draws the separator between them.
@@ -210,7 +215,7 @@ void main() {
expect(tester.takeException(), isNull);
const title = 'A conversation title long enough to need an ellipsis';
const meta =
'/a/very/long/directory/that/must/ellipsise · '
'3 days ago · /a/very/long/directory/that/must/ellipsise · '
'provider/an-extremely-long-recorded-model-id';
final titleParagraph = tester.renderObject<RenderParagraph>(
find.text(title),
@@ -239,16 +244,10 @@ void main() {
);
}
// The recency is supplementary, so it is the part that ellipsises here; it
// still keeps its single line at the trailing edge of the title line.
final recency = tester.renderObject<RenderParagraph>(
find.text('3 days ago'),
);
expect(recency.maxLines, 1);
expect(recency.didExceedMaxLines, isTrue);
// The word shares the title's line, as on the web.
expect(
(tester.getCenter(find.text(title)).dy -
tester.getCenter(find.text('3 days ago')).dy)
tester.getCenter(find.text('New')).dy)
.abs(),
lessThan(20),
);
@@ -73,15 +73,20 @@ void main() {
], isUnseen: (session) => session['id'] == 's1');
expect(find.text('Starred chat'), findsOneWidget);
expect(find.text('/work · model-a'), findsOneWidget);
expect(find.text('5 min ago'), findsOneWidget);
expect(find.text('5 min ago · /work · model-a'), findsOneWidget);
expect(find.text('New'), findsOneWidget);
expect(find.text('/work'), findsOneWidget);
expect(find.text('2 hr ago'), findsOneWidget);
expect(find.text('2 hr ago · /work'), findsOneWidget);
// As on the web, the unread word shares the title's line.
expect(
(tester.getCenter(find.text('Starred chat')).dy -
tester.getCenter(find.text('New')).dy)
.abs(),
lessThan(4),
);
// The meta line is the theme's muted colour, not the title colour.
final meta = tester.widget<Text>(find.text('/work · model-a'));
final context = tester.element(find.text('/work · model-a'));
final meta = tester.widget<Text>(find.text('5 min ago · /work · model-a'));
final context = tester.element(find.text('5 min ago · /work · model-a'));
expect(meta.style?.color, Theme.of(context).colorScheme.onSurfaceVariant);
// Native Material separators sit between rows, not around the group.
@@ -145,7 +150,7 @@ void main() {
expect(tester.takeException(), isNull);
const title = 'A conversation title long enough to need an ellipsis';
const meta =
'/a/very/long/directory/that/must/ellipsise · '
'3 days ago · /a/very/long/directory/that/must/ellipsise · '
'provider/an-extremely-long-recorded-model-id';
final titleParagraph = tester.renderObject<RenderParagraph>(
find.text(title),
@@ -173,7 +178,7 @@ void main() {
);
}
// Two lines: the title/recency line, then the muted meta line.
// Two lines: the title/word line, then the muted recency/meta line.
expect(
tester.getCenter(find.text(meta)).dy,
greaterThan(tester.getCenter(find.text(title)).dy),