showActionDialog method
Future<ActionDialogOptions>
showActionDialog(
- BuildContext context,
- String dialogTitle,
- String dialogContent,
- String actionButtonText,
Implementation
Future<ActionDialogOptions> showActionDialog(
BuildContext context,
String dialogTitle,
String dialogContent,
String actionButtonText,
) async {
var result = await showDialog<ActionDialogOptions>(
context: context,
builder: (context) {
return AlertDialog(
title: Text(dialogTitle),
content: Text(dialogContent),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(ActionDialogOptions.cancel);
},
child: const Text('Cancel'),
),
FilledButton(
onPressed: () {
Navigator.of(context).pop(ActionDialogOptions.action);
},
child: Text(actionButtonText),
),
],
);
},
);
return result ?? ActionDialogOptions.cancel;
}