make<T> static method

Future<T?> make<T>({
  1. String? title,
  2. Widget? titleWidget,
  3. String? message,
  4. Widget? messageWidget,
  5. required List<SheetAction> actions,
  6. SheetAction? cancelAction,
})

Implementation

static Future<T?> make<T>({
  String? title,
  Widget? titleWidget,
  String? message,
  Widget? messageWidget,
  required List<SheetAction> actions,
  SheetAction? cancelAction,
}) async {
  var result = await Get.bottomSheet(
    Theme(
      data: ThemeData(brightness: Fav.design.brightness),
      child: WillPopScope(
        onWillPop: () async {
          return false;
        },
        child: Container(
          padding: EdgeInsets.only(top: Get.context!.mediaQueryPadding.top),
          alignment: Alignment.bottomCenter,
          child: CupertinoActionSheet(
            title: titleWidget ?? title?.text.bold.make(),
            message: messageWidget ?? message?.text.make(),
            actions: actions
                .map((e) => CupertinoActionSheetAction(
                      child: e.child ?? e.title.text.make(),
                      onPressed: e.onPressed,
                      isDestructiveAction: e.isDestructiveAction,
                      isDefaultAction: e.isDefaultAction,
                    ))
                .toList(),
            cancelButton: cancelAction == null
                ? null
                : CupertinoActionSheetAction(
                    child: cancelAction.child ?? cancelAction.title.text.make(),
                    onPressed: cancelAction.onPressed,
                    isDestructiveAction: cancelAction.isDestructiveAction,
                    isDefaultAction: cancelAction.isDefaultAction,
                  ),
          ),
        ),
      ),
    ),
    isScrollControlled: true,
    isDismissible: false,
    enableDrag: false,
  );
  return result as T?;
}