Chat stack: the default, also on a wide phone or tablet; a close button where the pile was
Chat stack is now the default phone chat navigation (a stored choice is kept), and on Android or iOS it stays on a wide layout (an unfolded foldable) above the active pane, where floating is ignored too. When expanded, the pile turns into a close button at its own spot and the column rises above it; while a chat is dragged that button is the remove target, replacing the separate x at the bottom. Chat widget tests start on Quick switch (they run as Android); the stack's tests choose it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,15 @@ class _Gateway extends FakeChatGateway {
|
||||
}
|
||||
}
|
||||
|
||||
class _Store implements MobileChatNavigationStore {
|
||||
_Store(this.value);
|
||||
final String? value;
|
||||
@override
|
||||
Future<String?> load() async => value;
|
||||
@override
|
||||
Future<bool> save(String value) async => true;
|
||||
}
|
||||
|
||||
Future<void> _pump(WidgetTester tester, Size size) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
unawaited(
|
||||
@@ -114,14 +123,53 @@ void main() {
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
});
|
||||
|
||||
testWidgets('a wide window keeps its panes and shows no stack', (
|
||||
tester,
|
||||
) async {
|
||||
await _pump(tester, const Size(1280, 800));
|
||||
await tester.tap(find.byKey(const Key('chat-row-a')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(_thread('a'), findsOneWidget);
|
||||
expect(_stack, findsNothing);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
testWidgets(
|
||||
'a wide desktop window keeps its panes and shows no stack',
|
||||
variant: TargetPlatformVariant.desktop(),
|
||||
(tester) async {
|
||||
await _pump(tester, const Size(1280, 800));
|
||||
await tester.tap(find.byKey(const Key('chat-row-a')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(_thread('a'), findsOneWidget);
|
||||
expect(_stack, findsNothing);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'a wide phone or tablet layout (an unfolded foldable) keeps the stack',
|
||||
variant: TargetPlatformVariant({
|
||||
TargetPlatform.android,
|
||||
TargetPlatform.iOS,
|
||||
}),
|
||||
(tester) async {
|
||||
await _pump(tester, const Size(1280, 800));
|
||||
await tester.tap(find.byKey(const Key('chat-row-a')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(_thread('a'), findsOneWidget);
|
||||
// The list stays beside the chat, the stack floats over the pane.
|
||||
expect(find.byKey(const Key('chat-row-b')), findsOneWidget);
|
||||
expect(_stack.hitTestable(), findsOneWidget);
|
||||
await tester.tap(_stack);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byKey(const ValueKey('chat-stack-button-add')));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Beta').last);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.bySemanticsLabel(chatStackLabel(2)), findsOneWidget);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
},
|
||||
);
|
||||
|
||||
test('Chat stack is the default without a stored choice', () async {
|
||||
final controller = MobileChatNavigationController(store: _Store(null));
|
||||
expect(controller.value, MobileChatNavigation.chatStack);
|
||||
await controller.restore();
|
||||
expect(controller.value, MobileChatNavigation.chatStack);
|
||||
final chosen = MobileChatNavigationController(store: _Store('quickSwitch'));
|
||||
await chosen.restore();
|
||||
expect(chosen.value, MobileChatNavigation.quickSwitch);
|
||||
controller.dispose();
|
||||
chosen.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user