GroupedRadioButton<T> class

A Flutter widget that displays a group of radio buttons.

The GroupedRadioButton widget displays a group of radio buttons, where only one radio button can be selected at a time. The radio buttons are displayed in a column layout.

The items parameter is a required list of GroupedRadioButtonItem objects that define the radio buttons to be displayed. Each GroupedRadioButtonItem object contains a title widget, a secondary widget (optional), and a value of type T.

The onChanged parameter is a required callback function that is invoked when a radio button is selected. The callback function takes a parameter of type T?, which represents the selected value.

The initialGroupValue parameter is an optional parameter that specifies the initial value of the selected radio button. If not provided, the first radio button in the list will be selected by default.

Example usage:

GroupedRadioButton<String>(
  items: [
    GroupedRadioButtonItem(title: Text("Option 1"), value: "option1"),
    GroupedRadioButtonItem(title: Text("Option 2"), value: "option2"),
  ],
  onChanged: (value) {
    print(value);
  },
  initialGroupValue: "option1",
),
Inheritance

Constructors

GroupedRadioButton({Key? key, required List<GroupedRadioButtonItem<T>> items, required dynamic onChanged(T? value), T? initialGroupValue})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
initialGroupValue → T?
final
items List<GroupedRadioButtonItem<T>>
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onChanged → dynamic Function(T? value)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<GroupedRadioButton<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