DialogRoute<T> constructor
DialogRoute<T> ({
- required BuildContext context,
- required WidgetBuilder builder,
- CapturedThemes? themes,
- Color? barrierColor = const Color.fromRGBO(0, 0, 0, 0),
- bool barrierDismissible = true,
- String? barrierLabel,
- bool useSafeArea = true,
- RouteSettings? settings,
- Offset? anchorPoint,
- TraversalEdgeBehavior? traversalEdgeBehavior,
- required AlignmentGeometry alignment,
- required RouteTransitionsBuilder? transitionBuilder,
- 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),
);