Recall & Review
beginner
What is a Checkbox widget used for in Flutter?
A Checkbox widget lets users select or deselect an option. It shows a small box that can be checked or unchecked.
Click to reveal answer
beginner
How does a Switch widget differ from a Checkbox in Flutter?
A Switch widget is a toggle button that slides between ON and OFF states, often used for settings. A Checkbox is a box that can be checked or unchecked.
Click to reveal answer
beginner
Which property controls whether a Checkbox or Switch is selected or not?
The 'value' property controls if the Checkbox or Switch is selected (true) or not (false).
Click to reveal answer
beginner
What is the purpose of the 'onChanged' callback in Checkbox and Switch widgets?
The 'onChanged' callback runs when the user taps the widget. It lets the app update the state to reflect the new selection.
Click to reveal answer
intermediate
How can you make a Checkbox or Switch disabled in Flutter?
Set the 'onChanged' property to null. This disables the widget and prevents user interaction.
Click to reveal answer
What type of value does the 'value' property of a Checkbox expect?
✗ Incorrect
The 'value' property expects a boolean to indicate if the Checkbox is checked (true) or unchecked (false).
Which widget would you use to let users toggle a setting ON or OFF with a sliding button?
✗ Incorrect
The Switch widget provides a sliding toggle button for ON/OFF states.
How do you disable a Checkbox so the user cannot change its state?
✗ Incorrect
Setting 'onChanged' to null disables the Checkbox and prevents user interaction.
What happens when the user taps a Checkbox with a valid 'onChanged' callback?
✗ Incorrect
Tapping toggles the Checkbox and triggers the 'onChanged' callback to update the app state.
Which property do you use to listen for changes in a Switch widget?
✗ Incorrect
The 'onChanged' property listens for user toggles on the Switch widget.
Explain how to create a Checkbox in Flutter that updates its state when tapped.
Think about how the Checkbox knows if it is checked and how to update that.
You got /4 concepts.
Describe the differences and typical uses of Checkbox and Switch widgets in Flutter.
Consider how users interact with each and what UI they expect.
You got /4 concepts.