ZetaCheckbox constructor

ZetaCheckbox({
  1. bool value = false,
  2. String? label,
  3. ValueChanged<bool>? onChanged,
  4. bool? rounded,
  5. bool useIndeterminate = false,
  6. FocusNode? focusNode,
  7. String? semanticLabel,
  8. FormFieldValidator<bool>? validator,
  9. AutovalidateMode? autovalidateMode,
  10. String? restorationId,
  11. Key? key,
})

Constructs a ZetaCheckbox.

Implementation

ZetaCheckbox({
  this.value = false,
  this.label,
  this.onChanged,
  this.rounded,
  this.useIndeterminate = false,
  this.focusNode,
  this.semanticLabel,
  super.validator,
  super.autovalidateMode,
  super.restorationId,
  super.key,
}) : super(
        initialValue: value,
        enabled: onChanged != null,
        builder: (field) {
          return ZetaInternalCheckbox(
            label: label,
            onChanged: (changedValue) {
              field.didChange(changedValue);
              onChanged?.call(changedValue!);
            },
            rounded: rounded,
            useIndeterminate: useIndeterminate,
            value: value,
            error: !field.isValid,
            disabled: onChanged == null,
            focusNode: focusNode,
            semanticLabel: semanticLabel,
          );
        },
      );