Open long chats bottom-anchored so only the rows that show are laid out

This commit is contained in:
2026-11-02 00:23:46 +00:00
parent b80c52b3e1
commit a5f0eb3811
8 changed files with 532 additions and 39 deletions
@@ -35,8 +35,14 @@ JsonMap tallPage() => chatPage([
),
]);
ScrollController transcriptScroll(WidgetTester tester) =>
tester.widget<ListView>(find.byKey(const Key('chat-thread-s'))).controller!;
ScrollController transcriptScroll(WidgetTester tester) => tester
.widget<CustomScrollView>(
find.descendant(
of: find.byKey(const Key('chat-thread-s')),
matching: find.byType(CustomScrollView),
),
)
.controller!;
void main() {
testWidgets('a streaming transcript stays pinned to its newest end', (
@@ -181,14 +187,14 @@ void main() {
);
await tester.pumpAndSettle();
final saved = scroll.position.pixels;
expect(saved, greaterThan(0));
expect(positions.read('s'), closeTo(saved, 0.5));
expect(saved, lessThan(scroll.position.maxScrollExtent - 300));
expect(positions.read('s')!.offset, closeTo(saved, 0.5));
// Leaving the conversation disposes its view but not the destination's
// store.
await tester.pumpWidget(host(const SizedBox()));
await tester.pumpAndSettle();
expect(positions.read('s'), closeTo(saved, 0.5));
expect(positions.read('s')!.offset, closeTo(saved, 0.5));
await tester.pumpWidget(
host(