0
0
Fluttermobile~20 mins

Widget tree concept in Flutter - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Widget Tree Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
2:00remaining
Understanding Widget Tree Rendering
Given the Flutter widget tree below, what will be the color of the text displayed on the screen?
Flutter
MaterialApp(
  home: Scaffold(
    body: Container(
      color: Colors.blue,
      child: Center(
        child: Text('Hello', style: TextStyle(color: Colors.white)),
      ),
    ),
  ),
)
AThe text will be black on a white background.
BThe text will be black on a blue background.
CThe text will be white on a blue background.
DThe text will be white on a white background.
Attempts:
2 left
💡 Hint
Look at the Container's color and the TextStyle color.
navigation
intermediate
2:00remaining
Widget Tree and Navigation Stack
In a Flutter app, if you push a new route onto the Navigator stack, how does it affect the widget tree?
AA new widget subtree is added on top of the existing widget tree representing the new route.
BThe entire widget tree is replaced by the new route's widget tree.
CThe widget tree remains unchanged; only the state changes.
DThe previous route's widgets are removed from the tree immediately.
Attempts:
2 left
💡 Hint
Think about how Flutter shows new screens without losing the old ones.
lifecycle
advanced
2:00remaining
Widget Tree and State Lifecycle
Which lifecycle method is called when a StatefulWidget is removed from the widget tree permanently?
Abuild()
BinitState()
CdidUpdateWidget()
Ddispose()
Attempts:
2 left
💡 Hint
This method is used to clean up resources.
📝 Syntax
advanced
2:00remaining
Correct Widget Tree Syntax
Which of the following Flutter widget trees is syntactically correct?
AColumn(child: [Text('A'), Text('B')])
BColumn(children: [Text('A'), Text('B')])
CColumn(children: Text('A'), Text('B'))
DColumn(children = [Text('A'), Text('B')])
Attempts:
2 left
💡 Hint
Check the property name and value types for Column.
🔧 Debug
expert
2:00remaining
Diagnosing Widget Tree Build Errors
You have this widget tree snippet: Container( child: Text('Hello'), color: Colors.red, child: Icon(Icons.star), ) What error will this cause?
AA syntax error because 'child' is specified twice in Container.
BThe Container will show both Text and Icon widgets stacked.
CThe Container will only show the Text widget, ignoring the Icon.
DThe Container will only show the Icon widget, ignoring the Text.
Attempts:
2 left
💡 Hint
Check the Container properties carefully.