DialogRoute<T> constructor
- required BuildContext context,
- required WidgetBuilder builder,
- CapturedThemes? themes,
- Color? barrierColor = Colors.black54,
- bool barrierDismissible = true,
- String? barrierLabel,
- bool useSafeArea = true,
- RouteSettings? settings,
- bool? requestFocus,
- Offset? anchorPoint,
- TraversalEdgeBehavior? traversalEdgeBehavior,
A dialog route with Material entrance and exit animations, modal barrier color, and modal barrier behavior (dialog is dismissible with a tap on the barrier).
Implementation
DialogRoute({
required BuildContext context,
required WidgetBuilder builder,
CapturedThemes? themes,
super.barrierColor = Colors.black54,
super.barrierDismissible,
String? barrierLabel,
bool useSafeArea = true,
super.settings,
super.requestFocus,
super.anchorPoint,
super.traversalEdgeBehavior,
}) : super(
pageBuilder: (BuildContext buildContext, Animation<double> animation, Animation<double> secondaryAnimation) {
final Widget pageChild = Builder(builder: builder);
Widget dialog = themes?.wrap(pageChild) ?? pageChild;
if (useSafeArea) {
dialog = SafeArea(child: dialog);
}
return dialog;
},
barrierLabel: barrierLabel ?? MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
transitionBuilder: _buildMaterialDialogTransitions,
);