bottomSheet<T> static method

Future<T?> bottomSheet<T>(
  1. Widget child, {
  2. bool isScrollControlled = true,
  3. bool useSafeArea = true,
  4. double? elevation,
  5. Color? backgroundColor,
  6. ShapeBorder? shape,
  7. Clip? clipBehavior,
  8. BoxConstraints? constraints,
  9. 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;
  });
}