FormBuilderRadioGroup<T> constructor
FormBuilderRadioGroup<T> ({
- Key? key,
- 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 List<
FormBuilderFieldOption< options,T> > - Color? activeColor,
- Color? focusColor,
- Color? hoverColor,
- List<
T> ? disabled, - MaterialTapTargetSize? materialTapTargetSize,
- Axis wrapDirection = Axis.horizontal,
- WrapAlignment wrapAlignment = WrapAlignment.start,
- double wrapSpacing = 0.0,
- WrapAlignment wrapRunAlignment = WrapAlignment.start,
- double wrapRunSpacing = 0.0,
- WrapCrossAlignment wrapCrossAxisAlignment = WrapCrossAlignment.start,
- TextDirection? wrapTextDirection,
- VerticalDirection wrapVerticalDirection = VerticalDirection.down,
- Widget? separator,
- ControlAffinity controlAffinity = ControlAffinity.leading,
- 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,
),
);
},
);