♪ [intro music] ♪
Need to provide users
with a way to select a value from the list of options?
Try DropdownButton.
To start, give it a list of options as
DowndownMenuItems
in the drop-down menu.
Since they're all in a list together, they must all be of the same type.
Provide a state variable containing the value
of the selected drop-down menu item.
And finally, give it an
that calls
Now, technically, you can stop right there,
or you can customize the drop-down button to your heart's content.
Is that arrow too small?
Make it bigger by adjusting the icon size.
Or perhaps the default gray doesn't stand out enough?
Give it a splash of color by providing an
Don't even like the arrow?
Go ahead and replace it with a different icon.
Have the drop-down content horizontally fill its parent
by enabling
And you can even give the text a fresh coat of paint
by providing a
One thing to remember:
if either
the
The arrow will be grayed out, and it won't respond to input.
For more info on Flutter and all the other widgets,
head to
♪ [outro music] ♪