Files
pipelines/app/lib/application/app_terminals.dart
T
alan a99f7014f5 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.
2026-11-10 20:48:31 +00:00

68 lines
2.1 KiB
Dart

import 'package:flutter/widgets.dart';
import '../core/api_gateway.dart';
import '../core/servers/chat/chat_server_pool.dart';
import '../features/terminal/terminal_hub.dart';
import '../features/terminal/terminal_layout.dart';
import '../features/terminal/terminal_machines.dart';
import '../features/terminal/terminal_surface.dart';
import '../features/terminal/terminal_toggle_button.dart';
/// The app's machine terminals: one hub over every connected machine (the
/// chat pool's, else the app's own server), kept for the app's lifetime so
/// shells and their output survive navigation and hidden panels.
class AppTerminals {
AppTerminals({
required ChatServerPool? pool,
required Listenable connection,
required bool Function() connected,
required ApiGateway gateway,
required String machineId,
required String machineName,
required this.layout,
}) : machines = pool != null
? PoolTerminalMachines(pool)
: SingleTerminalMachines(
connection: connection,
connected: connected,
machine: TerminalMachine(
id: machineId,
name: machineName,
gateway: gateway,
),
) {
hub = TerminalHub(machines);
}
final ValueNotifier<List<TerminalMachine>> machines;
final TerminalLayout layout;
late final TerminalHub hub;
/// [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,
);
/// The bar button showing or hiding the terminal.
Widget toggle({required bool cupertino}) =>
TerminalToggleButton(layout: layout, cupertino: cupertino);
void dispose() {
hub.dispose();
machines.dispose();
}
}