Resize chat list into compact rail and animate visible chat markers

This commit is contained in:
2026-11-07 13:20:12 +00:00
parent 19958e81c5
commit e2cfa90776
20 changed files with 555 additions and 173 deletions
@@ -172,42 +172,51 @@ void main() {
expect(tester.takeException(), isNull);
});
testWidgets('compact and hidden sidebar preserve panes and drafts', (
tester,
) async {
await _setup(tester);
await _split(tester, 'b', 'Open to the right');
final stateA = tester.state(_thread('a'));
final stateB = tester.state(_thread('b'));
await tester.enterText(_input('a'), 'Keep this draft');
final originalWidth = tester.getSize(_thread('a')).width;
Future<void> choose(String label) async {
testWidgets(
'drag compacts and expands sidebar without losing panes or drafts',
(tester) async {
await _setup(tester);
await _split(tester, 'b', 'Open to the right');
final stateA = tester.state(_thread('a'));
final stateB = tester.state(_thread('b'));
await tester.enterText(_input('a'), 'Keep this draft');
final divider = find.byKey(const ValueKey('list-detail-divider'));
final originalLeft = tester.getRect(_thread('a')).left;
final gesture = await tester.startGesture(tester.getCenter(divider));
await gesture.moveBy(const Offset(-250, 0));
await tester.pumpAndSettle();
expect(find.byTooltip('Expand chat list'), findsOneWidget);
expect(tester.getRect(_thread('a')).left, lessThan(originalLeft));
expect(tester.state(_thread('a')), same(stateA));
expect(tester.state(_thread('b')), same(stateB));
// The same drag can reverse across the threshold without dropping capture.
await gesture.moveBy(const Offset(250, 0));
await tester.pumpAndSettle();
expect(find.byTooltip('Expand chat list'), findsNothing);
expect(tester.getRect(_thread('a')).left, closeTo(originalLeft, 1));
await gesture.up();
await tester.drag(divider, const Offset(-500, 0));
await tester.pumpAndSettle();
expect(find.byTooltip('Expand chat list'), findsOneWidget);
await tester.tap(find.byTooltip('Expand chat list'));
await tester.pumpAndSettle();
expect(find.byTooltip('Expand chat list'), findsNothing);
expect(
tester.widget<EditableText>(_input('a')).controller.text,
'Keep this draft',
);
await tester.drag(divider, const Offset(-500, 0));
await tester.pumpAndSettle();
await tester.drag(divider, const Offset(250, 0));
await tester.pumpAndSettle();
expect(find.byTooltip('Expand chat list'), findsNothing);
expect(tester.state(_thread('b')), same(stateB));
await tester.tap(find.byTooltip('More actions').hitTestable().first);
await tester.pumpAndSettle();
await tester.tap(find.text('Chat list layout'));
await tester.pumpAndSettle();
await tester.pumpAndSettle();
await tester.tap(find.text(label));
await tester.pumpAndSettle();
}
await choose('Compact chat list');
expect(find.byTooltip('Expand chat list'), findsOneWidget);
expect(tester.getSize(_thread('a')).width, greaterThan(originalWidth));
expect(tester.state(_thread('a')), same(stateA));
expect(tester.state(_thread('b')), same(stateB));
await choose('Hide chat list');
expect(find.byTooltip('Expand chat list'), findsNothing);
expect(tester.getRect(_thread('a')).left, 0);
expect(tester.state(_thread('a')), same(stateA));
expect(
tester.widget<EditableText>(_input('a')).controller.text,
'Keep this draft',
);
await choose('Expanded chat list');
expect(tester.getSize(_thread('a')).width, closeTo(originalWidth, 1));
expect(tester.state(_thread('b')), same(stateB));
});
expect(find.text('Chat list layout'), findsNothing);
await tester.pumpWidget(const SizedBox());
},
);
testWidgets(
'nested splits preserve drafts, resize, collapse and narrow restore',