What does setState() trigger?
setState() marks the widget as dirty, causing only that subtree to rebuild.
Understand how Flutter builds UIs
Passing the Quiz & Exercises is mandatory to earn FX and proceed. If you fail, try again to gain the required FX, then the Proceed button will become available.
You can read this lesson publicly. Sign in to unlock exercises, quiz, and FX progress tracking.
Having trouble? AI is here to help
Ask context-aware questions about this lesson. Free plan: 5 questions/day. Upgrade to Premium for higher daily limits.
Use the AI button at the bottom of the screen
In Flutter, everything is a widget, and widgets are organized into a tree structure. Each widget sits inside a parent widget, and together they form a hierarchy that defines your entire user interface.
1MaterialApp // Root2└── Scaffold // Screen structure3├── AppBar // Top bar4│ └── Text // Title5└── Column // Body layout6├── Text // Heading7├── SizedBox // Spacing8└── ElevatedButton // Action9└── Text // Button label
Flutter uses three internal trees to manage what appears on screen:
When you call setState(), Flutter:
Widgets are lightweight and inexpensive to create. Flutter creates thousands of widget objects efficiently during every frame. Do not try to optimize by combining widgets into fewer, larger ones.
Parent widgets control:
Child widgets:
1// Parent provides constraints2Container(3width: 200, // Child cannot be wider than 2004height: 200, // Child cannot be taller than 2005child: Container(6width: 300, // Will be constrained to 200!7height: 300, // Will be constrained to 200!8color: Colors.blue,9),10)
When creating any screen, first sketch the tree:
This tree-first workflow helps you avoid deeply tangled layouts and makes refactoring much easier later.
Understand how Flutter builds UIs. Widgets are reusable UI blocks. You combine them like LEGO pieces to build screens.
Build confidence with basics first; speed comes later.
Sketch the widget tree first, then code from top to bottom.
Most Flutter productivity comes from understanding layout rules and composing widgets cleanly.
setState() marks the widget as dirty, causing only that subtree to rebuild.
Parents pass constraints to children, limiting their size.
You write widgets (configuration). Flutter creates Element Tree and RenderObject Tree internally.
Flutter widgets are lightweight configuration objects. Creating many widgets is normal and efficient.
Something seems incorrect, unclear, or missing? Let us know.
FlutterCraft editorial lessons are reviewed by experienced Flutter developers and updated to stay aligned with modern Flutter and Dart best practices.
Reference docs: Flutter Documentation, Dart Language Tour, and official package documentation where relevant.
Sign in to continue with exercises and quiz for this lesson.
Sign In to Continue