0
0
Fluttermobile~5 mins

SizedBox and Padding in Flutter - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the SizedBox widget in Flutter?
The SizedBox widget is used to create a box with a fixed width and height. It can add empty space or force a widget to have a specific size.
Click to reveal answer
beginner
How does the Padding widget affect its child widget?
The Padding widget adds empty space around its child inside the parent widget, pushing the child inward by the specified padding values.
Click to reveal answer
beginner
Which property of SizedBox controls its width and height?
The width and height properties control the size of the SizedBox. You can set either or both to fix the size.
Click to reveal answer
beginner
Can Padding be used without a child widget?
No, Padding requires a child widget to apply padding around. Without a child, it has no visible effect.
Click to reveal answer
intermediate
What is the difference between SizedBox and Padding?
SizedBox sets a fixed size or empty space, while Padding adds space inside around a child widget. SizedBox controls size, Padding controls space inside.
Click to reveal answer
What happens if you use SizedBox(width: 50, height: 50) without a child widget?
ACreates an empty box of 50x50 pixels
BThrows an error
CCreates a box that fills the screen
DIgnores the size and collapses
Which widget would you use to add space inside a button around its label?
ASizedBox
BPadding
CContainer
DExpanded
If you want to add 10 pixels of space between two widgets vertically, which widget can you use?
ASizedBox with height: 10
BPadding with EdgeInsets.all(10)
CContainer with margin 10
DExpanded with flex 10
What does Padding(padding: EdgeInsets.symmetric(horizontal: 20)) do?
AAdds 20 pixels padding on all sides
BAdds 20 pixels padding on top and bottom
CAdds no padding
DAdds 20 pixels padding on left and right sides
Which widget can force a child widget to have a fixed size?
APadding
BFlexible
CSizedBox
DAlign
Explain how you would use SizedBox and Padding together to create space around a button.
Think about space outside the button and space inside the button label.
You got /3 concepts.
    Describe the visual difference between using SizedBox and Padding in a Flutter layout.
    Consider how each affects the child's size and position.
    You got /3 concepts.