bottomSheet<T> static method
Future<T?>
bottomSheet<T>(
- Widget child, {
- bool isScrollControlled = true,
- bool useSafeArea = true,
- double? elevation,
- Color? backgroundColor,
- ShapeBorder? shape,
- Clip? clipBehavior,
- BoxConstraints? constraints,
- VoidCallback? onDismiss,
Adaptive bottom sheet
Implementation
static Future<T?> bottomSheet<T>(
Widget child, {
bool isScrollControlled = true,
bool useSafeArea = true,
double? elevation,
Color? backgroundColor,
ShapeBorder? shape,
Clip? clipBehavior,
BoxConstraints? constraints,
VoidCallback? onDismiss,
}) {
final Future<T?> sheetFuture = showModalBottomSheet<T>(
context: navigatorKey.currentContext!,
isScrollControlled: isScrollControlled,
useSafeArea: useSafeArea,
backgroundColor: backgroundColor ?? theme.canvasColor,
elevation: elevation,
shape: shape ??
const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
),
clipBehavior: clipBehavior ?? Clip.antiAlias,
constraints: constraints,
builder: (BuildContext context) => Padding(
padding: EdgeInsets.only(
bottom: mediaQuery.viewInsets.bottom,
),
child: child,
),
);
return sheetFuture.then((T? value) {
onDismiss?.call();
return value;
});
}