showMorphDialog function

MorphFlight showMorphDialog(
  1. BuildContext context, {
  2. Object? from,
  3. required MorphContentBuilder builder,
  4. double width = 440,
  5. double height = 360,
  6. MorphSurfaceSpec? surface,
  7. ShapeBorder? shape,
  8. Color? surfaceColor,
  9. MorphMotion? motion,
  10. bool barrierDismissible = true,
  11. double? maxScrimOpacity,
  12. Color? scrimColor,
  13. Color? shadowColor,
  14. VoidCallback? onDismissRequested,
  15. String? semanticLabel,
})

The dialog adopts its look from the app's DialogTheme (shape, color) unless overridden explicitly.

Implementation

MorphFlight showMorphDialog(
  BuildContext context, {
  Object? from,
  required MorphContentBuilder builder,
  double width = 440,
  double height = 360,
  MorphSurfaceSpec? surface,
  ShapeBorder? shape,
  Color? surfaceColor,
  MorphMotion? motion,
  bool barrierDismissible = true,
  double? maxScrimOpacity,
  Color? scrimColor,
  Color? shadowColor,
  VoidCallback? onDismissRequested,
  String? semanticLabel,
}) {
  assert(
    width > 0 && height > 0,
    'Dialog dimensions must be positive; got $width x $height.',
  );
  final DialogThemeData theme = Theme.of(context).dialogTheme;
  return showMorph(
    context,
    from: from,
    target: MorphTargetSpec.dialog(
      width: width,
      height: height,
      surface: surface,
      shape: shape ?? theme.shape,
      surfaceColor: surfaceColor ?? theme.backgroundColor,
    ),
    builder: builder,
    motion: motion,
    barrierDismissible: barrierDismissible,
    maxScrimOpacity: maxScrimOpacity,
    scrimColor: scrimColor,
    shadowColor: shadowColor,
    onDismissRequested: onDismissRequested,
    semanticLabel: semanticLabel,
  );
}