showSubZeroConfirmDialog function

Future<bool?> showSubZeroConfirmDialog({
  1. required BuildContext context,
  2. required String title,
  3. String? body,
  4. String confirmLabel = 'Confirm',
  5. String cancelLabel = 'Cancel',
  6. bool barrierDismissible = true,
})

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),
    ),
  );
}