bottomSheet<T> static method
Future<T?>
bottomSheet<T>(
- Widget child, {
- bool isScrollControlled = true,
- bool useSafeArea = true,
- bool isDismissible = true,
- bool enableDrag = true,
- bool showDragHandle = false,
- double? elevation,
- Color? backgroundColor,
- Color? barrierColor,
- ShapeBorder? shape,
- Clip? clipBehavior,
- BoxConstraints? constraints,
- VoidCallback? onDismiss,
Implementation
static Future<T?> bottomSheet<T>(
Widget child, {
bool isScrollControlled = true,
bool useSafeArea = true,
bool isDismissible = true,
bool enableDrag = true,
bool showDragHandle = false,
bool useRootNavigator = true,
double? elevation,
Color? backgroundColor,
Color? barrierColor,
ShapeBorder? shape,
Clip? clipBehavior,
BoxConstraints? constraints,
VoidCallback? onDismiss,
}) {
final Future<T?> sheetFuture = showModalBottomSheet<T>(
context: navigatorKey.currentContext!,
isScrollControlled: isScrollControlled,
useSafeArea: useSafeArea,
isDismissible: isDismissible,
enableDrag: enableDrag,
showDragHandle: showDragHandle,
useRootNavigator: useRootNavigator,
backgroundColor: backgroundColor ?? Theme.of(navigatorKey.currentContext!).canvasColor,
barrierColor: barrierColor,
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.of(navigatorKey.currentContext!).viewInsets.bottom,
),
child: child,
),
);
return sheetFuture.then((T? value) {
onDismiss?.call();
return value;
});
}