TRadioGroup<T> class
A group of radio buttons for single selection.
TRadioGroup provides a single-select input with:
- Single radio button selection
- Keyboard navigation support
- Validation support
- Vertical or horizontal layout
- Value binding with ValueNotifier
Basic Usage
TRadioGroup<String>(
label: 'Select an option',
items: [
TRadioGroupItem(value: 'option1', label: 'Option 1'),
TRadioGroupItem(value: 'option2', label: 'Option 2'),
TRadioGroupItem(value: 'option3', label: 'Option 3'),
],
onValueChanged: (value) => print('Selected: $value'),
)
Type parameter:
T: The type of values for the radio buttons
See also:
- TRadio for single radio button
- TCheckboxGroup for multiple selection
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- TRadioGroup
- Mixed-in types
Constructors
-
TRadioGroup({Key? key, String? label, String? tag, String? helperText, bool isRequired = false, bool disabled = false, bool clearable = false, TInputFieldTheme? theme, VoidCallback? onTap, FocusNode? focusNode, T? value, ValueNotifier<
T?> ? valueNotifier, ValueChanged<T?> ? onValueChanged, List<String? Function(T?)> ? rules, Duration? validationDebounce, List<TRadioGroupItem< items = const [], Color? color, bool block = true, bool vertical = false, bool autoFocus = false, double spacing = 16, double runSpacing = 8})T> > -
Creates a radio group.
const
Properties
- autoFocus → bool
-
Whether to auto-focus the first radio button.
final
- block → bool
-
Whether to display in block mode.
final
- clearable → bool
-
Whether the field shows a clear button when it has a value.
final
- color → Color?
-
Custom color for the radio buttons.
final
- disabled → bool
-
Whether the field is disabled.
final
- focusNode → FocusNode?
-
Custom focus node.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- helperText → String?
-
The helper text.
final
- isRequired → bool
-
Whether the field is required.
final
-
items
→ List<
TRadioGroupItem< T> > -
The list of radio group items.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
The label text.
final
- onTap → VoidCallback?
-
Callback for tap events.
final
-
onValueChanged
→ ValueChanged<
T?> ? -
Callback fired when the value changes.
final
-
rules
→ List<
String? Function(T?)> ? -
List of validation rules.
final
- runSpacing → double
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- spacing → double
-
final
- tag → String?
-
The tag text (optional).
final
- theme → TInputFieldTheme?
-
Custom theme.
final
- validationDebounce → Duration?
-
Debounce duration for validation trigger.
final
- value → T?
-
The initial value.
final
-
valueNotifier
→ ValueNotifier<
T?> ? -
A ValueNotifier for two-way binding.
final
- vertical → bool
-
Whether to display vertically.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< TRadioGroup< 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
-
validateValue(
T? value) → List< String> -
Validates the given value against the rules.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited