Add the shell window host with layering acceptance tests

Phase 1.3 and 1.4 of docs/plans/floating-windows.md. Windows are plain
children of the terminal stage's stack in the shell page, outside every
destination, so popups opened from one are above all of them. Each window
has its own page navigator: pushed pages open inside the window, and popup
routes go to the root navigator. One WindowFrame chrome (move, resize,
minimise, maximise, close), a focus scope per window, a ScaffoldMessenger
per window.

No feature uses it yet. The capture fixture opens probe windows with
?windows=N, and window_layering_test.dart covers every popup type from a
window over Chat and over another destination.
This commit is contained in:
2026-11-10 20:48:31 +00:00
parent 215e1cee2a
commit a99f7014f5
20 changed files with 1666 additions and 16 deletions
+4 -1
View File
@@ -38,18 +38,21 @@ class AppTerminals {
final TerminalLayout layout;
late final TerminalHub hub;
/// [shell] with the terminal panel, window or page around it.
/// [shell] with the terminal panel, window or page around it, and the
/// app's floating [windows] above both.
/// [onChat]: the phone shortcut that reopens the terminal shows on the
/// Chat tab only.
Widget surround(
Widget shell, {
required bool cupertino,
bool onChat = true,
Widget? windows,
}) => TerminalSurface(
hub: hub,
layout: layout,
cupertino: cupertino,
shortcutHere: onChat,
windows: windows,
child: shell,
);
+14
View File
@@ -0,0 +1,14 @@
import '../shell/windows/window_kind.dart';
import '../shell/windows/window_manager.dart';
import '../shell/windows/window_store.dart';
/// The app's floating windows, for the app's lifetime: the kinds features
/// register at start and the one manager the shell's window host draws.
abstract final class AppWindows {
static final WindowKinds kinds = WindowKinds();
static final WindowManager manager = WindowManager(
kinds: kinds,
store: const SharedPreferencesWindowStore(),
);
}
+13
View File
@@ -34,7 +34,10 @@ import '../features/updates/launch_update_dialog.dart';
import '../features/updates/web_release.dart';
import '../features/settings/server_connections.dart';
import 'app.dart';
import '../shell/windows/window_host.dart';
import '../shell/windows/window_manager.dart';
import 'app_terminals.dart';
import 'app_windows.dart';
import '../features/terminal/terminal_layout.dart';
import 'app_route.dart';
import 'app_router.dart';
@@ -88,12 +91,16 @@ class PipelinesApp extends StatefulWidget {
this.webRefresher = refreshWebPage,
this.tabLocationsStore,
this.terminalLayout,
this.windows,
});
final TabLocationsStore? tabLocationsStore;
/// The terminal surface's saved layout; null is the device's own.
final TerminalLayout? terminalLayout;
/// The floating windows; the app's own ([AppWindows.manager]) when null.
final WindowManager? windows;
final ServerEndpoint server;
final PipelinesClient? client;
final bool? cupertino;
@@ -208,6 +215,7 @@ class _PipelinesAppState extends State<PipelinesApp>
);
NotificationServiceHandoff? _deliveryHandoff;
late final AppTerminals _terminals;
late final WindowManager _windows;
@override
void initState() {
@@ -227,6 +235,10 @@ class _PipelinesAppState extends State<PipelinesApp>
);
bindServerIdentity(_session.gateway, widget.serverId);
bindServerIdentity(_session.client, widget.serverId);
// One server for now: windows are kept per server, and this one's show.
_windows = (widget.windows ?? AppWindows.manager)
..server = widget.serverId ?? 'server';
unawaited(_windows.restore());
_terminals = AppTerminals(
pool: widget.chatPool,
connection: _session,
@@ -729,6 +741,7 @@ class _PipelinesAppState extends State<PipelinesApp>
_shellFor(route, count),
cupertino: _cupertino,
onChat: route.kind == AppRouteKind.chat,
windows: WindowHost(manager: _windows),
),
);