DialogRoute<T> constructor

DialogRoute<T>({
  1. required BuildContext context,
  2. required WidgetBuilder builder,
  3. CapturedThemes? themes,
  4. Color? barrierColor = Colors.black54,
  5. bool barrierDismissible = true,
  6. String? barrierLabel,
  7. bool useSafeArea = true,
  8. RouteSettings? settings,
  9. bool? requestFocus,
  10. Offset? anchorPoint,
  11. 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,
     );