DialogConfirm constructor

const DialogConfirm({
  1. Key? key,
  2. required String title,
  3. bool destructive = false,
  4. String? description,
  5. Widget descriptionWidget = const SizedBox.shrink(),
  6. String confirmText = "Confirm",
  7. String cancelText = "Cancel",
  8. List<Widget>? actions,
  9. required VoidCallback onConfirm,
})

Constructs a DialogConfirm widget with the specified properties.

Required parameters:

  • title: The dialog's title text.
  • onConfirm: The callback for the confirm action.

Optional parameters with defaults:

  • destructive: false, for standard confirmations.
  • description: null, falls back to descriptionWidget.
  • descriptionWidget: SizedBox.shrink(), an empty widget.
  • confirmText: "Confirm", the confirm button label.
  • cancelText: "Cancel", the cancel button label.
  • actions: null, no additional actions.

The constructor initializes all fields directly and supports const construction for performance in Flutter builds. Use named parameters for clarity when instantiating.

Implementation

const DialogConfirm({
  super.key,
  required this.title,
  this.destructive = false,
  this.description,
  this.descriptionWidget = const SizedBox.shrink(),
  this.confirmText = "Confirm",
  this.cancelText = "Cancel",
  this.actions,
  required this.onConfirm,
});