FormBuilderCheckboxGroup<T> constructor

FormBuilderCheckboxGroup<T>({
  1. Key? key,
  2. required String name,
  3. FormFieldValidator<List<T>>? validator,
  4. List<T>? initialValue,
  5. InputDecoration decoration = const InputDecoration(),
  6. ValueChanged<List<T>?>? onChanged,
  7. ValueTransformer<List<T>?>? valueTransformer,
  8. bool enabled = true,
  9. FormFieldSetter<List<T>>? onSaved,
  10. AutovalidateMode? autovalidateMode = AutovalidateMode.disabled,
  11. VoidCallback? onReset,
  12. FocusNode? focusNode,
  13. required List<FormBuilderFieldOption<T>> options,
  14. Color? activeColor,
  15. Color? checkColor,
  16. Color? focusColor,
  17. Color? hoverColor,
  18. List<T>? disabled,
  19. MaterialTapTargetSize? materialTapTargetSize,
  20. bool tristate = false,
  21. Axis wrapDirection = Axis.horizontal,
  22. WrapAlignment wrapAlignment = WrapAlignment.start,
  23. double wrapSpacing = 0.0,
  24. WrapAlignment wrapRunAlignment = WrapAlignment.start,
  25. double wrapRunSpacing = 0.0,
  26. WrapCrossAlignment wrapCrossAxisAlignment = WrapCrossAlignment.start,
  27. TextDirection? wrapTextDirection,
  28. VerticalDirection wrapVerticalDirection = VerticalDirection.down,
  29. Widget? separator,
  30. ControlAffinity controlAffinity = ControlAffinity.leading,
  31. OptionsOrientation orientation = OptionsOrientation.wrap,
  32. bool shouldRequestFocus = false,
})

Creates a list of Checkboxes for selecting multiple options

Implementation

FormBuilderCheckboxGroup({
  super.key,
  required super.name,
  super.validator,
  super.initialValue,
  super.decoration,
  super.onChanged,
  super.valueTransformer,
  super.enabled,
  super.onSaved,
  super.autovalidateMode = AutovalidateMode.disabled,
  super.onReset,
  super.focusNode,
  required this.options,
  this.activeColor,
  this.checkColor,
  this.focusColor,
  this.hoverColor,
  this.disabled,
  this.materialTapTargetSize,
  this.tristate = false,
  this.wrapDirection = Axis.horizontal,
  this.wrapAlignment = WrapAlignment.start,
  this.wrapSpacing = 0.0,
  this.wrapRunAlignment = WrapAlignment.start,
  this.wrapRunSpacing = 0.0,
  this.wrapCrossAxisAlignment = WrapCrossAlignment.start,
  this.wrapTextDirection,
  this.wrapVerticalDirection = VerticalDirection.down,
  this.separator,
  this.controlAffinity = ControlAffinity.leading,
  this.orientation = OptionsOrientation.wrap,
  this.shouldRequestFocus = false,
}) : super(
        builder: (FormFieldState<List<T>?> field) {
          final state = field as _FormBuilderCheckboxGroupState<T>;

          return InputDecorator(
            decoration: state.decoration,
            child: GroupedCheckbox<T>(
              orientation: orientation,
              value: state.value,
              options: options,
              onChanged: (val) {
                if (shouldRequestFocus) {
                  state.requestFocus();
                }
                field.didChange(val);
              },
              disabled: state.enabled
                  ? disabled
                  : options.map((e) => e.value).toList(),
              activeColor: activeColor,
              focusColor: focusColor,
              checkColor: checkColor,
              materialTapTargetSize: materialTapTargetSize,
              hoverColor: hoverColor,
              tristate: tristate,
              wrapAlignment: wrapAlignment,
              wrapCrossAxisAlignment: wrapCrossAxisAlignment,
              wrapDirection: wrapDirection,
              wrapRunAlignment: wrapRunAlignment,
              wrapRunSpacing: wrapRunSpacing,
              wrapSpacing: wrapSpacing,
              wrapTextDirection: wrapTextDirection,
              wrapVerticalDirection: wrapVerticalDirection,
              separator: separator,
              controlAffinity: controlAffinity,
            ),
          );
        },
      );