Which widget provides basic screen structure with AppBar support?
Scaffold provides the basic Material Design visual layout: AppBar at the top, body content, floating action button, drawer, etc.
Build your first Flutter screen step by step
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
Now it is time to build something real. In this lesson, we will create a profile card step by step and learn essential widgets along the way.
Every Flutter app starts with this basic structure. The MaterialApp widget wraps your entire app, and the Scaffold provides a screen layout with an AppBar at the top and a body area for your content.
1import 'package:flutter/material.dart';23void main() {4runApp(MyApp()); // Start the app5}67class MyApp extends StatelessWidget {8@override9Widget build(BuildContext context) {10return MaterialApp( // Root widget11home: Scaffold( // Screen structure12appBar: AppBar(13title: Text('My First App'),14),15body: Center( // Center the content16child: Text('Hello World!'),17),18),19);20}21}
| Widget | What It Does | Analogy |
|---|---|---|
| MaterialApp | Wraps your app with Material Design theme | The app container |
| Scaffold | Provides screen structure with AppBar and body | The page skeleton |
| AppBar | Top navigation bar with title | The header |
| Center | Centers its child widget on screen | A centering wrapper |
| Text | Displays text on screen | A text label |
Think of widgets as Lego blocks. You snap them together to build your UI. Each widget handles one thing well. Text shows text, Center centers things, and Column stacks things vertically. By combining these simple widgets, you can build complex and beautiful interfaces.
Flutter uses the TextStyle class to customize how text looks. You can control the font size, weight, color, spacing, and more.
1// Plain text2Text('Hello')34// Styled text5Text(6'Hello Flutter!',7style: TextStyle(8fontSize: 28, // Size in logical pixels9fontWeight: FontWeight.bold, // Bold text10color: Colors.blue, // Text color11letterSpacing: 1.5, // Space between letters12),13)1415// Common TextStyle properties:16// fontSize, fontWeight, color, fontStyle (italic),17// letterSpacing, wordSpacing, decoration (underline)
Use Column to stack widgets vertically and Row to place them horizontally. These are the two most common layout widgets in Flutter.
1// Column: Stack children vertically2Column(3mainAxisAlignment: MainAxisAlignment.center,4children: [5Text('Line 1'),6Text('Line 2'),7Text('Line 3'),8],9)1011// Row: Place children horizontally12Row(13mainAxisAlignment: MainAxisAlignment.spaceEvenly,14children: [15Icon(Icons.star),16Icon(Icons.star),17Icon(Icons.star),18],19)2021// SizedBox: Add spacing between widgets22Column(23children: [24Text('Name'),25SizedBox(height: 10), // 10px vertical space26Text('Title'),27],28)
Now let us combine everything we have learned into a real UI. This profile card uses Container for styling, Column for vertical layout, Row for the stats, and CircleAvatar for the profile picture.
1import 'package:flutter/material.dart';23void main() => runApp(MyApp());45class MyApp extends StatelessWidget {6@override7Widget build(BuildContext context) {8return MaterialApp(9home: Scaffold(10backgroundColor: Colors.grey[200],11appBar: AppBar(12title: Text('Profile'),13backgroundColor: Colors.blue,14),15body: Center(16child: Container(17padding: EdgeInsets.all(24),18margin: EdgeInsets.all(16),19decoration: BoxDecoration(20color: Colors.white,21borderRadius: BorderRadius.circular(16),22boxShadow: [23BoxShadow(24color: Colors.black.withOpacity(0.1),25blurRadius: 10,26offset: Offset(0, 4),27),28],29),30child: Column(31mainAxisSize: MainAxisSize.min, // Shrink to fit content32children: [33// Profile avatar34CircleAvatar(35radius: 50,36backgroundColor: Colors.blue,37child: Text(38'JD',39style: TextStyle(40fontSize: 32,41color: Colors.white,42fontWeight: FontWeight.bold,43),44),45),46SizedBox(height: 16),4748// Name49Text(50'John Doe',51style: TextStyle(52fontSize: 24,53fontWeight: FontWeight.bold,54),55),56SizedBox(height: 4),5758// Title59Text(60'Flutter Developer',61style: TextStyle(62fontSize: 16,63color: Colors.grey[600],64),65),66SizedBox(height: 16),6768// Stats Row69Row(70mainAxisAlignment: MainAxisAlignment.spaceEvenly,71children: [72_buildStat('Posts', '42'),73_buildStat('Followers', '1.2K'),74_buildStat('Following', '180'),75],76),77],78),79),80),81),82);83}8485// Helper method for stats86Widget _buildStat(String label, String value) {87return Column(88children: [89Text(90value,91style: TextStyle(92fontSize: 18,93fontWeight: FontWeight.bold,94),95),96Text(97label,98style: TextStyle(99fontSize: 12,100color: Colors.grey,101),102),103],104);105}106}
| Widget | Purpose |
|---|---|
| Container | A box with padding, margin, and decoration like shadow, border, and color |
| Column | Stacks children vertically from top to bottom |
| Row | Places children side by side horizontally |
| CircleAvatar | Displays a circular profile image or initials |
| SizedBox | Adds spacing between widgets |
| BoxDecoration | Styles a Container with color, shadow, and border radius |
| EdgeInsets | Defines padding and margin values |
These are some of the most commonly used widgets in Flutter. You will use them in almost every app you build.
Try modifying the profile card yourself. Change the name, try different colors, add more stats, or experiment with different MainAxisAlignment values like start, end, and spaceBetween. The best way to learn Flutter is by experimenting with the code.
To move from tutorial code to app-building skill, evolve this profile card into a tiny product feature:
This is how real learning happens: start from a simple UI, then layer practical requirements step by step.
Do not only change colors and text. Add behavior and structure changes too. Real Flutter skill comes from handling layout, state, and edge cases together.
Build your first Flutter screen step by step. This lesson adds one more building block for creating stable and user-friendly Flutter apps.
Build confidence with basics first; speed comes later.
After reading, rewrite the concept in your own words and apply it in a tiny runnable sample.
Each lesson becomes useful when you connect concept, implementation, and real-user outcome together.
Scaffold provides the basic Material Design visual layout: AppBar at the top, body content, floating action button, drawer, etc.
Column arranges its children vertically (top to bottom). Row arranges them horizontally (left to right).
SizedBox is commonly used as a spacer between widgets. height: 16 creates a 16 logical pixel tall gap.
Center widget centers its child both horizontally and vertically within the available space.
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