Over another item's middle the lifted item shrinks (as over the close button), so the target's grown ring stays visible; a group's pile is 0.88 of a chat's disc. Notes for groups and the open-chat group field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8.0 KiB
Chat stack (phone chat navigation)
Setting
Settings → Mobile chat navigation: Chat stack (the default without a stored
choice) or Quick switch (the next chat's peek under the current one). Per
device (pipelines.mobile-chat-navigation.v1, MobileChatNavigationController,
restored in bootstrap.dart; a stored choice is kept), applied live. It
applies on a phone-width layout (!showsListBesideDetail); the Chat stack
also stays on a wide layout on Android or iOS (an unfolded foldable, a
tablet, a browser on one), floating above the active pane beside the list
(chatStackOnMobile). A wide desktop or web window keeps its panes alone.
Widget tests run as Android: test/features/chat/flutter_test_config.dart
starts each chat test on Quick switch (debugUse); the stack's tests pick it.
Behaviour
- The stack's chats are the workspace's panes: the same open-chat set the
server syncs (
ChatOpenWorkspaceController). Choosing one opens it as a tap on its list row does (_openBySelection); Add chat is the pane menu's Add chat pane picker (searchable, the list's own rows) titled "Add chat". - Drag: in the open column a 300 ms hold (a quicker tap still opens) lifts
a chat with its pill: a medium haptic, 1.1x scale and a deeper shadow
(flat designs: a primary-colour frame instead). Dragged up or down, the
others slide aside (200 ms ease-out) to open its slot, with a selection
tick per slot; dropping commits through
ChatWorkspaceController.movePane(the pane order the server syncs as the open-chat order). The close button at the stack's slot is the remove target while dragging: its "×" turns the error colour, and over it (a reach of 0.7 slot around its centre, short of item 0 a pitch above) it grows 1.2x and fills with the error colour, and the chat shrinks into it. Dropping there removes the pane with the Undo snack bar; Undo re-adds it at its old index and keeps the chat on screen. A drop far to the side (more than 1.5 pitches) or Escape or a cancelled pointer puts it back. Add chat never lifts and is never a slot. Semantics: Move up, Move down, Remove from open chats as custom actions on each chat. Reduced motion: neighbours swap at once, the lift and settle are instant, the "×" only fades and does not grow. - Collapsed: up to four avatars piled with small offsets and turns, the chat on screen on top; a count badge when more are open, and a bell when another open chat waits on the operator. It sits bottom-end in the active chat's transcript area, just above the composer, so it never covers Send; the transcript pads its last line and Jump to latest above it. It hides while the on-screen keyboard is up (the window's view insets).
- Expanded: a scrim; the pile turns into a close button ("×", a quarter
turn and scale in,
ChatStackCloseTarget) exactly where it was, so a second tap on the same spot folds the column; the column rises from one pitch above it. The chats keep the open-chat order bottom-up (stable positions for muscle memory); the chat on screen wears a ring in its colour; each avatar keeps its list badges (waiting, working, background tasks) and has a name pill tinted with its colour. Add chat is the last item, at the top: the reachable bottom slots go to switching, the frequent action. Tap outside, Back or Escape folds it. - Motion: one controller, 280 ms open (staggered, a slight-overshoot ease),
220 ms fold (top first). Items move through
ChatStackPoseTransition, a repaint-only transform render object that reuses its matrix and layer; no per-frame rebuilds, no blur. A drag addsChatStackDragShift(same idea, driven by a per-item notifier, no layer at rest); the column rebuilds only when a drag starts and ends. Reduced motion: a 120 ms plain fade in place. - Design tokens: circle discs with a short shadow under Default; the design's square corners and no shadow under flat designs (Terminal, Paper); label pills take the design radius and frame.
Groups
- A group is a named set of open chats (
ChatStackGroups, sessionId → name); it travels with the open-chat set as each entry'sgroup, so it persists and syncs across devices like the order. Two chats at least: one left alone leaves its group. Its chats stay together in the open-chat order. - Top level: each group is one item where its first chat is, its chats piled as the collapsed stack piles (0.88 scale, the chat on screen on top), the pill showing its name and count, the bell aggregated. A tap opens it: the top level fades out (no input) and the group's chats rise from its pile (280 ms, the same motion as the stack), under a header (back arrow, the name, a ⋯ menu). The header, the scrim, Back and Escape return to the top level; a second tap outside folds the stack. Folding always ends on the top level.
- Drag: the middle half of another item is a drop onto it (it grows 1.14x
and rings in the primary colour, a selection tick); its outer quarters
move the gap (
chatStackDropTarget: the gap holds within half a slot, so an item sliding aside never lands back under the finger). Chat onto chat: a new group ("Group N", the name dialog opens at once, selected); chat onto group: joins, last; group onto chat: takes it in; group onto group: merges. In an open group a chat dropped on the header leaves the group (placed right after it), and the close button removes it from the open chats. A group dropped on the close button is ungrouped, with Undo. - Menu (header ⋯) and semantic actions on a group: Rename group, Ungroup, Close all chats in group (with Undo, restoring order and group). On a chat: Move up / Move down (within its level), Move to group… (when groups exist), Remove from group (in a group), Remove from open chats.
- Server:
internal/protocol/chat_open_workspace.go(Group),internal/pipeline/chat_open_workspace.go(validation, stored in the entries JSON, compared as part of the entry),internal/server(copied through). Needs a server restart.
Structure
lib/features/chat/stack/: setting, pose, motion, disc/label, column and its items, drag (session, shift render object, handles, remove target), FAB, anchor (aLayerLinkthe active pane's transcript marks; the one stack above the workspace follows it, so it survives switching chats).- Groups:
chat_stack_groups.dart(model),chat_stack_node.dart(top-level items),chat_stack_group_ops.dart(orders after a drop),chat_stack_drop_target.dart,chat_stack_group_pile.dart,chat_stack_group_dialogs.dart,chat_stack_column_groups.dart. lib/features/chat/chat_screen_stack.dart: entries, open/add/remove;chat_screen_stack_groups.dart: join/leave/rename/ungroup/close all.chat_thread_view.dart: anchor target, bottom clearance, Jump offset.tool/search_selection_probe_entry.dart:?chatNav=stack.
Floating chats on a phone
A phone layout (Quick switch or Chat stack) ignores floating: windows are
hidden below kListDetailMinWidth, so each floating chat is held as an
ordinary pane (_phoneDocked in chat_screen_workspace.dart) and the
server's set keeps it floating. Widening the window (a foldable opened, a
desktop resized) floats those chats again; closing one on the phone drops
it from the open chats. Tests: test/features/chat/chat_floating_phone_test.dart.
Captures
Drag captures use the kit's mouse drag with press: 700: with Flutter
web semantics on (the kit turns it on), the engine's click debouncer holds a
press on a tappable node for about 200 ms before the framework sees it, so
a 300 ms hold needs about 500 ms in the browser. Not an issue on a device
without a screen reader.
Not verified
On-device behaviour (Android keyboard insets, haptics) was not run on a device; web captures used Chrome's touch emulation at 390x844.
Drag limits: no auto-scroll while dragging; when the column is taller than the screen it scrolls and clips, so a lifted chat cannot leave the clipped column to reach the "×" there (Move and Remove remain as semantic actions). The drag captures used the mouse (CDP), not touch; on-device haptics and the hold feel are unverified.