FormBuilderCheckboxGroup<T> constructor

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

Creates a list of Checkboxes for selecting multiple options

Implementation

FormBuilderCheckboxGroup({
  super.key,
  required super.name,
  this.visualDensity,
  super.validator,
  super.initialValue,
  super.decoration,
  super.onChanged,
  super.valueTransformer,
  super.enabled,
  super.onSaved,
  super.autovalidateMode = AutovalidateMode.disabled,
  super.onReset,
  super.focusNode,
  super.restorationId,
  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.itemDecoration,
}) : 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) {
                field.didChange(val);
              },
              disabled: state.enabled
                  ? disabled
                  : options.map((e) => e.value).toList(),
              activeColor: activeColor,
              visualDensity: visualDensity,
              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,
              itemDecoration: itemDecoration,
            ),
          );
        },
      );