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

Can not change field value in form #14

Closed
ryanhz opened this issue Dec 27, 2018 · 5 comments
Closed

Can not change field value in form #14

ryanhz opened this issue Dec 27, 2018 · 5 comments

Comments

@ryanhz
Copy link

ryanhz commented Dec 27, 2018

There is no way to change the field value once they are created, I have create a form with fields initially, then some user interaction will change the status, but all the fields remain the same regardless that I call setState(), in the build function I can see the status data have been changed.

Looking into source code, it looks like the field control state is not recreated and is associated with the attribute as key.

@danvick
Copy link
Collaborator

danvick commented Jan 17, 2019

Noted. Working on that.
Sorry for the late response.

@ryanhz
Copy link
Author

ryanhz commented Jan 24, 2019

The field widgets are stateful widgets, so you can't change the state from the parent widget, I think a callback would serve this purpose.

@flutter-painter
Copy link

Hi @danvick,
Thanks for great package. I copied the exact example UI runs smoothly, but once I select field keyboard opens and closes instantly.
Only difference is that there is no Myapp extends StatelessWidget on top to pass the new MyHomePage()
Could this be the cause ?
Attached is a .dart example
add_store_view.dart.zip

@danvick
Copy link
Collaborator

danvick commented Apr 24, 2019

Hello @926,
Yes. Kindly use a StatefulWidget.

This is a known issue with stateless widget but I haven't given it much priority since in most cases the form is used within a stateful widget in order to collect data after submission.

Thanks for your contribution, I'll find time to look into it.

@flutter-painter
Copy link

@danvick thank but it is already in a StatefulWidget.
Please look at screenshot below
Would a video be of any help ?
Screen Shot 2019-04-24 at 12 29 38

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