DialogRoute<T> constructor
DialogRoute<T> ({
- required BuildContext context,
- required WidgetBuilder builder,
- CapturedThemes? themes,
- Color? barrierColor = Colors.black54,
- bool barrierDismissible = true,
- String? barrierLabel,
- bool useSafeArea = true,
- RouteSettings? settings,
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,
Color? barrierColor = Colors.black54,
bool barrierDismissible = true,
String? barrierLabel,
bool useSafeArea = true,
RouteSettings? settings,
}) : assert(barrierDismissible != null),
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;
},
barrierDismissible: barrierDismissible,
barrierColor: barrierColor,
barrierLabel: barrierLabel ??
MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
transitionBuilder: _buildMaterialDialogTransitions,
settings: settings,
);