9551eceaed
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
75 lines
2.4 KiB
Dart
75 lines
2.4 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';
|
|
import '../features/terminal/terminal_window.dart';
|
|
import '../shell/windows/window_manager.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,
|
|
WindowManager? windows,
|
|
}) : machines = pool != null
|
|
? PoolTerminalMachines(pool)
|
|
: SingleTerminalMachines(
|
|
connection: connection,
|
|
connected: connected,
|
|
machine: TerminalMachine(
|
|
id: machineId,
|
|
name: machineName,
|
|
gateway: gateway,
|
|
),
|
|
) {
|
|
hub = TerminalHub(machines);
|
|
if (windows != null) {
|
|
floating = TerminalWindows(manager: windows, hub: hub, layout: layout)
|
|
..start();
|
|
}
|
|
}
|
|
|
|
final ValueNotifier<List<TerminalMachine>> machines;
|
|
final TerminalLayout layout;
|
|
late final TerminalHub hub;
|
|
|
|
/// The terminal's floating window in the app's window system; null
|
|
/// without one (the float mode then shows nothing).
|
|
TerminalWindows? floating;
|
|
|
|
/// [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, {bool onChat = true, Widget? windows}) =>
|
|
TerminalSurface(
|
|
hub: hub,
|
|
layout: layout,
|
|
shortcutHere: onChat,
|
|
windows: windows,
|
|
floating: floating,
|
|
child: shell,
|
|
);
|
|
|
|
/// The bar button showing or hiding the terminal.
|
|
Widget toggle() => TerminalToggleButton(layout: layout);
|
|
|
|
void dispose() {
|
|
floating?.dispose();
|
|
hub.dispose();
|
|
machines.dispose();
|
|
}
|
|
}
|