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. ValueChanged<T?>? onChanged,
  12. ValueTransformer<T?>? valueTransformer,
  13. VoidCallback? onReset,
  14. String? restorationId,
  15. FormFieldErrorBuilder? errorBuilder,
  16. Color? activeColor,
  17. ControlAffinity controlAffinity = ControlAffinity.leading,
  18. List<T>? disabled,
  19. Color? focusColor,
  20. Color? hoverColor,
  21. MaterialTapTargetSize? materialTapTargetSize,
  22. OptionsOrientation orientation = OptionsOrientation.wrap,
  23. Widget? separator,
  24. WrapAlignment wrapAlignment = WrapAlignment.start,
  25. WrapCrossAlignment wrapCrossAxisAlignment = WrapCrossAlignment.start,
  26. Axis wrapDirection = Axis.horizontal,
  27. WrapAlignment wrapRunAlignment = WrapAlignment.start,
  28. double wrapRunSpacing = 0.0,
  29. double wrapSpacing = 0.0,
  30. TextDirection? wrapTextDirection,
  31. VerticalDirection wrapVerticalDirection = VerticalDirection.down,
  32. BoxDecoration? itemDecoration,
})

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,
  super.onChanged,
  super.valueTransformer,
  super.onReset,
  super.restorationId,
  super.errorBuilder,
  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,
  this.itemDecoration,
}) : super(
       builder: (FormFieldState<T?> field) {
         final state = field as _FormBuilderRadioGroupState<T>;

         return Focus(
           focusNode: state.effectiveFocusNode,
           skipTraversal: true,
           canRequestFocus: state.enabled,
           debugLabel: 'FormBuilderRadioGroup-$name',
           child: InputDecorator(
             decoration: state.decoration,
             isFocused: state.effectiveFocusNode.hasFocus,
             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) {
                 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,
               itemDecoration: itemDecoration,
             ),
           ),
         );
       },
     );