Overlay class
A stack-based layout system that manages overlapping floating widgets.
Each OverlayEntry added to the overlay state is rendered on top of the main child widget tree. Widgets retrieve the closest enclosing OverlayState from a given BuildContext using Overlay.of.
Example Usage
Overlay(
initialEntries: [myFloatingEntry],
child: MyMainAppWidget(),
);
- Inheritance
-
- Object
- Widget
- StatefulWidget
- Overlay
Constructors
-
Overlay({required Widget child, List<
OverlayEntry> initialEntries = const []}) -
Creates a new overlay layout.
const
Properties
- child → Widget
-
The primary widget displayed below all overlay entries.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initialEntries
→ List<
OverlayEntry> -
The list of entries to display initially.
final
- key → Key?
-
The optional key for this widget.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → Element -
Creates an Element to manage this widget's location in the tree.
inherited
-
createState(
) → OverlayState -
Creates the mutable state for this widget at a given location in the tree.
override
-
getIntrinsicHeight(
int width) → int -
Computes the intrinsic height of this widget under the given
widthconstraint.inherited -
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
bufferwithin the specifiedarea.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
of(
BuildContext context) → OverlayState? -
Retrieves the closest enclosing OverlayState from the given
context.