Float several chats and keep them working on every tab

Floating chats were stuck on other destinations: the hidden Chat tab
muted the window's hide animation, so the window stayed painted but took
no input. The reveal now uses its own ticker, each floating pane's focus
scope hangs from a FloatingFocusRoot above the destination stack, and the
windows show over every destination like the terminal.

Any number of chats can float; the shortcut, a window's X and the menu
show or hide them together. Each pane keeps its own frame (also while
docked), saved in record version 2; version 1 records still load. Drags
read the live frame so fast pointer events no longer lose movement.
This commit is contained in:
2026-11-10 15:26:38 +00:00
parent 827d9bd3b5
commit cdd54c113c
25 changed files with 962 additions and 419 deletions
+12 -13
View File
@@ -1,10 +1,10 @@
part of 'screen.dart';
/// The floating chat for one Chat destination visit: its menu choices, its
/// window frame and its persistence (see `notes/chat-floating-pane.md`).
/// The floating chats for one Chat destination visit: their menu choices,
/// window frames and persistence (see `notes/chat-floating-pane.md`).
mixin _ChatScreenFloat on State<ChatScreen>, _ChatScreenWorkspace {
@override
final ChatFloatFrame _floatFrame = ChatFloatFrame();
final ChatFloatFrames _floatFrames = ChatFloatFrames();
ChatFloatBinding? _floatBinding;
/// Restores and saves the floating chat in [store] once [restored] (the
@@ -14,7 +14,7 @@ mixin _ChatScreenFloat on State<ChatScreen>, _ChatScreenWorkspace {
_floatBinding?.dispose();
final binding = _floatBinding = ChatFloatBinding(
controller: _workspace,
frame: _floatFrame,
frames: _floatFrames,
store: store,
);
unawaited(
@@ -34,32 +34,31 @@ mixin _ChatScreenFloat on State<ChatScreen>, _ChatScreenWorkspace {
void _disposeFloat() {
_unbindFloat();
_floatFrame.dispose();
_floatFrames.dispose();
}
/// Panes float only on a wide layout, beside the chat list.
bool get _floatsHere => !_pageOpen && showsListBesideDetail(context);
void _dockFloat() {
final pane = _workspace.floatingPane;
_workspace.dock();
if (pane != null) _composerFocus.request(pane.sessionId);
void _dockFloat(ChatWorkspacePane pane) {
_workspace.dock(pane.id);
_composerFocus.request(pane.sessionId);
}
/// The pane menu's floating choices: Float on a tiled pane that can, and
/// Dock, Hide and Close on the floating chat.
/// Dock, Hide and Close on a floating chat.
List<Widget> _floatControls(ChatWorkspacePane pane) {
final shortcut = chatFloatShortcutLabel();
if (_workspace.floatingPane?.id == pane.id) {
if (_workspace.isFloating(pane.id)) {
return [
ChatBarAction(
label: 'Dock',
onPressed: _dockFloat,
onPressed: () => _dockFloat(pane),
materialIcon: Icons.vertical_split_outlined,
cupertinoIcon: CupertinoIcons.rectangle_split_3x1,
),
ChatBarAction(
label: 'Hide floating chat ($shortcut)',
label: 'Hide floating chats ($shortcut)',
onPressed: () => _workspace.setFloatShown(false),
materialIcon: Icons.visibility_off_outlined,
cupertinoIcon: CupertinoIcons.eye_slash,