0
0
Fluttermobile~10 mins

SizedBox and Padding in Flutter - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a fixed space of 20 pixels height between widgets using SizedBox.

Flutter
SizedBox(height: [1]),
Drag options to blanks, or click blank then click option'
A0
B50
C10
D20
Attempts:
3 left
💡 Hint
Common Mistakes
Using width instead of height for vertical space.
Setting height to 0 which creates no space.
2fill in blank
medium

Complete the code to add 16 pixels padding on all sides around a Text widget.

Flutter
Padding(padding: EdgeInsets.all([1]), child: Text('Hello')),
Drag options to blanks, or click blank then click option'
A8
B24
C16
D32
Attempts:
3 left
💡 Hint
Common Mistakes
Using EdgeInsets.symmetric instead of EdgeInsets.all for equal padding.
Using too small or too large padding values.
3fill in blank
hard

Fix the error in the code to create horizontal space of 30 pixels using SizedBox.

Flutter
SizedBox(width: [1]),
Drag options to blanks, or click blank then click option'
A30
B'30'
C30.0
Dnull
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around numbers causing type errors.
Passing null which causes runtime errors.
4fill in blank
hard

Fill both blanks to add vertical padding of 10 and horizontal padding of 20 around a Container.

Flutter
Padding(padding: EdgeInsets.symmetric(vertical: [1], horizontal: [2]), child: Container()),
Drag options to blanks, or click blank then click option'
A10
B15
C20
D25
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping vertical and horizontal values.
Using EdgeInsets.all instead of symmetric for different padding.
5fill in blank
hard

Fill all three blanks to create a SizedBox with width 100, height 50, and a child Text widget.

Flutter
SizedBox(width: [1], height: [2], child: Text('[3]')),
Drag options to blanks, or click blank then click option'
A100
B50
CHello
DWorld
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numbers inside quotes.
Using wrong text string or missing quotes around text.