ModalRoute<T> class
A modal overlay route with an optional barrier.
Creates two OverlayEntry objects: a barrier entry (which can be dismissible and/or animated) and a content entry positioned according to the specified alignment.
navigator.push(ModalRoute(
builder: (context) => DialogContent(),
barrierDismissible: true,
barrierColor: Color.fromHex('#000000'),
alignment: Alignment.center,
));
Constructors
- ModalRoute({required RouteWidgetBuilder builder, bool barrierDismissible = true, Color? barrierColor, bool animateBarrier = true, Duration barrierAnimationDuration = const Duration(milliseconds: 200), Alignment alignment = Alignment.center, num? width, num? height, RouteSettings? settings})
-
Creates a modal route with the given
builderand barrier options.
Properties
- alignment → Alignment
-
Alignment of the modal content within the overlay.
final
- animateBarrier → bool
-
Whether to animate the barrier fade-in.
final
- barrierAnimationDuration → Duration
-
Duration of the barrier fade animation.
final
- barrierColor → Color?
-
The color of the barrier behind the modal.
final
- barrierDismissible → bool
-
Whether tapping the barrier dismisses the modal.
final
- builder → RouteWidgetBuilder
-
Builds the modal content.
final
-
completer
↔ Completer<
T?> ? -
The Completer that completes when this route is popped.
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → num?
-
Optional height constraint for the modal content.
final
-
Back-reference to the NavigatorState managing this route.
getter/setter pairinherited
-
overlayEntries
→ List<
OverlayEntry> -
The overlay entries this route has created.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- settings → RouteSettings
-
Metadata for this route (name, arguments).
finalinherited
- width → num?
-
Optional width constraint for the modal content.
final
Methods
-
canPop(
) → bool -
Whether this route can be popped.
inherited
-
createOverlayEntries(
) → Iterable< OverlayEntry> -
Creates the overlay entries for this route.
override
-
dispose(
) → void -
Disposes this route, removing all its overlay entries.
inherited
-
install(
) → void -
Installs this route, creating its overlay entries.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited