[英]How to change the Form according to the item selected in the drop Down menu in Flutter
I have created I method which is showing a dialog and I called it with timer.run()
method in order to show the dialog at the start of the screen automatically in which i have created a form (the code snippet is attached in the photos) and the form contains drop-down menu with two items(check and bank) now i want to make the UI as dynamic whenever the user selects the Bank option in the drop-down menu a new drop-down menu is displayed to him otherwise an empty container will be displayed to him.我创建了显示对话框的方法,并使用
timer.run()
方法调用它,以便在屏幕开头自动显示对话框,我在其中创建了一个表单(代码片段附在照片中) 并且表单包含带有两个项目(支票和银行)的下拉菜单将向他显示一个空容器。
Solutions I tried我尝试过的解决方案
The source code is also available at Github-Repo源代码也可以在Github-Repo上找到
Thanks all someone at linkedin helped me with the solution.感谢 linkedin 的所有人帮助我解决了这个问题。 which is We have to wrap the AlertDialog with StatefulBuilder and have to call setState when option is selected then it will work.
这是我们必须用 StatefulBuilder 包装 AlertDialog 并且必须在选择选项时调用 setState 然后它将起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.