-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
[FormBuilderDropdown]: <If onChanged Function is added, the FormBuilderDropdown stop working> #1252
Comments
I test the example code on web with Flutter 3.10 and works fine. Please edit minimal example code or add more details about the bug |
Same problem here. If you use a setState in onChanged, then the widget get rebuilds and it jumps to the initial value |
@deandreamatias I think the key here is that the form needs to rebuild to trigger. It probably won't happen as easily on the web, but on mobile the widget rebuilds when the input/keyboard changes, and that is pretty common on a form. If you pick something in the dropdown (keyboard goes away) and then move focus to a widget that reopens the keyboard, the selected item dissapears. |
Yes, same problem. Any update? |
same problem, will this be fixed? or any workaround? |
My workaround (which may not be the best, but seems to work) is to set the model prop value manually in onChanged, kinda like this:
|
More generally, rebuilding the widget where the
The workaround consists in keeping the |
Facing same issue while using setState to update some variables from onChanged |
Had to create a model for my form and update the model from the onChanged function |
This comment was marked as spam.
This comment was marked as spam.
Screen.Recording.2023-06-20.at.11.26.36.movVersion 9.0.0 |
Version 9.0.0 (On Android) EDIT: with this block |
Any updates on this? in Form builder 9.0 this issue is persistent. The form builder values reset to initial values on reset. For now my solution is to use Form Builder 8.0. Is it something to do with this changelog point?
|
I hope this will be fixed soon. because of this issue, we cannot update to the latest flutter version 3.10. |
You can override dependency to upgrade to latest version of flutter, I am using 3.10 with other package with overridden intl package. Anyways I hope the team solves this issue soon. |
@deandreamatias, I believe the bug originates from the I understand the reason for adding the functionality was to avoid the failed assertion where if the I think the method should be removed because of the following reasons:
|
Hello, any updates on the subject? |
Hi people! All the comments that you have added and can add, will be useful for debug. |
I think that the problem is related when use |
I opened a PR. Please if all of you can review this PR and considerations on it, I will really appreciate it. |
Is there an existing issue for this?
Package/Plugin version
9.0.0
Flutter doctor
Flutter doctor
[√] Flutter (Channel stable, 3.10.0, on Microsoft Windows [Version 10.0.22621.1702], locale es-MX)
• Flutter version 3.10.0 on channel stable at C:\Users\Carlos\flutter_sdk\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 84a1e904f4 (6 days ago), 2023-05-09 07:41:44 -0700
• Engine revision d44b5a94c9
• Dart version 3.0.0
• DevTools version 2.23.1
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at C:\Users\Carlos\AppData\Local\Android\sdk
• Platform android-33, build-tools 31.0.0
• Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.5.5)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.5.33627.172
• Windows 10 SDK version 10.0.22621.0
[√] Android Studio (version 2022.2)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
[√] VS Code (version 1.78.2)
• VS Code at C:\Users\Carlos\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.64.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22621.1702]
• Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.93
• Edge (web) • edge • web-javascript • Microsoft Edge 113.0.1774.42
[√] Network resources
• All expected network resources are available.
• No issues found!
Minimal code example
Code sample
Current Behavior
If I add setState inside of onChanged the FormBuilderDropdown is not working correctly:
If I select an option:
Then nothing is selected:
On previous version it was working once I update to 9.0.0 it stop to works.
Expected Behavior
If I select an option
For example:
Then the option is selected:
Steps To Reproduce
Aditional information
No response
The text was updated successfully, but these errors were encountered: