showConfirmDialog static method
Future<void>
showConfirmDialog(
- BuildContext context,
- String title,
- String message,
- void onOkPressed(),
Implementation
static Future<void> showConfirmDialog(
BuildContext context, String title, String message, void Function() onOkPressed) async {
return showDialog<void>(
context: context,
barrierDismissible: false, // user must tap button!
builder: (BuildContext context) {
return AlertDialog(
title: Text(title),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
Text(message),
],
),
),
actions: <Widget>[
TextButton(
child: Text(tr('common.cancel')),
onPressed: () {
Navigator.of(context).pop();
},
),
TextButton(
child: Text(tr('common.ok')),
onPressed: () {
onOkPressed();
Navigator.of(context).pop();
},
),
],
);
},
);
}