showConfirmation static method

Future<bool> showConfirmation({
  1. required BuildContext context,
  2. String? title,
  3. String? message,
  4. String confirmTitle = 'Delete',
  5. String cancelTitle = 'Cancel',
  6. VoidCallback? onConfirm,
  7. BaseParam? cupertino,
  8. BaseParam? material,
})

Shows a simple confirmation action sheet with delete/cancel options

Common pattern for destructive actions like deleting drafts, removing items, etc.

Example:

final confirmed = await BaseActionSheet.showConfirmation(
  context: context,
  title: 'Delete Message?',
  message: 'This action cannot be undone.',
  confirmTitle: 'Delete',
  onConfirm: () => deleteMessage(),
);

Implementation

static Future<bool> showConfirmation({
  required BuildContext context,
  String? title,
  String? message,
  String confirmTitle = 'Delete',
  String cancelTitle = 'Cancel',
  VoidCallback? onConfirm,
  BaseParam? cupertino,
  BaseParam? material,
}) async {
  final result = await show(
    context: context,
    title: title,
    message: message,
    actions: [
      BaseActionSheetAction(
        title: confirmTitle,
        style: BaseActionSheetActionStyle.destructive,
        onPressed: onConfirm,
      ),
    ],
    cancelAction: BaseActionSheetAction(
      title: cancelTitle,
      style: BaseActionSheetActionStyle.cancel,
    ),
    cupertino: cupertino,
    material: material,
  );

  return result != null && result == 0;
}