ControlledRadioGroup<T> constructor
const
ControlledRadioGroup<T> ({
- Key? key,
- RadioGroupController<
T?> ? controller, - T? initialValue,
- ValueChanged<
T?> ? onChanged, - bool enabled = true,
- required Widget child,
Creates a ControlledRadioGroup.
Either controller
or onChanged
should be provided for interactivity.
The widget supports both controller-based and callback-based state management
patterns with automatic mutual exclusion between radio options.
Parameters:
controller
(RadioGroupControllerinitialValue
(T?, optional): starting selection when no controlleronChanged
(ValueChanged<T?>?, optional): selection change callbackenabled
(bool, default: true): whether radio group is interactivechild
(Widget, required): layout containing radio buttons
Example:
ControlledRadioGroup<String>(
controller: controller,
child: Column(
children: [
Radio<String>(value: 'option1', label: Text('Option 1')),
Radio<String>(value: 'option2', label: Text('Option 2')),
],
),
)
Implementation
const ControlledRadioGroup({
super.key,
this.controller,
this.initialValue,
this.onChanged,
this.enabled = true,
required this.child,
});