ReactiveRadio<T> constructor

ReactiveRadio<T>({
  1. Key? key,
  2. String? formControlName,
  3. FormControl<T>? formControl,
  4. required T value,
  5. Color? activeColor,
  6. Color? focusColor,
  7. Color? hoverColor,
  8. MaterialStateProperty<Color?>? fillColor,
  9. MaterialStateProperty<Color?>? overlayColor,
  10. MouseCursor? mouseCursor,
  11. MaterialTapTargetSize? materialTapTargetSize,
  12. VisualDensity? visualDensity,
  13. double? splashRadius,
  14. bool autofocus = false,
  15. bool toggleable = false,
  16. 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,
          );
        },
      );