Window constructor

Window({
  1. Widget? title,
  2. Widget? actions = const WindowActions(),
  3. Widget? content,
  4. bool resizable = true,
  5. bool draggable = true,
  6. bool closable = true,
  7. bool maximizable = true,
  8. bool minimizable = true,
  9. bool enableSnapping = true,
  10. required Rect? bounds,
  11. Rect? maximized,
  12. bool minimized = false,
  13. bool alwaysOnTop = false,
  14. BoxConstraints constraints = kDefaultWindowConstraints,
})

Creates a window with explicit state and configuration.

This constructor creates a window with directly specified state properties rather than using a controller. The window's initial position, size, and capabilities are defined through the constructor parameters.

Parameters:

  • title (Widget?): Title widget for the title bar
  • actions (Widget?): Custom action widgets, defaults to WindowActions()
  • content (Widget?): Main content widget
  • resizable (bool): Whether window can be resized, defaults to true
  • draggable (bool): Whether window can be dragged, defaults to true
  • closable (bool): Whether window can be closed, defaults to true
  • maximizable (bool): Whether window can be maximized, defaults to true
  • minimizable (bool): Whether window can be minimized, defaults to true
  • enableSnapping (bool): Whether snapping is enabled, defaults to true
  • bounds (Rect, required): Initial window bounds (position and size)
  • maximized (Rect?): Bounds when maximized
  • minimized (bool): Whether starts minimized, defaults to false
  • alwaysOnTop (bool): Whether always on top, defaults to false
  • constraints (BoxConstraints): Size constraints, defaults to kDefaultWindowConstraints

Example:

Window(
  title: Text('My Window'),
  bounds: Rect.fromLTWH(100, 100, 400, 300),
  resizable: true,
  content: MyContentWidget(),
)

Implementation

Window({
  this.title,
  this.actions = const WindowActions(),
  this.content,
  bool this.resizable = true,
  bool this.draggable = true,
  bool this.closable = true,
  bool this.maximizable = true,
  bool this.minimizable = true,
  bool this.enableSnapping = true,
  required this.bounds,
  this.maximized,
  bool this.minimized = false,
  bool this.alwaysOnTop = false,
  BoxConstraints this.constraints = kDefaultWindowConstraints,
}) : controller = null;