RawRadio<T> class

A Radio button that provides basic radio functionalities.

Provide the builder to draw UI for radio.

If drawing a radial ink reaction is desired (in Material Design for example), consider providing CustomPaint with a subclass of ToggleablePainter as a CustomPaint.painter, which implements logic to draw a radial ink reaction for this control. The painter is usually configured with the ToggleableStateMixin.reaction, ToggleableStateMixin.position, ToggleableStateMixin.reactionHoverFade, and ToggleableStateMixin.reactionFocusFade animation provided by this mixin. It is expected to draw the visuals of the Toggleable based on the current value of these animations. The animations are triggered by this mixin to transition the Toggleable from one state to another.

This widget allows selection between a number of mutually exclusive values. When one radio button in a group is selected, the other radio buttons in the group cease to be selected. The values are of type T, the type parameter of the radio class. Enums are commonly used for this purpose.

The radio relies on groupRegistry to maintains the state for selection. If use in conjunction with a RadioGroup widget, use RadioGroup.maybeOf to get the group registry from the context.

If enabled is false, the radio will not be interactive.

See also:

  • Radio, which uses this widget to build a Material styled radio button.
  • CupertinoRadio, which uses this widget to build a Cupertino styled radio button.
Inheritance

Constructors

RawRadio.new({Key? key, required T value, required WidgetStateProperty<MouseCursor> mouseCursor, required bool toggleable, required FocusNode focusNode, required bool autofocus, required RadioGroupRegistry<T>? groupRegistry, required bool enabled, required RadioBuilder builder})
Creates a radio button.
const

Properties

autofocus bool
True if this widget will be selected as the initial focus when no other node in its scope is currently focused.
final
builder RadioBuilder
The builder for the radio button visual.
final
enabled bool
Whether this widget is enabled.
final
focusNode FocusNode
An optional focus node to use as the focus node for this widget.
final
groupRegistry RadioGroupRegistry<T>?
The registry this radio registers to.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
mouseCursor WidgetStateProperty<MouseCursor>
The cursor for a mouse pointer when it enters or is hovering over the widget.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toggleable bool
Set to true if this radio button is allowed to be returned to an indeterminate state by selecting it again when selected.
final
value → T
The value represented by this radio button.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<RawRadio<T>>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited