0
0
Fluttermobile~5 mins

IconButton in Flutter - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
AonTap
BonPressed
Cicon
Dchild
What type of widget is usually passed to the icon property of IconButton?
AImage
BText
CContainer
DIcon
If onPressed is set to null, what is the behavior of the IconButton?
AButton is disabled and not clickable
BButton is enabled and clickable
CButton shows a loading spinner
DButton changes color on tap
How do you increase the size of the icon inside an IconButton?
ASet <code>iconSize</code> property
BWrap icon in a <code>SizedBox</code>
CSet <code>size</code> property on <code>IconButton</code>
DUse <code>fontSize</code> property
Which widget would you use to create a tappable icon button in Flutter?
ATextButton
BFlatButton
CIconButton
DGestureDetector
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.