Skip to content
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

Initial value doesn't remove on tap badge #127

Closed
HekmatBeigverdi opened this issue Aug 10, 2022 · 3 comments
Closed

Initial value doesn't remove on tap badge #127

HekmatBeigverdi opened this issue Aug 10, 2022 · 3 comments

Comments

@HekmatBeigverdi
Copy link

When using initialValue for MultiSelectBottomSheetField, tapping on initial selected badges doesn't work.
For example:
`
List<Object?> _selectedAnimals = [animal[2], animal[1]];

                     initialValue = _selectedAnimals;

                     onTap: (value) {
                      setState(() {
                          _selectedAnimals.remove(value);
                      });

`

@Bassiuz
Copy link

Bassiuz commented Aug 12, 2022

I experience the same issue. After submitting the initial values once, you can remove them with the chip selection. Before the first submit, changing the list in the state doesn't seem to trigger the rerender.

@Bassiuz
Copy link

Bassiuz commented Aug 12, 2022

I solved the issue in a fork; it had to do with the initialItems assignment. Instead of assigning the actual list, it created a new list and added the items. This way, the initial items don't have the same list as an assignment as the initialValues in your local state. So when the list in your local state gets edited, the list that is loaded in the chips isn't changed.

#130

@HekmatBeigverdi
Copy link
Author

Thank's a lot @Bassiuz. It solves problem. I hope your fork will merged to the main branch immediately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants