Window class
A comprehensive windowing system for creating desktop-like window interfaces.
EXPERIMENTAL COMPONENT - This component is in active development and APIs may change.
Provides a complete window management solution with draggable, resizable windows that support minimizing, maximizing, and snapping to screen edges. Designed for desktop-style applications requiring multiple simultaneous content areas.
Core Features:
- Window Management: Create, control, and destroy floating windows
- Interactive Behaviors: Drag, resize, minimize, maximize, close operations
- Snapping System: Intelligent edge snapping and window positioning
- Layering Control: Always-on-top and z-order management
- Constraint System: Size and position limits with validation
- Theme Integration: Full shadcn_flutter theme and styling support
Architecture:
- Window: Immutable window configuration and factory
- WindowController: Reactive state management for window properties
- WindowWidget: Stateful widget that renders the actual window
- WindowNavigator: Container managing multiple windows
The system supports both controlled (external state management) and uncontrolled (internal state management) modes for different use cases.
Usage Patterns:
- Simple Window: Basic window with default behaviors
- Controlled Window: External state management with WindowController
- Window Navigator: Multiple windows with shared management
Example:
// Simple window
final window = Window(
title: Text('My Window'),
content: MyContent(),
bounds: Rect.fromLTWH(100, 100, 800, 600),
resizable: true,
draggable: true,
);
// Controlled window
final controller = WindowController(initialState);
final controlledWindow = Window.controlled(
controller: controller,
title: Text('Controlled Window'),
content: MyContent(),
);
Constructors
- Window.new({Widget? title, Widget? actions = const WindowActions(), Widget? content, bool resizable = true, bool draggable = true, bool closable = true, bool maximizable = true, bool minimizable = true, bool enableSnapping = true, required Rect? bounds, Rect? maximized, bool minimized = false, bool alwaysOnTop = false, BoxConstraints constraints = kDefaultWindowConstraints})
- Window.controlled({Widget? title, Widget? actions = const WindowActions(), Widget? content, required WindowController? controller})
Properties
- actions → Widget?
-
final
- alwaysOnTop → bool?
-
final
- bounds → Rect?
-
final
- closable → bool?
-
final
-
closed
→ ValueNotifier<
bool> -
final
- constraints → BoxConstraints?
-
final
- content → Widget?
-
final
- controller → WindowController?
-
final
- draggable → bool?
-
final
- enableSnapping → bool?
-
final
- handle → WindowHandle
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- maximizable → bool?
-
final
- maximized → Rect?
-
final
- minimizable → bool?
-
final
- minimized → bool?
-
final
- mounted → bool
-
no setter
- resizable → bool?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- title → Widget?
-
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited