Flutter AppBar Customization: A Comprehensive Guide
The AppBar is one of the most commonly used components in Flutter apps. It provides a flexible way to display essential elements like titles, icons, and action buttons at the top of the screen. However, many developers don’t take full advantage of the customization options that Flutter’s AppBar
widget offers. In this blog, we’ll explore how to customize the AppBar widget to fit your app’s unique style and functionality.

Table of Contents
- What is an AppBar in Flutter?
- Customizing the AppBar Title
- Changing Font, Color, and Alignment
- Adding Logos or Images
- Customizing the AppBar Background
- Setting a Solid Color
- Adding a Gradient Background
- Using an Image Background
- Adding Custom Widgets to the AppBar
- Left-Aligned Widgets
- Right-Aligned Action Buttons
- Custom Widgets in the Center
- Creating a Transparent or Floating AppBar
- Collapsing AppBar with Slivers
- Conclusion
1. What is an AppBar in Flutter?
In Flutter, the AppBar
is a material design widget that appears at the top of the screen and serves as a toolbar with commonly used elements like titles, icons, and action buttons. You usually define it within a Scaffold
widget, which provides the basic visual structure of an app.
Here’s a basic example of an AppBar:
Scaffold(
appBar: AppBar(
title: Text('My Flutter App'),
backgroundColor: Colors.blue,
),
body: Center(child: Text('Hello World')),
);
In this example, the AppBar has a title and a simple background color. But there’s much more you can do with it!
2. Customizing the AppBar Title
The title is usually the most prominent element of the AppBar, and Flutter allows you to customize it extensively.
Changing Font, Color, and Alignment
To change the style of the title, you can wrap the Text
widget in a TextStyle
widget to adjust properties like font family, size, and color.
AppBar(
title: Text(
'Custom AppBar',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontWeight: FontWeight.bold,
fontFamily: 'Roboto',
),
),
centerTitle: true, // Align title to center
),
Here, we’ve changed the font size, color, and alignment of the AppBar’s title.
Adding Logos or Images
If you want to display a logo or an image instead of a text title, you can replace the Text
widget with an Image
widget.
AppBar(
title: Image.asset(
'assets/logo.png',
height: 50.0,
),
centerTitle: true,
),
This code replaces the text with a custom logo, adding a more professional and brand-specific feel to the AppBar.
3. Customizing the AppBar Background
The background of an AppBar can be customized to make it stand out and match the theme of your app. Flutter allows you to apply solid colors, gradients, or even images as backgrounds.
Setting a Solid Color
You can easily set a solid color for the AppBar background using the backgroundColor
property.
AppBar(
backgroundColor: Colors.deepPurple,
title: Text('Solid Color AppBar'),
),
Adding a Gradient Background
To apply a gradient background, you’ll need to use a Container
as the background of the AppBar by setting the flexibleSpace
property.
AppBar(
title: Text('Gradient AppBar'),
flexibleSpace: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.purple, Colors.blue],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
),
),
Here, we’ve applied a linear gradient that transitions from purple to blue.
Using an Image Background
You can also use an image as the background for your AppBar by applying the Image
widget inside a Container
.
AppBar(
title: Text('Image Background AppBar'),
flexibleSpace: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/appbar_bg.jpg'),
fit: BoxFit.cover,
),
),
),
),
This code will use the provided image as the background for the AppBar, making it look unique and visually appealing.
4. Adding Custom Widgets to the AppBar
Flutter’s AppBar is not just limited to the title and a few action buttons. You can add custom widgets to both the left and right sides of the AppBar and even in the center.
Left-Aligned Widgets
To add a widget to the left side of the AppBar (e.g., a back button or a menu icon), you use the leading
property. Here’s how to add a custom icon:
AppBar(
leading: IconButton(
icon: Icon(Icons.menu),
onPressed: () {
// Handle menu button press
},
),
title: Text('AppBar with Leading Icon'),
),
The leading
widget is typically used for a back button or a drawer icon but can be customized to hold any widget.
Right-Aligned Action Buttons
To add custom widgets to the right side of the AppBar, you can use the actions
property, which accepts a list of widgets (usually icons or buttons).
AppBar(
title: Text('AppBar with Actions'),
actions: [
IconButton(
icon: Icon(Icons.search),
onPressed: () {
// Handle search action
},
),
IconButton(
icon: Icon(Icons.more_vert),
onPressed: () {
// Handle more action
},
),
],
),
This code adds a search button and a more button to the right side of the AppBar.
Custom Widgets in the Center
You can even add a custom widget to the center of the AppBar, such as a search bar or a dropdown menu. Simply replace the title
property with any widget you like.
AppBar(
title: TextField(
decoration: InputDecoration(
hintText: 'Search...',
hintStyle: TextStyle(color: Colors.white),
border: InputBorder.none,
),
),
),
This example replaces the AppBar title with a search bar, allowing users to input text directly in the AppBar.
5. Creating a Transparent or Floating AppBar
Transparent AppBar
To create a transparent AppBar, you can set the backgroundColor
property to transparent and remove any elevation.
AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
title: Text('Transparent AppBar'),
),
This will make the AppBar blend seamlessly with the background of the page.
Floating AppBar
If you want the AppBar to float over the content, you can use a SliverAppBar
inside a CustomScrollView
. This creates a floating effect when scrolling.
CustomScrollView(
slivers: [
SliverAppBar(
floating: true,
title: Text('Floating AppBar'),
backgroundColor: Colors.teal,
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) => ListTile(title: Text('Item $index')),
),
),
],
),
This code allows the AppBar to float over the content, appearing when the user scrolls up.
6. Collapsing AppBar with Slivers
Flutter offers SliverAppBar
, which provides more advanced AppBar customization. It can shrink, expand, or collapse when the user scrolls, creating a dynamic user experience.
CustomScrollView(
slivers: [
SliverAppBar(
expandedHeight: 200.0,
floating: false,
pinned: true,
flexibleSpace: FlexibleSpaceBar(
title: Text('Collapsing AppBar'),
background: Image.asset(
'assets/collapsing_bg.jpg',
fit: BoxFit.cover,
),
),
),
SliverList(
delegate: SliverChildListDelegate(
List.generate(20, (index) => ListTile(title: Text('Item $index'))),
),
),
],
),
This example uses a SliverAppBar
that collapses as the user scrolls, with an image in the background.
7. Conclusion
Customizing Flutter’s AppBar widget allows you to create unique and visually appealing headers that align with your app’s design. From changing the title’s appearance and background to adding custom widgets and creating advanced effects like transparency and collapsing behavior, Flutter offers endless possibilities to style your AppBar.
By leveraging these customization options, you can enhance the overall look and feel of your app, providing a richer user experience. Whether you’re working with simple or complex designs, Flutter’s AppBar widget gives you the flexibility and control you need.


Explore Other Flutter Topics…
- Introduction to Flutter and Dart
- Why choose Flutter
- Installing Flutter On Your Windows Mac And Linux System
- Your first Flutter app
- Flutter project structure
- Building blocks of Flutter
- Stateful vs. Stateless Widgets Explained
- Flutter layout system
- Flutter text widget
- Creating Buttons in Flutter: ElevatedButton, TextButton, and IconButton
- Handling User Input with Flutter Forms
- Container class in Flutter
- Flutter Navigation
- Flutter – Pass Data One Screen To Another Screen
- Managing Device Orientation in Flutter
- Stateful widget lifecycle in Flutter
- Future of Flutter
- Flutter Themes
- Flutter Animations
- Flutter AppBar Customization
- ListView in Flutter
- Flutter GridView
- Flutter Expanded Widget
- Flutter BottomNavigation Bar
- Floating Action Button
- Drawer Widgets in Flutter
- Form Validation in Flutter
- Flutter TextField
- Adding AdMob ads to a Flutter app
- Building Flutter Web & Desktop Applications
- What is Async and Await in Flutter
- HTTP requests in Flutter
- Parsing JSON in Flutter
- Tinder-Style Swipe Cards in Flutter
- Flutter Tic Tac Toe Game Tutorial
- Flutter Login UI Tutorial
- Flutter Card Widget Tutorial
- Flutter music player app tutorial
- Flutter introduction screens
- Shared Preferences in Flutter
- SQLite Database in Flutter
- Firebase Authentication in Flutter
- Firebase Firestore in Flutter
- Push Notifications in Flutter
- Handling File Uploads in Flutter
- Responsive Design in Flutter
- Provider in Flutter
- Riverpod in Flutter
- Flutter BLoC Pattern Tutorial