颤振将状态栏亮度更改为暗 [英] Flutter change status bar brightness to dark

查看:34
本文介绍了颤振将状态栏亮度更改为暗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了几种使状态栏图标变暗的方法,但是按下主屏幕并返回到应用程序后,状态栏图标为白色!似乎是扑通的虫子.

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.

但是在iOS中它可以正常工作.

but in iOS it works fine.

我尝试了这些方法:

android应用样式:

android app style:

<item name="android:windowLightStatusBar">false</item>

AppBar亮度:

brightness: Brightness.dark

Flutter API:

Flutter API:

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
        statusBarIconBrightness: Brightness.dark
    ));

flutter_statusbarcolor软件包:

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: ...
)

这篇关于颤振将状态栏亮度更改为暗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆