showMorphSheet function
- BuildContext context, {
- Object? from,
- required MorphContentBuilder builder,
- double? height,
- double heightFactor = 0.5,
- double maxWidth = 560,
- MorphSurfaceSpec? surface,
- ShapeBorder? shape,
- Color? surfaceColor,
- MorphMotion? motion,
- bool barrierDismissible = true,
- double? maxScrimOpacity,
- Color? scrimColor,
- Color? shadowColor,
- VoidCallback? onDismissRequested,
- String? semanticLabel,
The sheet adopts its look from the app's BottomSheetTheme (shape, color) unless overridden explicitly: a morph sheet inside a foreign design system looks native with zero configuration.
Implementation
MorphFlight showMorphSheet(
BuildContext context, {
Object? from,
required MorphContentBuilder builder,
double? height,
double heightFactor = 0.5,
double maxWidth = 560,
MorphSurfaceSpec? surface,
ShapeBorder? shape,
Color? surfaceColor,
MorphMotion? motion,
bool barrierDismissible = true,
double? maxScrimOpacity,
Color? scrimColor,
Color? shadowColor,
VoidCallback? onDismissRequested,
String? semanticLabel,
}) {
assert(
height == null || height > 0,
'height must be positive; omit it to use heightFactor.',
);
assert(
heightFactor > 0 && heightFactor <= 1,
'heightFactor is a fraction of the screen height in (0, 1]; '
'got $heightFactor. For a fixed size pass height instead.',
);
assert(maxWidth > 0, 'maxWidth must be positive.');
final BottomSheetThemeData theme = Theme.of(context).bottomSheetTheme;
return showMorph(
context,
from: from,
target: MorphTargetSpec.sheet(
height: height,
heightFactor: heightFactor,
maxWidth: maxWidth,
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,
);
}