FormBuilderRadioGroup<T> constructor

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

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

Implementation

FormBuilderRadioGroup({
  Key? key,
  //From Super
  required String name,
  FormFieldValidator<T>? validator,
  T? initialValue,
  InputDecoration decoration = const InputDecoration(),
  ValueChanged<T?>? onChanged,
  ValueTransformer<T?>? valueTransformer,
  bool enabled = true,
  FormFieldSetter<T>? onSaved,
  AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
  VoidCallback? onReset,
  FocusNode? focusNode,
  required this.options,
  this.activeColor,
  this.focusColor,
  this.hoverColor,
  this.disabled,
  this.materialTapTargetSize,
  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,
}) : super(
        key: key,
        initialValue: initialValue,
        name: name,
        validator: validator,
        valueTransformer: valueTransformer,
        onChanged: onChanged,
        autovalidateMode: autovalidateMode,
        onSaved: onSaved,
        enabled: enabled,
        onReset: onReset,
        focusNode: focusNode,
        decoration: decoration,
        builder: (FormFieldState<T?> field) {
          final state = field as _FormBuilderRadioGroupState<T>;

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