davigmacode/flutter_chips_choice

How to set the initial value

Small-World opened this issue · 1 comments

Hello, I have a question,How to set the initial value?When I want to create multiple, I select several options by default。
my code is :
ChipsChoice.multiple(
value: widget.route._tags,
onChanged: (val) {
if (val.length < 7) {
setState(() {
widget.route._tags = val;
});
}
},
choiceItems: null,
choiceLoader: getChoices,
wrapped: true,
padding: EdgeInsets.only(top: 10, bottom: 10),
spacing: 10,
choiceBuilder: (item) {
return CustomChip(
label: item.label,
margin: const EdgeInsets.symmetric(vertical: 5),
width: (MediaQuery.of(context).size.width - 20 - 30) / 4,
height: 35,
selected: item.selected,
onSelect: item.select);
},
))

just set the value to the desired value to achieve initial value