Change system bar brightness

Flutter tips Published on

Did you know you can control how your app's status bar looks? That's the bar at the top of your screen that shows the time, battery, and notifications.

Sometimes, you might want the status bar icons (like the time) to be light or dark depending on your app's background or theme. Flutter makes this possible.

How to Change the Status Bar Look

You use the SystemChrome.setSystemUIOverlayStyle function. This function takes a SystemUiOverlayStyle object where you can set different properties.

SystemChrome.setSystemUIOverlayStyle(
  SystemUiOverlayStyle(
    statusBarColor: Colors.transparent,
    statusBarBrightness: mode == ThemeMode.light ? Brightness.light : Brightness.dark, // Only Android
    statusBarIconBrightness: mode == ThemeMode.light ? Brightness.dark : Brightness.light, // Only iOS (inverted) & Android
  ),
);

Let's break down the important parts:

statusBarColor

This sets the color of the status bar itself. Setting it to Colors.transparent is common if you want your app's content to go behind it.

statusBarBrightness

This property affects the overall brightness of the status bar background. It's typically used on Android to tell the system whether the background behind the status bar is light or dark, so the icons can be automatically adjusted. This setting works only on Android.

statusBarIconBrightness

This property controls the color of the icons and text in the status bar. You can set it to Brightness.light for light icons or Brightness.dark for dark icons.

Platform Differences

Notice the code uses a check (mode == ThemeMode.light) to set different icon colors based on whether the app is in light or dark mode.

Important Tip for iOS

Sometimes, the status bar might be hidden when your app starts on iOS. To make sure it appears and respects your style settings, you might need to change a setting in your Xcode project.

Find the Info.plist file and make sure the property View controller-based status bar appearance is set to NO.

Save 3 months of work

Create your app using our 6 years of making Flutter apps and more than 50+ apps

kickstarter for flutter apps

Frequently Asked Questions

What is the system bar?

The system bar (or status bar) is the area at the top of your phone screen that shows information like the time, battery level, and network signal.

How do I change the color of the icons in the status bar?

You can change the icon color (light or dark) using the `statusBarIconBrightness` property within `SystemUiOverlayStyle`.

What is the difference between `statusBarBrightness` and `statusBarIconBrightness`?

`statusBarBrightness` is more of a hint to the system (mainly Android) about the bar's background, helping it choose icon colors. `statusBarIconBrightness` directly sets the color of the icons themselves, used on both Android and iOS (with iOS sometimes having inverted logic).

Why is my status bar hidden on iOS?

On iOS, the status bar can sometimes be hidden by default depending on project settings. You might need to adjust the `View controller-based status bar appearance` setting in your Xcode project's Info.plist file to `NO` to make it visible and controllable.

Does this work on both Android and iOS?

Yes, the `SystemUiOverlayStyle` settings work on both platforms, although specific properties like `statusBarBrightness` have more effect on one platform than the other.

Read more
You may also be interested in
Spacing design 8 rule  blog card image
Spacing design 8 rule
Published on 2025-05-12T12:18:48.815Z
Extract borders from image  blog card image
Extract borders from image
Published on 2025-05-12T12:19:08.227Z
ApparenceKit is a flutter template generator tool by Apparence.io © 2025.
All rights reserved