showBlurredModalBottomSheet<T> function

Future<T?> showBlurredModalBottomSheet<T>({
  1. required BuildContext context,
  2. required WidgetBuilder builder,
  3. double blurSigma = 4.0,
  4. bool isDismissible = true,
  5. bool enableDrag = true,
  6. bool useSafeArea = true,
  7. BorderRadius? borderRadius,
  8. double? minHeight,
  9. double? maxHeight,
  10. EdgeInsetsGeometry? margin,
  11. EdgeInsetsGeometry? padding,
  12. Color? backgroundColor,
  13. Color barrierColor = Colors.black54,
  14. bool showHandle = false,
  15. EdgeInsetsGeometry? handleMargin,
  16. BorderRadiusGeometry? handleRadius,
  17. Color? handleColor,
  18. double? handleHeight,
  19. double? handleWidth,
  20. ShapeBorder? shape,
  21. String? barrierLabel,
  22. bool useRootNavigator = false,
  23. BoxConstraints? constraints,
  24. Clip? clipBehavior,
  25. RouteSettings? routeSettings,
  26. AnimationStyle? sheetAnimationStyle,
  27. AnimationController? transitionAnimationController,
  28. Offset? anchorPoint,
  29. bool requestFocus = true,
})

Shows a modal bottom sheet with a blurred background and customizable UI.

Implementation

Future<T?> showBlurredModalBottomSheet<T>({
  required BuildContext context,
  required WidgetBuilder builder,
  double blurSigma = 4.0,
  bool isDismissible = true,
  bool enableDrag = true,
  bool useSafeArea = true,
  BorderRadius? borderRadius,
  double? minHeight,
  double? maxHeight,
  EdgeInsetsGeometry? margin,
  EdgeInsetsGeometry? padding,
  Color? backgroundColor,
  Color barrierColor = Colors.black54,
  bool showHandle = false,
  EdgeInsetsGeometry? handleMargin,
  BorderRadiusGeometry? handleRadius,
  Color? handleColor,
  double? handleHeight,
  double? handleWidth,
  ShapeBorder? shape,
  String? barrierLabel,
  bool useRootNavigator = false,
  BoxConstraints? constraints,
  Clip? clipBehavior,
  RouteSettings? routeSettings,
  AnimationStyle? sheetAnimationStyle,
  AnimationController? transitionAnimationController,
  Offset? anchorPoint,
  bool requestFocus = true,
}) {
  return showModalBottomSheet<T>(
    context: context,
    isDismissible: isDismissible,
    enableDrag: enableDrag,
    isScrollControlled: true,
    backgroundColor: Colors.transparent,
    elevation: 0,
    useSafeArea: useSafeArea,
    barrierColor: barrierColor,
    shape: shape,
    barrierLabel: barrierLabel,
    useRootNavigator: useRootNavigator,
    constraints: constraints,
    clipBehavior: clipBehavior,
    routeSettings: routeSettings,
    showDragHandle: false,
    sheetAnimationStyle: sheetAnimationStyle,
    transitionAnimationController: transitionAnimationController,
    anchorPoint: anchorPoint,
    requestFocus: requestFocus,
    builder: (context) {
      final mediaQuery = MediaQuery.of(context);
      final defaultMaxHeight = maxHeight ?? (mediaQuery.size.height - mediaQuery.viewInsets.bottom) * 0.9;

      return useSafeArea
          ? SafeArea(
              child: _body(
                  blurSigma,
                  isDismissible,
                  context,
                  margin,
                  minHeight,
                  defaultMaxHeight,
                  mediaQuery,
                  backgroundColor,
                  borderRadius,
                  showHandle,
                  handleWidth,
                  handleHeight,
                  handleMargin,
                  handleColor,
                  handleRadius,
                  padding,
                  builder),
            )
          : _body(
              blurSigma,
              isDismissible,
              context,
              margin,
              minHeight,
              defaultMaxHeight,
              mediaQuery,
              backgroundColor,
              borderRadius,
              showHandle,
              handleWidth,
              handleHeight,
              handleMargin,
              handleColor,
              handleRadius,
              padding,
              builder);
    },
  );
}