showAlertDialog static method
Implementation
static Future<void> showAlertDialog(
BuildContext context, {
required String title,
required String message,
String? labelOk,
String? labelCancel,
Function? onPressOk,
Function? onPressCancel,
}) async {
await showDialog<void>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(title),
content: Text(message),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context);
if (onPressOk != null) {
onPressOk();
}
},
child: Text(labelOk ?? 'OK'),
),
TextButton(
onPressed: () {
Navigator.pop(context);
if (onPressCancel != null) {
onPressCancel();
}
},
child: Text(labelCancel ?? 'Cancel'),
)
],
);
},
);
}