showBottom<T> static method

Future<T?> showBottom<T>(
  1. Widget child, {
  2. double? radius,
  3. Color? bgColor,
  4. bool enableDrag = true,
  5. bool dismissOnTouch = true,
})

底部弹窗

Implementation

static Future<T?> showBottom<T>(Widget child, {double? radius, Color? bgColor,
  bool enableDrag = true, bool dismissOnTouch = true,}) async {
  return await showModalBottomSheet<T>(
      context: Get.context!,
      backgroundColor: Colors.transparent,
      isDismissible: dismissOnTouch,
      barrierColor: null,
      isScrollControlled: true, // 设置滚动控制为 true, 取消高度限制
      enableDrag: enableDrag,
      builder: (BuildContext context) {
        return BottomSheet(
            enableDrag: false,
            shadowColor: null,
            backgroundColor: Colors.transparent,
            onClosing: () {},
            builder: (BuildContext context) {
              return AnimatedContainer(
                clipBehavior: Clip.antiAlias,
                decoration: BoxDecoration(
                  color: bgColor ?? Theme.of(context).dialogBackgroundColor,
                  borderRadius: BorderRadius.only(topRight: Radius.circular(radius ?? 10),
                      topLeft: Radius.circular(radius ?? 10))
                ),
                padding: EdgeInsets.only(
                  bottom: MediaQuery.of(context).viewInsets.bottom,
                ),
                duration: Duration.zero,
                child: KeyboardDismisser(child: SafeArea(child: child,)),
              );
            });
      });
}