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

Set State not working with MultiSelectBottomSheetField #83

Open
Matthew-828 opened this issue Jan 11, 2022 · 4 comments
Open

Set State not working with MultiSelectBottomSheetField #83

Matthew-828 opened this issue Jan 11, 2022 · 4 comments

Comments

@Matthew-828
Copy link

Hi, I'm using MultiSelectBottomSheetField with other widgets that need setState like CheckboxListTile and Radio. When pressing the Radio button or checkBox ( or anything that is with setState ), it removes all the displaying item in the MultiSelectBottomSheetField. The variable still have the selected values but display all gone.

@CHB61
Copy link
Owner

CHB61 commented Jan 11, 2022

Hello,

I did try to reproduce this, but I'm not having the same problem. Can you provide a code example that reproduces the issue?

@Matthew-828
Copy link
Author

Hi Below is my code:

Under the stateful widget I declared the folowing variable.
image

Inside my Stateful widget -> body -> Form, I have a Future builder where future is "_getGroup", the variable declared in the first image to get API data. If snapshot has data, I convert the json data into list so that I can map it to MultiSelectItem. Then I do the MultiSelectBottomSheet as usual.
image

For your information, the ReportInfo class is as follows:
image

and this is how I get the _list
image

When I select the data, it looks like this:
image

but when I click on Radio / CheckBoxListTile, the chipDisplay is gone

@GabrielLana
Copy link

I'm facing the same error when I use filtering search, it returns me setState error and clear all my selection.

@Muhammad-FlutterDev
Copy link

Add the parameter key: GlobalKey() to your MultiSelectBottomSheetField and the setState will work

Source: #12 (comment)

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

4 participants