showDestructiveConfirmation static method

Future<bool> showDestructiveConfirmation({
  1. required BuildContext context,
  2. required String title,
  3. String? message,
  4. required String destructiveTitle,
  5. VoidCallback? onDestroy,
  6. BaseParam? cupertino,
  7. BaseParam? material,
})

Shows a destructive confirmation alert.

Implementation

static Future<bool> showDestructiveConfirmation({
  required BuildContext context,
  required String title,
  String? message,
  required String destructiveTitle,
  VoidCallback? onDestroy,
  BaseParam? cupertino,
  BaseParam? material,
}) async {
  final result = await show(
    context: context,
    title: title,
    message: message,
    actions: [
      BaseAlertAction(
        title: 'Cancel',
        style: BaseAlertActionStyle.cancel,
      ),
      BaseAlertAction(
        title: destructiveTitle,
        style: BaseAlertActionStyle.destructive,
        onPressed: onDestroy,
      ),
    ],
    cupertino: cupertino,
    material: material,
  );

  return result == 1; // Returns true if destructive action was tapped
}