Recall & Review
beginner
What is a
DropdownButton in Flutter?A
DropdownButton is a widget that shows a list of options when tapped, allowing the user to select one option from the list.Click to reveal answer
beginner
How do you provide the list of options to a
DropdownButton?You provide a list of
DropdownMenuItem widgets to the items property of the DropdownButton. Each item represents one selectable option.Click to reveal answer
beginner
What property of
DropdownButton holds the currently selected value?The
value property holds the currently selected item from the list of options.Click to reveal answer
beginner
How do you update the selected value when the user picks a new option?
You use the
onChanged callback, which receives the new selected value. Inside it, you update the state to reflect the new selection.Click to reveal answer
beginner
Why should you use
DropdownMenuItem widgets inside DropdownButton?Because
DropdownMenuItem defines each option's value and how it looks in the dropdown list, making the dropdown interactive and meaningful.Click to reveal answer
Which property of
DropdownButton sets the list of selectable options?✗ Incorrect
The
items property takes a list of DropdownMenuItem widgets that define the options.What type of widget is used to represent each option inside a
DropdownButton?✗ Incorrect
Each option is a
DropdownMenuItem widget.How do you detect when the user selects a new option in a
DropdownButton?✗ Incorrect
The
onChanged callback is called with the new value when the user selects an option.What happens if the
value property of DropdownButton is null?✗ Incorrect
If
value is null, no item is selected initially.Which of these is NOT a required property for a basic
DropdownButton?✗ Incorrect
The
icon property is optional and controls the dropdown arrow icon.Explain how to create a simple dropdown menu in Flutter using
DropdownButton.Think about how you show options, track the selected one, and respond to user taps.
You got /5 concepts.
Describe the role of the
onChanged callback in a DropdownButton.It is how your app knows the user picked a different option.
You got /4 concepts.