ConfirmationDialog constructor

const ConfirmationDialog({
  1. Key? key,
  2. required String title,
  3. String? content,
  4. Widget? child,
  5. required VoidCallback onConfirm,
  6. VoidCallback? onCancel,
  7. String? okText,
  8. Color? okColor,
  9. String? cancelText,
  10. Color? cancelColor,
  11. IconData? icon,
})

Creates a ConfirmationDialog widget.

Parameters:

  • title: The title text displayed at the top (required).
  • content: The content text displayed in the body (optional).
  • child: Custom widget to display in the dialog body (optional).
  • onConfirm: Callback executed when confirm button is pressed (required).
  • onCancel: Optional callback executed when cancel button is pressed.
  • okText: Text label for the confirm button (optional, uses default if not provided).
  • okColor: Color for the confirm button text and icon (optional).
  • cancelText: Text label for the cancel button (optional, uses default if not provided).
  • cancelColor: Color for the cancel button text and icon (optional).
  • icon: Icon displayed at the top of the dialog (optional, uses default if not provided).

Implementation

const ConfirmationDialog({
  super.key,
  required this.title,
  this.content,
  this.child,
  required this.onConfirm,
  this.onCancel,
  this.okText,
  this.okColor,
  this.cancelText,
  this.cancelColor,
  this.icon,
});