showCommandModalBottomSheet<T> function

Future<T?> showCommandModalBottomSheet<T>({
  1. required BuildContext context,
  2. required WidgetBuilder builder,
  3. Color? backgroundColor,
  4. Color? barrierColor,
  5. double? elevation,
  6. ShapeBorder? shape,
  7. Clip clipBehavior = Clip.antiAlias,
  8. BoxConstraints? constraints,
  9. bool isScrollControlled = true,
  10. bool useRootNavigator = false,
  11. bool isDismissible = true,
  12. bool enableDrag = true,
  13. bool showDragHandle = true,
  14. bool useSafeArea = true,
  15. RouteSettings? routeSettings,
  16. AnimationController? transitionAnimationController,
})

Shows a Command menu inside a mobile modal bottom sheet with automatic keyboard insets handling, drag-to-dismiss support, and customizable presentation.

Implementation

Future<T?> showCommandModalBottomSheet<T>({
  required BuildContext context,
  required WidgetBuilder builder,
  Color? backgroundColor,
  Color? barrierColor,
  double? elevation,
  ShapeBorder? shape,
  Clip clipBehavior = Clip.antiAlias,
  BoxConstraints? constraints,
  bool isScrollControlled = true,
  bool useRootNavigator = false,
  bool isDismissible = true,
  bool enableDrag = true,
  bool showDragHandle = true,
  bool useSafeArea = true,
  RouteSettings? routeSettings,
  AnimationController? transitionAnimationController,
}) {
  return showModalBottomSheet<T>(
    context: context,
    builder: (context) {
      final viewInsets = MediaQuery.of(context).viewInsets;
      return Padding(
        padding: EdgeInsets.only(bottom: viewInsets.bottom),
        child: builder(context),
      );
    },
    backgroundColor: backgroundColor,
    barrierColor: barrierColor,
    elevation: elevation,
    shape:
        shape ??
        const RoundedRectangleBorder(
          borderRadius: BorderRadius.vertical(top: Radius.circular(16.0)),
        ),
    clipBehavior: clipBehavior,
    constraints: constraints,
    isScrollControlled: isScrollControlled,
    useRootNavigator: useRootNavigator,
    isDismissible: isDismissible,
    enableDrag: enableDrag,
    showDragHandle: showDragHandle,
    useSafeArea: useSafeArea,
    routeSettings: routeSettings,
    transitionAnimationController: transitionAnimationController,
  );
}