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,
})

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,
      );