A place in an Overlay that can contain a widget.
Overlay entries are inserted into an Overlay using the OverlayState.insert or OverlayState.insertAll functions. To find the closest enclosing overlay for a given BuildContext, use the Overlay.of function.
An overlay entry can be in at most one overlay at a time. To remove an entry from its overlay, call the remove function on the overlay entry.
For example, Draggable uses an OverlayEntry to show the drag avatar that follows the user's finger across the screen after the drag begins. Using the overlay to display the drag avatar lets the avatar float over the other widgets in the app. As the user's finger moves, draggable calls markNeedsBuild on the overlay entry to cause it to rebuild. It its build, the entry includes a Positioned with its top and left property set to position the drag avatar near the user's finger. When the drag is over, Draggable removes the entry from the overlay to remove the drag avatar from view.
By default, if there is an entirely opaque entry over this one, then this one will not be included in the widget tree (in particular, stateful widgets within the overlay entry will not be instantiated). To ensure that your overlay entry is still built even if it is not visible, set maintainState to true. This is more expensive, so should be done with care. In particular, if widgets in an overlay entry with maintainState set to true repeatedly call State.setState, the user's battery will be drained unnecessarily.
- builder → WidgetBuilder
This entry will include the widget built by this builder in the overlay at
the entry's position. [...]
- maintainState ↔ bool
Whether this entry must be included in the tree even if there is a fully
opaque entry above it. [...]
read / write
- opaque ↔ bool
Whether this entry occludes the entire overlay. [...]
read / write
- hashCode → int
The hash code for this object. [...]
- runtimeType → Type
A representation of the runtime type of the object.
) → void
- Cause this entry to rebuild during the next pipeline flush. [...]
) → void
- Remove this entry from the overlay. [...]
) → String
Returns a string representation of this object.
Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]