DialogRoute<T> class
A route that displays a modal dialog with an animated barrier.
Unlike ModalRoute which uses a separate FadeModalBarrier with its own AnimationController, DialogRoute owns the animation and renders both the barrier and the dialog in a single overlay entry.
This provides a more Flutter-like dialog experience with coordinated barrier and content animation, theme capture, and safe area support.
Navigator.of(context).push(
DialogRoute<bool>(
builder: (context) => MyDialog(),
barrierDismissible: true,
),
);
Constructors
- DialogRoute({required RouteWidgetBuilder builder, bool barrierDismissible = true, Color? barrierColor, String? barrierLabel, bool useSafeArea = true, Alignment alignment = Alignment.center, num? width, num? height, AnimationStyle? animationStyle, Theme? capturedTheme, RouteSettings? settings})
- Creates a dialog route.
Properties
- alignment → Alignment
-
How to align the dialog within the overlay.
final
- animationStyle → AnimationStyle?
-
Animation style for the barrier and dialog entrance/exit.
final
- barrierColor → Color?
-
The color of the barrier behind the dialog.
final
- barrierDismissible → bool
-
Whether tapping the barrier dismisses the dialog.
final
- barrierLabel → String?
-
Accessibility label for the barrier.
final
- builder → RouteWidgetBuilder
-
Builds the dialog content.
final
- capturedTheme → Theme?
-
The theme to apply to the dialog 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 dialog.
final
-
Back-reference to the NavigatorState managing this route.
getter/setter pairinherited
-
overlayEntries
→ List<
OverlayEntry> -
The overlay entries this route has created.
no setterinherited
- popDisposition → RoutePopDisposition
-
Whether calling
Navigator.popwhen this route is current should do anything.no setterinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- settings → RouteSettings
-
Metadata for this route (name, arguments).
finalinherited
- useSafeArea → bool
-
Whether to wrap the dialog with
SafeArea.final - width → num?
-
Optional width constraint for the dialog.
final
- willHandlePopInternally → bool
-
Whether calling
didPopwould return false.no setterinherited
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
Constants
- routeName → const String
- The RouteSettings name used for this dialog route.