WindowWidget.controlled constructor
const
WindowWidget.controlled({})
Creates a window with controller-based state management.
State is managed entirely through the provided controller. All state
properties from the default constructor are unavailable and must be
controlled via the controller instead.
This pattern is recommended when you need:
- Programmatic control over window state
- To listen to state changes
- To share state across multiple widgets
- More reactive state updates
Parameters:
controller: The window controller (required)title: Title bar contentactions: Action buttons area contentcontent: Main window contenttitleBarHeight: Custom title bar height (optional)resizeThickness: Custom resize border thickness (optional)
Example:
final controller = WindowController(
bounds: Rect.fromLTWH(100, 100, 800, 600),
);
// Later, programmatically control:
controller.minimized = true;
controller.bounds = Rect.fromLTWH(200, 200, 900, 700);
Implementation
const WindowWidget.controlled({
super.key,
this.title,
this.actions,
this.content,
required WindowController this.controller,
this.titleBarHeight,
this.resizeThickness,
}) : bounds = null,
maximized = null,
minimized = null,
resizable = null,
draggable = null,
closable = null,
maximizable = null,
minimizable = null,
enableSnapping = null,
constraints = null;