showModalBottom static method

void showModalBottom({
  1. required Widget child,
  2. Widget? title,
  3. Widget? leading,
  4. List<Widget>? actions,
  5. Widget? bottom,
  6. EdgeInsetsGeometry? padding,
  7. double? minHeight,
  8. bool showTitle = true,
  9. bool isScrollControlled = true,
  10. bool useSafeArea = true,
})

Implementation

static void showModalBottom({
  required Widget child,
  Widget? title,
  Widget? leading,
  List<Widget>? actions,
  Widget? bottom,
  EdgeInsetsGeometry? padding,
  double? minHeight,
  bool showTitle = true,
  bool isScrollControlled = true,
  bool useSafeArea = true,
}) {
  BoxConstraints? boxConstraints;
  if (minHeight != null) {
    boxConstraints = BoxConstraints(
      minHeight: minHeight,
    );
  }

  showModalBottomSheet(
    context: Get.context!,
    isScrollControlled: isScrollControlled,
    useSafeArea: useSafeArea,
    constraints: boxConstraints,
    backgroundColor: Theme.of(Get.context!).dialogTheme.backgroundColor,
    builder: (BuildContext context) {
      return Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          if (showTitle)
            ComTitleBar(
              title: title,
              leading: leading,
              actions: actions,
            ),
          if (bottom != null) bottom,
          ConstrainedBox(
            constraints: BoxConstraints(
              maxHeight: MediaQuery.of(context).size.height * 0.8,
            ),
            child: SingleChildScrollView(
              padding: EdgeInsets.only(
                bottom: MediaQuery.of(context).padding.bottom +
                    MediaQuery.of(context).viewInsets.bottom,
              ),
              child: child,
            ),
          ),
        ],
      );
    },
  );
}