show method

void show(
  1. BuildContext context
)

Implementation

void show(BuildContext context) {
  showModalBottomSheet(
    isDismissible: barrierDismissible,
    backgroundColor: Colors.transparent,
    barrierColor: barrierColor,
    barrierLabel: barrierLabel,
    isScrollControlled: scrollable ?? false,
    useSafeArea: true,
    context: context,
    builder: (context) {
      if (scrollable ?? false) {
        return DraggableScrollableSheet(
          expand: expand ?? true,
          initialChildSize: initialChildSize ?? 0.5,
          minChildSize: minChildSize ?? 0.25,
          maxChildSize: maxChildSize ?? 1.0,
          builder: (context, scrollController) =>
              body(scrollController: scrollController),
        );
      }

      return body();
    },
  ).then(
    (Object? value) {
      try {
        onClose?.call(value) ?? () {};
      } catch (e) {
        debugPrint("sheet error: $e");
      }
    },
  );
}