DropdownButton is a widget that lets users select a value from a list of items. DropdownButton shows the currently selected item, as well as a small triangle that opens a list for selecting another item.
Here are the steps that are required to add DropdownButton to your apps:
- Create an instance of DropdownButton, specifying the type of data that will be included in the list.
- Add an items property that will contain the list of items that will be shown to the user.
- The items property requires a list of DropdownMenuItem widgets. Therefore, you need to map each value that you want to show into DropdownMenuItem.
- Respond to the user actions by specifying an event; typically, for DropdownButton, you will call ...