ReactiveRadio<T> constructor
ReactiveRadio<T> ({
- Key? key,
- String? formControlName,
- FormControl<
T> ? formControl, - required T value,
- Color? activeColor,
- Color? focusColor,
- Color? hoverColor,
- MaterialStateProperty<
Color?> ? fillColor, - MaterialStateProperty<
Color?> ? overlayColor, - MouseCursor? mouseCursor,
- MaterialTapTargetSize? materialTapTargetSize,
- VisualDensity? visualDensity,
- double? splashRadius,
- bool autofocus = false,
- bool toggleable = false,
- FocusNode? focusNode,
Creates a ReactiveRadio that contains a Radio.
Can optionally provide a formControl
to bind this widget to a control.
Can optionally provide a formControlName
to bind this ReactiveFormField
to a FormControl.
Must provide one of the arguments formControl
or a formControlName
,
but not both at the same time.
The value
arguments is required. See Radio constructor.
For documentation about the various parameters, see the Radio class and Radio, the constructor.
Implementation
ReactiveRadio({
Key? key,
String? formControlName,
FormControl<T>? formControl,
required T value,
Color? activeColor,
Color? focusColor,
Color? hoverColor,
MaterialStateProperty<Color?>? fillColor,
MaterialStateProperty<Color?>? overlayColor,
MouseCursor? mouseCursor,
MaterialTapTargetSize? materialTapTargetSize,
VisualDensity? visualDensity,
double? splashRadius,
bool autofocus = false,
bool toggleable = false,
FocusNode? focusNode,
}) : super(
key: key,
formControl: formControl,
formControlName: formControlName,
builder: (field) {
final state = field as _ReactiveRadioState<T, T>;
state._setFocusNode(focusNode);
return Radio<T>(
value: value,
groupValue: field.value,
onChanged: field.control.enabled ? field.didChange : null,
activeColor: activeColor,
focusColor: focusColor,
hoverColor: hoverColor,
fillColor: fillColor,
overlayColor: overlayColor,
mouseCursor: mouseCursor,
splashRadius: splashRadius,
materialTapTargetSize: materialTapTargetSize,
visualDensity: visualDensity,
autofocus: autofocus,
toggleable: toggleable,
focusNode: state.focusNode,
);
},
);