I tried several ways to make status bar icons dark, but after home press and returning to app status bar icons are white! it seems that its flutter bug.
but in iOS it works fine.
i tried these ways :
android app style:
<item name="android:windowLightStatusBar">false</item>
AppBar brightness:
brightness: Brightness.dark
Flutter API:
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
statusBarIconBrightness: Brightness.dark
));
flutter_statusbarcolor package :
import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart';
FlutterStatusbarcolor.setStatusBarWhiteForeground(false);
Add following into your widget tree:
AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.dark,
child: ...
)
As of Flutter 2.4.*, AppBar
brightness is deprecated. To achieve status bar brightness, add a systemOverlayStyle
to your AppBar
as I have highlighted below.
appBar: AppBar(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarBrightness: Brightness.dark
),
)
If you wish to apply dark status bar icons on the entire app, add an appBarTheme
to your MaterialApp theme as shown in the following code. Your MaterialApp
widget is on the main.dart
file;
MaterialApp(
...
theme: ThemeData(
appBarTheme: AppBarTheme(
systemOverlayStyle: SystemUiOverlayStyle(
statusBarBrightness: 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