Perf round 4: lazy chat sessions list
Chat sections are slivers: a lazy, keyed SliverList under the same heading, with SliverAnimatedExtent reproducing the clipped AnimatedSize for open, close and arriving rows. The first Chat tab visit no longer builds every row (150 chats: worst build frame 116 ms to 19 ms).
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/core/api_gateway.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
||||
import 'package:pipelines_app/ui/layout/section_heading.dart';
|
||||
|
||||
import 'chat_test_harness.dart';
|
||||
import 'fake_chat_gateway.dart';
|
||||
@@ -30,12 +31,15 @@ void main() {
|
||||
}
|
||||
|
||||
final bar = tester.getRect(find.byType(SegmentedBar));
|
||||
final list = tester.getRect(find.byType(ListView).first);
|
||||
final list = tester.getRect(find.byType(CustomScrollView).first);
|
||||
// The list reaches under the bar ...
|
||||
expect(list.top, lessThan(bar.bottom));
|
||||
// ... yet at rest its first row is clear of it.
|
||||
final first = tester.getRect(
|
||||
find.byKey(const ValueKey('chat-section-Chats')),
|
||||
find.descendant(
|
||||
of: find.byKey(const ValueKey('chat-section-Chats')),
|
||||
matching: find.byType(SectionHeading),
|
||||
),
|
||||
);
|
||||
expect(first.top, greaterThanOrEqualTo(bar.bottom));
|
||||
expect(tester.takeException(), isNull);
|
||||
|
||||
Reference in New Issue
Block a user