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.
Solutions I tried
- created i variable which holds true if the item selected is bank otherwise false and used it as a condition to either show the 2nd drop-down or not.
- Make the variable global but it also didn't worked.
- created a function which i called with the variable to return either drop-down or empty container but it also didn't worked.
- Created the bank selected variable in other class and access it with provider package but it also didn't worked for me.
The source code is also available at
CodePudding user response:
Thanks all someone at linkedin helped me with the solution. which is We have to wrap the AlertDialog with StatefulBuilder and have to call setState when option is selected then it will work.