MorphTargetSpec.dialog constructor
- double width = 440,
- double height = 360,
- double margin = 24,
- MorphSurfaceSpec? surface,
- ShapeBorder? shape,
- Color? surfaceColor,
A centered dialog of at most width x height.
Implementation
factory MorphTargetSpec.dialog({
double width = 440,
double height = 360,
double margin = 24,
MorphSurfaceSpec? surface,
ShapeBorder? shape,
Color? surfaceColor,
}) {
return MorphTargetSpec(
surface: surface,
shape:
shape ??
const RoundedRectangleBorder(borderRadius: .all(.circular(24))),
surfaceColor: surfaceColor,
rectFor: (Size size, EdgeInsets padding) {
final double w = math.max(0, math.min(width, size.width - margin * 2));
final double h = math.max(
0,
math.min(height, size.height - margin * 2),
);
return Rect.fromCenter(
center: Offset(
size.width / 2,
(size.height + padding.top - padding.bottom) / 2,
),
width: w,
height: h,
);
},
);
}