showSysConfirm static method
void
showSysConfirm({})
显示系统确认对话框
Implementation
static void showSysConfirm(
{String title = 'Confirm',
String message = 'Do you want to do it?',
String cancelLabelText = 'Cancel',
String okLabelText = 'OK',
Function? onCancel,
required Function onConfirm}) async {
if (isAlerted) {
return;
}
isAlerted = true;
final result = await showOkCancelAlertDialog(
context: Get.context!,
title: title,
message: message,
cancelLabel: cancelLabelText,
okLabel: okLabelText,
barrierDismissible: false,
defaultType: OkCancelAlertDefaultType.cancel,
);
if (result == OkCancelResult.ok) {
isAlerted = false;
onConfirm();
} else if (result == OkCancelResult.cancel) {
isAlerted = false;
if (onCancel != null) {
onCancel();
}
}
}