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:
2026-12-03 21:47:57 +00:00
parent fba3b924f1
commit 130c1e6708
18 changed files with 344 additions and 184 deletions
@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/stack/chat_stack_close_target.dart';
import 'package:pipelines_app/features/chat/stack/chat_stack_column.dart';
import 'package:pipelines_app/features/chat/stack/chat_stack_disc.dart';
import 'package:pipelines_app/features/chat/stack/chat_stack_entry.dart';
import 'package:pipelines_app/features/chat/stack/chat_stack_fab.dart';
import 'package:pipelines_app/features/chat/stack/chat_stack_pose.dart';
@@ -103,7 +105,8 @@ void main() {
expect(find.text('Chat 0'), findsOneWidget);
expect(find.text('Chat 4'), findsOneWidget);
expect(find.text(ChatStackColumn.addLabel), findsOneWidget);
// Item 0 sits on the stack; each further item rises one pitch.
// The stack's slot holds the close button; item 0 sits a pitch above
// it and each further item rises one more.
final first = tester.getCenter(
find.byKey(const ValueKey('chat-stack-button-pane-0')),
);
@@ -114,7 +117,11 @@ void main() {
find.byKey(const ValueKey('chat-stack-button-add')),
);
expect(first.dx, closeTo(slot.center.dx, .5));
expect(first.dy, closeTo(slot.center.dy, .5));
expect(first.dy, closeTo(slot.center.dy - kChatStackPitch, .5));
expect(
tester.getCenter(find.bySemanticsLabel(ChatStackCloseTarget.label)),
slot.center,
);
expect(second.dy, lessThan(first.dy));
expect(add.dy, lessThan(second.dy));
// Outside the column.
@@ -126,6 +133,22 @@ void main() {
expect(harness.opened, isEmpty);
});
testWidgets('the close button where the pile was folds the column', (
tester,
) async {
final harness = await _pump(tester);
final slot = tester.getRect(find.byKey(const Key('chat-stack')));
await tester.tap(find.byKey(const Key('chat-stack')));
await _settle(tester);
await tester.tapAt(slot.center);
await tester.pump();
expect(_state(tester).expanded, isFalse);
await _settle(tester);
expect(find.byType(ChatStackColumn), findsNothing);
expect(harness.opened, isEmpty);
expect(harness.added, 0);
});
testWidgets('tapping a chat opens it and folds the column', (tester) async {
final harness = await _pump(tester);
await tester.tap(find.byKey(const Key('chat-stack')));