bottomSheetOptions static method

Future bottomSheetOptions(
  1. BuildContext context, {
  2. List<String>? option,
  3. String? defaultData,
  4. double maxHeight = 0.8,
  5. double minHeight = 0.1,
  6. dynamic onSelect(
    1. int index,
    2. String value
    )?,
  7. bool roundedFromTop = false,
  8. bool isDismissible = true,
  9. bool enableDrag = true,
  10. Color? barrierColor,
  11. Color? backgroundColor,
  12. double? elevation,
  13. Clip? clipBehavior,
  14. bool isSafeAreaFromBottom = false,
})

Implementation

static Future bottomSheetOptions(BuildContext context,
    {List<String>? option,
    String? defaultData,
    double maxHeight = 0.8,
    double minHeight = 0.1,
    Function(int index, String value)? onSelect,
    bool roundedFromTop = false,
    bool isDismissible = true,
    bool enableDrag = true,
    Color? barrierColor,
    Color? backgroundColor,
    double? elevation,
    Clip? clipBehavior,
    bool isSafeAreaFromBottom = false}) async {
  final result = await showModalBottomSheet(
    context: context,
    barrierColor: barrierColor,
    elevation: elevation,
    clipBehavior: clipBehavior,
    enableDrag: enableDrag,
    shape: roundedFromTop
        ? const RoundedRectangleBorder(
            borderRadius: BorderRadius.vertical(top: Radius.circular(25.0)))
        : null,
    isScrollControlled: true,
    isDismissible: isDismissible,
    backgroundColor: backgroundColor ?? Theme.of(context).backgroundColor,
    builder: (BuildContext context) {
      return SafeArea(
        bottom: isSafeAreaFromBottom,
        child: AnimatedPadding(
          padding: MediaQuery.of(context).viewInsets,
          duration: const Duration(milliseconds: 100),
          child: _VxBottomSheetOptions(
            list: option,
            initData: defaultData,
            maxHeight: maxHeight,
            minHeight: minHeight,
          ),
        ),
      );
    },
  );

  if (onSelect != null && result is List) {
    onSelect(result.first, result.last);
  }
  return result;
}