showConfirmMessage method
Future<void>
showConfirmMessage({
- String title = 'Confirm',
- String message = 'Are you sure?',
- VoidCallback? yesCallback,
- VoidCallback? noCallback,
- String yesLabel = 'Yes',
- String noLabel = 'No',
Show a confirm message.
Implementation
Future<void> showConfirmMessage({
final String title = 'Confirm',
final String message = 'Are you sure?',
final VoidCallback? yesCallback,
final VoidCallback? noCallback,
final String yesLabel = 'Yes',
final String noLabel = 'No',
}) => showDialog<void>(
context: this,
builder: (final innerContext) => AlertDialog(
title: Text(title),
content: Focus(autofocus: true, child: Text(message)),
actions: [
ElevatedButton(
onPressed: () {
innerContext.pop();
yesCallback?.call();
},
child: Text(yesLabel),
),
ElevatedButton(
onPressed: () {
innerContext.pop();
noCallback?.call();
},
child: Text(noLabel),
),
],
),
);