a99f7014f5
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.
36 lines
1.0 KiB
Dart
36 lines
1.0 KiB
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
import 'window_entry.dart';
|
|
import 'window_manager.dart';
|
|
|
|
/// The floating window some content is in: its entry, the manager, and where
|
|
/// the content area is drawn in the window host. Absent outside a window, so
|
|
/// shared content can tell the tiled app from a window.
|
|
class WindowScope extends InheritedWidget {
|
|
const WindowScope({
|
|
super.key,
|
|
required this.manager,
|
|
required this.entry,
|
|
required this.body,
|
|
required super.child,
|
|
});
|
|
|
|
final WindowManager manager;
|
|
final WindowEntry entry;
|
|
|
|
/// The content area (the window less its title bar), in the host's
|
|
/// coordinates.
|
|
final Rect body;
|
|
|
|
static WindowScope? maybeOf(BuildContext context) =>
|
|
context.dependOnInheritedWidgetOfExactType<WindowScope>();
|
|
|
|
static WindowScope of(BuildContext context) => maybeOf(context)!;
|
|
|
|
@override
|
|
bool updateShouldNotify(WindowScope oldWidget) =>
|
|
oldWidget.manager != manager ||
|
|
oldWidget.entry != entry ||
|
|
oldWidget.body != body;
|
|
}
|