DialogRoute<T> constructor

DialogRoute<T>({
  1. required BuildContext context,
  2. required WidgetBuilder builder,
  3. CapturedThemes? themes,
  4. Color? barrierColor = const Color.fromRGBO(0, 0, 0, 0),
  5. bool barrierDismissible = true,
  6. String? barrierLabel,
  7. bool useSafeArea = true,
  8. RouteSettings? settings,
  9. Offset? anchorPoint,
  10. TraversalEdgeBehavior? traversalEdgeBehavior,
  11. required AlignmentGeometry alignment,
  12. required RouteTransitionsBuilder? transitionBuilder,
  13. CapturedData? data,
})

Implementation

DialogRoute({
  required BuildContext context,
  required WidgetBuilder builder,
  CapturedThemes? themes,
  super.barrierColor = const Color.fromRGBO(0, 0, 0, 0),
  super.barrierDismissible,
  String? barrierLabel,
  bool useSafeArea = true,
  super.settings,
  super.anchorPoint,
  super.traversalEdgeBehavior,
  required this.alignment,
  required super.transitionBuilder,
  this.data,
}) : super(
        pageBuilder: (BuildContext buildContext, Animation<double> animation,
            Animation<double> secondaryAnimation) {
          final Widget pageChild = Builder(
            builder: (context) {
              final theme = Theme.of(context);
              final scaling = theme.scaling;
              return Padding(
                padding: const EdgeInsets.all(16) * scaling,
                child: builder(context),
              );
            },
          );
          Widget dialog = themes?.wrap(pageChild) ?? pageChild;
          if (data != null) {
            dialog = data.wrap(dialog);
          }
          if (useSafeArea) {
            dialog = SafeArea(child: dialog);
          }
          return dialog;
        },
        barrierLabel: barrierLabel ?? 'Dismiss',
        transitionDuration: const Duration(milliseconds: 150),
      );