showCancelOKAlert static method

Future showCancelOKAlert({
  1. BuildContext? context,
  2. bool barrierDismissible = false,
  3. String? title,
  4. String? message,
  5. TextAlign? messageAlign,
  6. String? cancelTitle,
  7. dynamic cancelHandle()?,
  8. dynamic closeHandle()?,
  9. String? okTitle,
  10. required dynamic okHandle(),
})

Implementation

static Future showCancelOKAlert({
  BuildContext? context,
  bool barrierDismissible = false,
  String? title,
  String? message,
  TextAlign? messageAlign,
  String? cancelTitle,
  Function()? cancelHandle,
  Function()? closeHandle,
  String? okTitle,
  required Function() okHandle,
}) {
  return showAlert(
    context,
    barrierDismissible: barrierDismissible,
    alertViewBulider: (context) {
      return CancelOKMessageAlertView(
        title: title,
        message: message,
        messageAlign: messageAlign,
        cancelTitle: cancelTitle ?? "取消",
        cancelHandle: () {
          Navigator.of(context).pop();
          if (cancelHandle != null) {
            cancelHandle();
          }
        },
        okTitle: okTitle ?? "确定",
        okHandle: () {
          Navigator.of(context).pop();
          okHandle();
        },
        closeHandle: () {
          Navigator.of(context).pop();
          if (closeHandle != null) {
            closeHandle();
          }
        },
      );
    },
  );
}