ControlledRadioGroup<T> constructor

const ControlledRadioGroup<T>({
  1. Key? key,
  2. RadioGroupController<T?>? controller,
  3. T? initialValue,
  4. ValueChanged<T?>? onChanged,
  5. bool enabled = true,
  6. 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 (RadioGroupController
  • initialValue (T?, optional): starting selection when no controller
  • onChanged (ValueChanged<T?>?, optional): selection change callback
  • enabled (bool, default: true): whether radio group is interactive
  • child (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,
});