简体   繁体   English

Flutter如何设置状态栏图标颜色?

[英]How to set status bar icon color in Flutter?

I'm working on the flutter project, I want to give the white colour to the status-bar icon.我正在处理 flutter 项目,我想为状态栏图标提供白色。 so I used the following line of code, and it gave me the result on a splash screen所以我使用了下面的代码行,它在启动画面上给了我结果

FLUTTER CODE: FLUTTER 代码:

SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
  systemNavigationBarColor:  Color(0xffdedede),
  systemNavigationBarIconBrightness: Brightness.dark,
  systemNavigationBarDividerColor: null,
  statusBarColor: Color(0xffbf0000),
  statusBarIconBrightness: Brightness.light,
  statusBarBrightness: Brightness.dark,
  ));

BUT: when the app navigates to the home screen, the status-bar icon colour change back to black, I don't know what is missing from that line's code.但是:当应用程序导航到主屏幕时,状态栏图标颜色变回黑色,我不知道该行代码中缺少什么。 So I'm stuck on that所以我坚持那个

Colour of status-bar icon is depend on color of appbar.状态栏图标的颜色取决于应用栏的颜色。 You can try edit systemOverlayStyle of AppBar on Home Screen?您可以尝试在主屏幕上编辑 AppBar 的systemOverlayStyle吗?

https://api.flutter.dev/flutter/material/AppBar/systemOverlayStyle.html https://api.flutter.dev/flutter/material/AppBar/systemOverlayStyle.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM