ModalOverlay class

A specialized, high Z-index container that traps focus and intercepts mouse events.

Inheritance

Constructors

ModalOverlay({required String title, required Rect bounds, required Rect dialogBounds, required Widget child, required List<FocusNode> modalFocusNodes, void onDismiss()?, Style scrimStyle = const Style(modifiers: Modifier.dim), FocusNode? focusNode, int zIndex = 10, void onKeyEvent(KeyEvent event)?})
Creates a ModalOverlay widget that traps focus within its bounds.

Properties

backgroundStyle Style
The background style of the window.
finalinherited
borderChars List<String>
The characters used to draw the window borders.
finalinherited
borderStyle Style
The style applied to the window borders.
finalinherited
bounds Rect
The layout boundaries of the window.
getter/setter pairinherited
child Widget
The child widget displayed inside the window.
finalinherited
customOnKeyEvent → void Function(KeyEvent event)?
An optional custom key event handler for unhandled events in the modal.
final
dialogBounds Rect
The physical bounding box of the central dialog.
final
focusNode FocusNode
The focus node representing this window's focus state.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
key Key?
The optional key for this widget.
finalinherited
modalFocusNodes List<FocusNode>
The list of child focus nodes managed by this modal.
final
onDismiss → void Function()?
A callback invoked when the user attempts to dismiss the modal (e.g. clicking outside).
final
onKeyEvent → void Function(KeyEvent event)?
Callback triggered when a keyboard event is routed to this window.
no setteroverride
onMouseEvent → void Function(MouseEvent event, int localX, int localY)?
Callback triggered when a mouse event hits this window.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrimStyle Style
The styling for the dimming overlay behind the dialog.
final
title String
The title text shown in the window border.
finalinherited
titleStyle Style
The style applied to the window title.
finalinherited
zIndex int
The Z-index of the window determining stacking order.
getter/setter pairinherited

Methods

createElement() Element
Creates an Element to manage this widget's location in the tree.
inherited
getIntrinsicHeight(int width) int
Computes the intrinsic height of this widget under the given width constraint.
inherited
isPositionOnTitle(int localX, int localY) bool
Returns true if the local coordinates localX and localY lie on the title text.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
render(Buffer buffer, Rect area) → void
Renders the widget onto the provided buffer within the specified area.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited