FormBuilderRadioGroup<T> constructor
FormBuilderRadioGroup<T> ({
- AutovalidateMode? autovalidateMode = AutovalidateMode.disabled,
- bool enabled = true,
- FocusNode? focusNode,
- FormFieldSetter<
T> ? onSaved, - FormFieldValidator<
T> ? validator, - InputDecoration decoration = const InputDecoration(),
- Key? key,
- required String name,
- required List<
FormBuilderFieldOption< options,T> > - T? initialValue,
- bool shouldRadioRequestFocus = false,
- Color? activeColor,
- ControlAffinity controlAffinity = ControlAffinity.leading,
- List<
T> ? disabled, - Color? focusColor,
- Color? hoverColor,
- MaterialTapTargetSize? materialTapTargetSize,
- OptionsOrientation orientation = OptionsOrientation.wrap,
- Widget? separator,
- WrapAlignment wrapAlignment = WrapAlignment.start,
- WrapCrossAlignment wrapCrossAxisAlignment = WrapCrossAlignment.start,
- Axis wrapDirection = Axis.horizontal,
- WrapAlignment wrapRunAlignment = WrapAlignment.start,
- double wrapRunSpacing = 0.0,
- double wrapSpacing = 0.0,
- TextDirection? wrapTextDirection,
- VerticalDirection wrapVerticalDirection = VerticalDirection.down,
- ValueChanged<
T?> ? onChanged, - ValueTransformer<
T?> ? valueTransformer, - 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,
),
);
},
);