Host floating chats on the shell window system

Phase 2.3 and 2.4 of docs/plans/floating-windows.md. A floating chat is a
window of the chat kind over the app's WindowManager, built from the
app-lifetime ChatRuntime, so it shows over every destination and at start
without the Chat destination being built. Float and Dock move the same
keyed view between the tiling and the window host. The pipelines app keeps
one runtime and one ChatWindows; saved chatFloat records (v1 and v2) are
brought over once.

ChatFloatHost, ChatFloatWindow, the float frames and binding, the
controller's float list and FloatingFocusRoot are gone; the workspace only
asks whether a chat is out in a window. Every MenuAnchor targets the root
overlay (guarded by a test), and menus and tooltips name the Alt chords.
This commit is contained in:
2026-11-10 21:17:40 +00:00
parent 9695100faa
commit fdc730422d
44 changed files with 1369 additions and 1792 deletions
@@ -99,6 +99,8 @@ class SegmentedMoreButton extends StatelessWidget {
);
}
return MenuAnchor(
// Above every floating window, and not clipped to one.
useRootOverlay: true,
menuChildren: [
for (final entry in entries)
if (entry.choices.isEmpty)
+2 -50
View File
@@ -3,8 +3,8 @@ import 'package:flutter/widgets.dart';
/// A layer of floating windows painted in the app's root overlay, above the
/// page, while it keeps its place in the tree (its inherited widgets, focus
/// and state stay where it is built). Every [FloatingLayer] shares that one
/// overlay, so windows from different features (the terminal, a floating
/// chat) stack by use: the layer last pressed, focused or opened is on top.
/// overlay. Only the terminal's floating window still uses it; the app's
/// other windows are in the shell's window host.
///
/// [builder] returns the windows as [Positioned] children of a [Stack] the
/// size of [bounds]: this widget's own box, or the whole overlay when
@@ -97,51 +97,3 @@ class _FloatingLayerState extends State<FloatingLayer> {
);
}
}
/// A focus parent for floating windows placed above the app's destinations,
/// so a window built inside one destination keeps the keyboard while another
/// destination shows (a hidden destination excludes its own subtree from
/// focus). Windows attach their focus scope here with [maybeOf].
class FloatingFocusRoot extends StatefulWidget {
const FloatingFocusRoot({super.key, required this.child});
final Widget child;
/// The nearest root's focus node, or null outside one.
static FocusNode? maybeOf(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<_FloatingFocusScope>()?.node;
@override
State<FloatingFocusRoot> createState() => _FloatingFocusRootState();
}
class _FloatingFocusRootState extends State<FloatingFocusRoot> {
final FocusNode _node = FocusNode(
debugLabel: 'floating windows',
canRequestFocus: false,
skipTraversal: true,
);
@override
void dispose() {
_node.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => Focus(
focusNode: _node,
includeSemantics: false,
child: _FloatingFocusScope(node: _node, child: widget.child),
);
}
class _FloatingFocusScope extends InheritedWidget {
const _FloatingFocusScope({required this.node, required super.child});
final FocusNode node;
@override
bool updateShouldNotify(_FloatingFocusScope oldWidget) =>
oldWidget.node != node;
}