FormBuilderRadioGroup<T> constructor

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

Creates field to select one value from a list of Radio Widgets

Implementation

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

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