-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Items removal upon tapping does not work. #19
Comments
// setting the _selectedAnimals3 to desired pre-selected values list in initState - recommended
MultiSelectBottomSheetField(
onConfirm: (values) {
_selectedAnimals3 = values;
},
items: _items,
initialValue: _selectedAnimals3,
chipDisplay: MultiSelectChipDisplay(
onTap: (item) {
_selectedAnimals3.remove(item);
return _selectedAnimals3;
},
),
), Try this code add the return statement in onTap |
Wow! It works, it seems the last 'return' did the job. Thanks bro! But how did you figure it out? |
Check out this #11 issue, you will get to know how I figured out |
@madhan-asmb Thanks :) Going to drop a link to the first issue regarding this type of problem which provides more background. |
Spent hours before getting here, maybe a better documentation could help. |
MultiSelectDialogField, some initial values are provided. In the MultiSelectChipDisplay's onTap method, the removal is wrapped with setstate (this does slow down the UI refreshment).
Upon clicking on initial items, they are not removed, but the validator complains 'no items selected'.
But, if no initial values provided, it works perfectly.
The text was updated successfully, but these errors were encountered: