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

setSaste not working #11

Open
islamailani opened this issue Jan 25, 2021 · 3 comments
Open

setSaste not working #11

islamailani opened this issue Jan 25, 2021 · 3 comments

Comments

@islamailani
Copy link

Hello,
Im tring to change a state to set e form from database something goes wrong, the form dont set.

@Ehouman09
Copy link

Hello @islamailani have you found a solution ?
I have the same issue

@EParisot
Copy link

Got this problem too, did anyone found a solution?
I tried statefullbuilders / global keys... Nothing make the form rebuild...

@EParisot
Copy link

EParisot commented Nov 11, 2024

Ok I fixed it using a StatefulBuilder with a valueKey (2 actually, the form was into an AlertDialog that needed its own StatefullBuilder, but without a key)

                      String kind = "1";

                      StatefulBuilder(
                            key: ValueKey(kind),
                            builder: (context, setStateJS) {
                              return JsonSchema(
                                  formMap: form,
                                  onChanged: (dynamic response) {
                                      setStateJS(() {
                                          // get the 'newValue' correct key/value pair from response
                                          kind = newValue;
                                      });
                                  }
                                

Just pass form to formMap or form attribute and update form variable (key) into setStateJS((){form = { .... }})

In my usecase, I needed to update the whole form after user changed a form's Select value (it selects the kind of form...)

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

3 participants