我是 Flutter 新手,我用谷歌搜索了这个问题,但发现没有答案适合我。
我的代码如下所示,状态栏颜色效果很好,现在是白色的。但是Android上的状态栏文字颜色也是白色的,看起来像Brightness.dark
根本不工作...
您的回答将不胜感激,谢谢!
Widget build(BuildContext context) {
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
statusBarColor: Colors.white, // Color for Android
statusBarBrightness: Brightness.dark // Dark == white status bar -- for IOS.
));
return Scaffold(
body: Container(
...
}
根据SystemUiOverLayStyle API 文档 https://api.flutter.dev/flutter/services/SystemUiOverlayStyle-class.html,Android上状态栏的文字颜色无法通过以下方式更改statusBarBrightness
仅在 iOS 中受到尊重。
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarColor: Colors.white, // Only honored in Android M and above
statusBarIconBrightness: Brightness.dark // Only honored in Android M and above
statusBarBrightness: Brightness.light, // Only honored in iOS
));
希望这可以帮助!干杯
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)