confirmDialog function
Implementation
Future<dynamic> confirmDialog({
String title = 'Confirm',
String content = 'Are you sure?',
Function? confirm,
Function? cancel,
String confirmLabel = 'Yes',
String cancelLabel = 'No',
}) async {
void close(cback, result) {
Get.back(result: result);
if (cback != null) cback();
}
return _createDialog(
title: title,
content: content,
actions: [
Button(
label: cancelLabel,
backgroundColor: Colors.red,
color: Colors.white,
borderRadius: 10,
borderColor: Colors.black,
onClick: (_) => close(cancel, false),
),
Button(
label: confirmLabel,
backgroundColor: Colors.green,
color: Colors.white,
borderRadius: 10,
borderColor: Colors.black,
onClick: (_) => close(confirm, true),
),
],
);
}