0
0
Fluttermobile~20 mins

Wrap widget in Flutter - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Wrap Widget Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
2:00remaining
How does the Wrap widget arrange children?
Given a Wrap widget with several children that exceed the screen width, how does it arrange these children?
AIt arranges children horizontally and wraps them to the next line when space runs out.
BIt places children in a single horizontal line and clips the overflow.
CIt stacks all children vertically without wrapping.
DIt arranges children randomly on the screen.
Attempts:
2 left
💡 Hint
Think about how text wraps in a paragraph when it reaches the edge.
📝 Syntax
intermediate
2:00remaining
Identify the correct Wrap widget syntax
Which of the following Flutter code snippets correctly creates a Wrap widget with three Text children?
AWrap(children: {Text('One'), Text('Two'), Text('Three')})
BWrap(children: [Text('One'), Text('Two'), Text('Three')])
CWrap(children: Text('One'), Text('Two'), Text('Three'))
DWrap(child: [Text('One'), Text('Two'), Text('Three')])
Attempts:
2 left
💡 Hint
Remember the children property expects a list of widgets.
ui_behavior
advanced
2:00remaining
What is the effect of changing the spacing property in Wrap?
If you set spacing: 20.0 in a Wrap widget, what will happen?
AChildren will have 20 pixels of horizontal space between them.
BChildren will overlap by 20 pixels horizontally.
CChildren will have 20 pixels of padding inside each child.
DChildren will have 20 pixels of vertical space between them.
Attempts:
2 left
💡 Hint
Spacing controls the gap between items in the main axis direction.
lifecycle
advanced
2:00remaining
How does Wrap widget behave on screen rotation?
When the device rotates from portrait to landscape, how does the Wrap widget adjust its children layout?
AIt hides children that don't fit in the new width.
BIt keeps the same layout ignoring the new width.
CIt throws a runtime error due to layout constraints.
DIt recalculates and wraps children according to the new width.
Attempts:
2 left
💡 Hint
Think about how responsive layouts adapt to screen size changes.
🔧 Debug
expert
2:00remaining
Why does this Wrap widget cause overflow error?
Consider this code snippet: Wrap( direction: Axis.vertical, children: [ Container(width: 100, height: 100, color: Colors.red), Container(width: 100, height: 100, color: Colors.blue), Container(width: 100, height: 100, color: Colors.green), ], ) Why might this cause an overflow error on a small screen?
ABecause Container widgets must have flexible width and height inside Wrap.
BBecause Wrap only supports horizontal direction and vertical direction causes errors.
CBecause Wrap with vertical direction tries to arrange children in columns and may overflow vertically if height is limited.
DBecause colors in Container cause layout overflow.
Attempts:
2 left
💡 Hint
Think about how vertical Wrap arranges children and screen height limits.