showSubZeroConfirmDialog function
A confirmation dialog helper that returns true/false.
This is a convenience wrapper around showSubZeroDialog for common confirmation scenarios.
Example usage:
final confirmed = await showSubZeroConfirmDialog(
context: context,
title: 'Delete Item?',
body: 'This action cannot be undone.',
confirmLabel: 'Delete',
cancelLabel: 'Cancel',
);
if (confirmed == true) {
// Proceed with deletion
}
Implementation
Future<bool?> showSubZeroConfirmDialog({
required BuildContext context,
required String title,
String? body,
String confirmLabel = 'Confirm',
String cancelLabel = 'Cancel',
bool barrierDismissible = true,
}) {
return showSubZeroDialog<bool>(
context: context,
title: title,
body: body,
barrierDismissible: barrierDismissible,
actions: SubZeroDialogActions(
primaryLabel: confirmLabel,
onPrimary: () => Navigator.of(context).pop(true),
secondaryLabel: cancelLabel,
onSecondary: () => Navigator.of(context).pop(false),
),
);
}