Dropdown

226 views
Skip to first unread message

testuser...@gmail.com

unread,
Feb 15, 2019, 4:02:48 AM2/15/19
to Flutter Dev
How to populate from one dropdown  to other dropdown based on selected data from first dropdown.


For example Country, state and city.
 Instance 1 - If I select some state in second dropdown then it should show only cities belong to that particular state.
 Instance 2 - In state if i select NewDelhi then the third dropdown should be invisible.

Jagannathan Srinivasan

unread,
Feb 15, 2019, 5:23:44 AM2/15/19
to testuser...@gmail.com, Flutter Dev
This needs a slightly more elaborate answer. 

Typically you can go like this.

Let's say Countries are stored in a list and used in the first dropdown and States for a country is typically got from a filtered list (that gives States for a country) and this is to be used in the second dropdown. Country dropdown will have the value of the country field and the State dropdown will have the value of the state field.

Implement the onChanged event for the first dropdown that will take the current value in Countries and then build out the list for the State dropdown based on Country selected.

Hope you get the idea. 

For more auto-complete like dropdowns, check out my widget on dart pub at https://pub.dartlang.org/packages/dropdownfield

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages