showConfirmDialog method
Implementation
Future<bool> showConfirmDialog({
required String title,
required String message,
String confirmLabel = 'Confirm',
String cancelLabel = 'Cancel',
bool destructive = false,
}) async {
final result = await showAppDialog<bool>(
dialog: AlertDialog(
title: Text(title),
content: Text(message),
actions: [
TextButton(onPressed: () => pop(false), child: Text(cancelLabel)),
TextButton(
onPressed: () => pop(true),
style:
destructive
? TextButton.styleFrom(foregroundColor: colorScheme.error)
: null,
child: Text(confirmLabel),
),
],
),
);
return result ?? false;
}