showSmoothModalSheet<T> function

Future<T?> showSmoothModalSheet<T>({
  1. required BuildContext context,
  2. required WidgetBuilder builder,
  3. double? minHeight,
  4. double? maxHeight,
  5. bool? isScrollControlled,
  6. bool? useRootNavigator,
})

Implementation

Future<T?> showSmoothModalSheet<T>({
  required BuildContext context,
  required WidgetBuilder builder,
  double? minHeight,
  double? maxHeight,
  bool? isScrollControlled,
  bool? useRootNavigator,
}) {
  BoxConstraints? constraints;

  // We can't provide a null value to a [BoxConstraints] constructor
  if (minHeight != null && maxHeight != null) {
    constraints = BoxConstraints(minHeight: minHeight, maxHeight: maxHeight);
  } else if (minHeight != null) {
    constraints = BoxConstraints(minHeight: minHeight);
  } else if (maxHeight != null) {
    constraints = BoxConstraints(maxHeight: maxHeight);
  }

  return showModalBottomSheet<T>(
    constraints: constraints,
    isScrollControlled: isScrollControlled ?? true,
    context: context,
    shape: const RoundedRectangleBorder(
      borderRadius: BorderRadius.vertical(top: ROUNDED_RADIUS),
    ),
    builder: builder,
    useRootNavigator: useRootNavigator ?? false,
    useSafeArea: true,
  );
}