flutter_chips_choice
flutter_chips_choice copied to clipboard
Limit selected chips count ChipsChoice.multiple mode
Hi, first of all thanks a lot for this great library - saved us a lot of time already!
We were looking for a way to limit how many chips can be selected in ChipsChoice.multiple mode. If the limit is reached all other chips are disabled. We have already implemented this manually, but I think this would make a great addition to this library if it worked out of the box.
Edit: Here is how we are doing it at the moment (which is super simple anyways):
ChipsChoice.multiple(
[...]
choiceItems: C2Choice.listFrom(
[...]
disabled: (i, v) => !_selectedItems.contains(_allItems[i]) && _selectedItems.length >= _maxSelectedItems
),
)