Source Code
AppBar(
title: Text(
'Todo App',
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 20,
),
),
backgroundColor: Colors.teal,
centerTitle: true,
elevation: 4,
actions: [
IconButton(
icon: Icon(Icons.search),
onPressed: () {
},
),
IconButton(
icon: Icon(Icons.settings),
onPressed: () {
},
),
],
)
Ai Code Analizer
🔍 Detailed Overview of AppBar with Text Title
📌 1. What is AppBar?
AppBar is a pre-built material design widget provided by Flutter. It’s commonly used within a Scaffold and appears at the top of the app screen. It typically includes:
A title (usually text),
Navigation icons (like back or menu),
Action buttons (e.g., search, settings),
Optional widgets like
bottom(for tabs).
🎨 3. Key Properties You Can Customize in AppBar
| Property | Description |
|---|---|
title | Widget displayed in the center or start of the AppBar. Often a Text. |
backgroundColor | Changes the AppBar’s background color. |
leading | Widget shown at the start (like a back button or menu). |
actions | List of widgets shown at the end (like icons or buttons). |
centerTitle | Whether to center the title (true/false). |
elevation | Shadow depth under the AppBar. |
bottom | Allows adding a TabBar or other widgets under the AppBar. |
iconTheme | Controls icon color, size, etc. |
titleTextStyle | Directly set style for the title. |
