Radio<T> constructor

const Radio<T>(
  1. {Key key,
  2. @required T value,
  3. @required T groupValue,
  4. @required ValueChanged<T> onChanged,
  5. MouseCursor mouseCursor,
  6. bool toggleable: false,
  7. Color activeColor,
  8. Color focusColor,
  9. Color hoverColor,
  10. MaterialTapTargetSize materialTapTargetSize,
  11. VisualDensity visualDensity,
  12. FocusNode focusNode,
  13. bool autofocus: false}
)

Creates a material design radio button.

The radio button itself does not maintain any state. Instead, when the radio button is selected, the widget calls the onChanged callback. Most widgets that use a radio button will listen for the onChanged callback and rebuild the radio button with a new groupValue to update the visual appearance of the radio button.

The following arguments are required:

  • value and groupValue together determine whether the radio button is selected.
  • onChanged is called when the user selects this radio button.

Implementation

const Radio({
  Key key,
  @required this.value,
  @required this.groupValue,
  @required this.onChanged,
  this.mouseCursor,
  this.toggleable = false,
  this.activeColor,
  this.focusColor,
  this.hoverColor,
  this.materialTapTargetSize,
  this.visualDensity,
  this.focusNode,
  this.autofocus = false,
}) : assert(autofocus != null),
     assert(toggleable != null),
     super(key: key);