ConfirmAction constructor

ConfirmAction({
  1. required bool open,
  2. required String title,
  3. required String message,
  4. String confirmLabel = 'Confirm',
  5. String cancelLabel = 'Cancel',
  6. bool danger = false,
  7. String? className,
  8. Map<String, Object?> props = const {},
  9. Map<String, Object?> style = const {},
  10. DartStyle? dartStyle,
  11. void onConfirm(
    1. Object event
    )?,
  12. void onCancel(
    1. Object event
    )?,
})

Creates a confirmation modal controlled by open.

Implementation

ConfirmAction({
  required bool open,
  required String title,
  required String message,
  String confirmLabel = 'Confirm',
  String cancelLabel = 'Cancel',
  bool danger = false,
  String? className,
  Map<String, Object?> props = const {},
  Map<String, Object?> style = const {},
  DartStyle? dartStyle,
  void Function(Object event)? onConfirm,
  void Function(Object event)? onCancel,
}) : super(
        'div',
        props: mergeComponentProps(
          props,
          className: className,
          dartStyle: dartStyle,
          style: style,
        ),
        children: [
          Modal(
            open: open,
            title: title,
            child: message,
            onClose: onCancel,
            actions: ButtonGroup(
              children: [
                Button(
                  child: cancelLabel,
                  variant: ButtonVariant.outline,
                  tone: Tone.neutral,
                  onPressed: onCancel,
                ),
                Button(
                  child: confirmLabel,
                  tone: danger ? Tone.danger : Tone.primary,
                  onPressed: onConfirm,
                ),
              ],
            ),
          ),
        ],
      );