ControlledMultipleAnswer<T> constructor
const
ControlledMultipleAnswer<T> ({
- Key? key,
- MultipleAnswerController<
T> ? controller, - ValueChanged<
Iterable< ? onChanged,T> ?> - Iterable<
T> ? initialValue, - bool enabled = true,
- bool? allowUnselect,
- required Widget child,
Creates a ControlledMultipleAnswer.
Either controller
or initialValue
should be provided to establish
the initial selection state. The child
should contain choice items
that integrate with the multiple selection system.
Parameters:
controller
(MultipleAnswerControllerinitialValue
(IterableonChanged
(ValueChanged<Iterableenabled
(bool, default: true): Whether selections can be modifiedallowUnselect
(bool?, optional): Whether items can be deselected by re-selectionchild
(Widget, required): Container with selectable choice items
Example:
ControlledMultipleAnswer<int>(
initialValue: [1, 3],
allowUnselect: true,
onChanged: (values) => print('Selected: $values'),
child: ChoiceList(items: [1, 2, 3, 4, 5]),
);
Implementation
const ControlledMultipleAnswer({
super.key,
this.controller,
this.onChanged,
this.initialValue,
this.enabled = true,
this.allowUnselect,
required this.child,
});