OverlayConfiguration class abstract
Describes what overlay to show and how, independent of the specific mechanism (popover, drawer, sheet, dialog, menu, tooltip).
Each concrete subclass (PopoverConfiguration, DrawerConfiguration, SheetConfiguration, DialogConfiguration, MenuConfiguration, TooltipConfiguration) owns its own presentation mechanism directly — there is no separate handler/manager indirection to plug into. Each knows how to present itself via show, and how to adapt itself for the current platform via adaptiveConversion.
The content to show is not part of the configuration — it's supplied
separately as the WidgetBuilder argument to show/showOverlay, so a
configuration object (and every knob it carries: alignment, margin,
width constraint, ...) can be built, overridden, or passed around
independently of what it's going to display. Result typing (T) belongs
to show itself, not the configuration — nothing about how an overlay
presents depends on what type its result will be.
Use showOverlay to present a configuration.
Example:
showOverlay(
context,
PopoverConfiguration(
alignment: Alignment.topCenter,
),
builder: (context) => const Text('Popover content'),
);
Constructors
- OverlayConfiguration()
-
Creates an OverlayConfiguration.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- nonAdaptive → OverlayConfiguration
-
A configuration-level alternative to passing
adaptive: falseat every call site: a copy of this configuration whose adaptiveConversion is a no-op, regardless of theadaptive/adaptiveOverlayflag passed where it's shown.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
adaptiveConversion(
BuildContext context) → OverlayConfiguration - Returns an equivalent configuration adapted for the current platform, e.g. a PopoverConfiguration becomes a DrawerConfiguration on mobile.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
show<
T> (BuildContext context, WidgetBuilder builder) → OverlayCompleter< T?> -
Actually presents the overlay using this configuration's mechanism,
with
builderas its content. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
maybeOf(
BuildContext context) → OverlayConfiguration? -
Finds the OverlayConfiguration responsible for presenting the overlay
contextis inside of, if any.