As the title suggests, this is about Flutter.
Is there any way to switch Android status bar to light mode so that the icons in status bar show up dark? See picture for example.
I tried following possible solutions but none of them worked -
// main.dart
appBar: new AppBar(
brightness: Brightness.light,
backgroundColor: Colors.white,
),
// MainActivity.kt
// Following 2 lines do change the color of status and nav bars
window.statusBarColor = 0x00000000
window.navigationBarColor = 0x00000000
// This seems to have no effect. Icons are still white.
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
The support for this is in works - https://github.com/flutter/flutter/issues/17231
Step 1: Locate the MaterialApp widget. Step 2: Inside the MaterialApp, add the theme parameter with ThemeData class assigned. Step 3: Inside the ThemeData add the appBarTheme parameter and then assign the AppBarTheme class. Step 4: Inside the AppBarTheme , specify the systemOverlayStyle parameter and set the color.
Step 1: After opening the android studio and creating a new project with an empty activity. Step 2: Navigate to res/values/colors. xml, and add a color that you want to change for the status bar.
Step 1: Locate the file where you have placed the Text widget. Step 2: Inside the Text widget, add the Style parameter and assign the TextStyle widget. Step 3: Inside the TextStyle widget, add the color parameter and set the color of your choice. For example, color: Colors.
Just additional notes:
To change the status bar icon to dark put the following code
StatusBarIconBrightness: Brightness.light
and add brightness in appbar.
appBar: AppBar(
brightness: Brightness.light, )
if you would like to use white bg on status bar, then change to .light so that icon can be dark, and .dark for darker status bar with white icon
The Flutter team have now added support for light/dark status bar control. To add, import this:
import 'package:flutter/services.dart';
Then add this in your App's build function:
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
statusBarIconBrightness: Brightness.dark
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With