openAlertDialog method
void
openAlertDialog(
- BuildContext context,
- String title,
- String message,
- String okMessage,
- String cancelMessage,
- dynamic confirm(),
Implementation
void openAlertDialog(
BuildContext context,
String title,
String message,
String okMessage,
String cancelMessage,
final Function(bool, BuildContext) confirm) {
showDialog<String>(
context: context,
builder: (BuildContext context) => AlertDialog(
title: Text(title),
content: Text(message),
actions: <Widget>[
TextButton(
onPressed: () {
confirm(false, context);
},
child: Text(cancelMessage),
),
TextButton(
onPressed: () {
confirm(true, context);
},
child: Text(okMessage),
),
],
),
);
}