Recall & Review
beginner
What is the purpose of the
IconButton widget in Flutter?The
IconButton widget creates a clickable button that displays an icon. It is used to add interactive icons that respond to user taps.Click to reveal answer
beginner
Which property of
IconButton defines the icon shown inside the button?The
icon property defines the icon widget displayed inside the IconButton. Usually, it is an Icon widget.Click to reveal answer
beginner
How do you handle a tap event on an
IconButton?You provide a function to the
onPressed property. This function runs when the user taps the button.Click to reveal answer
intermediate
What happens if you set
onPressed to null in an IconButton?The button becomes disabled. It shows a faded icon and does not respond to taps.
Click to reveal answer
intermediate
How can you change the size and color of the icon inside an
IconButton?You can set the
iconSize property to change the icon size, and set the color property inside the Icon widget to change its color.Click to reveal answer
Which property must you provide to make an
IconButton respond to taps?✗ Incorrect
The
onPressed property is the callback function triggered when the button is tapped.What type of widget is usually passed to the
icon property of IconButton?✗ Incorrect
The
icon property typically takes an Icon widget to display a material design icon.If
onPressed is set to null, what is the behavior of the IconButton?✗ Incorrect
Setting
onPressed to null disables the button, making it unclickable and visually faded.How do you increase the size of the icon inside an
IconButton?✗ Incorrect
The
iconSize property directly controls the size of the icon inside the IconButton.Which widget would you use to create a tappable icon button in Flutter?
✗ Incorrect
IconButton is designed specifically for clickable icons.Explain how to create an
IconButton that prints a message when tapped.Remember to use the <code>onPressed</code> property to handle taps.
You got /3 concepts.
Describe how to disable an
IconButton and how it looks when disabled.Think about what happens when <code>onPressed</code> is null.
You got /3 concepts.