ControlledMultipleChoice<T> constructor
const
ControlledMultipleChoice<T> ({
- Key? key,
- MultipleChoiceController<
T> ? controller, - ValueChanged<
T?> ? onChanged, - T? initialValue,
- bool enabled = true,
- bool? allowUnselect,
- required Widget child,
Creates a ControlledMultipleChoice.
Either controller
or initialValue
should be provided to establish
the initial selection state. The child
should contain choice items
that integrate with the single selection system.
Parameters:
controller
(MultipleChoiceControllerinitialValue
(T?, optional): Initial selection when no controller providedonChanged
(ValueChanged<T?>?, optional): Callback for selection changesenabled
(bool, default: true): Whether selection can be modifiedallowUnselect
(bool?, optional): Whether selection can be cleared by re-selectionchild
(Widget, required): Container with selectable choice items
Example:
ControlledMultipleChoice<Theme>(
initialValue: Theme.dark,
allowUnselect: false,
onChanged: (theme) => setAppTheme(theme),
child: ThemeSelector(),
);
Implementation
const ControlledMultipleChoice({
super.key,
this.controller,
this.onChanged,
this.initialValue,
this.enabled = true,
this.allowUnselect,
required this.child,
});