Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 如何使设备顶部面板(状态栏)与颤振中的AppBar具有相同的背景颜色?_Dart_Flutter - Fatal编程技术网

Dart 如何使设备顶部面板(状态栏)与颤振中的AppBar具有相同的背景颜色?

Dart 如何使设备顶部面板(状态栏)与颤振中的AppBar具有相同的背景颜色?,dart,flutter,Dart,Flutter,如何使设备顶部面板(状态栏)与颤振中的AppBar具有相同的背景颜色?设备顶部面板的颜色始终比AppBar backgroundColor暗。非常感谢。在iOS上,这已经是事实了 在Android上,在调用super.onCreate(savedInstanceState)之后,将以下内容添加到MainActivity.java中的onCreate 这将覆盖默认状态栏颜色0x40000000,该颜色是在flatterActivityDelegate方法中设置的 这里是一个特定于颤振的解决方案。在

如何使设备顶部面板(状态栏)与颤振中的AppBar具有相同的背景颜色?设备顶部面板的颜色始终比AppBar backgroundColor暗。非常感谢。

在iOS上,这已经是事实了

在Android上,在调用
super.onCreate(savedInstanceState)之后,将以下内容添加到
MainActivity.java
中的
onCreate

这将覆盖默认状态栏颜色
0x40000000
,该颜色是在
flatterActivityDelegate
方法中设置的


这里是一个特定于颤振的解决方案。在构建方法中,可以使用颤振服务包

import 'package:flutter/services.dart';
Widget build(BuildContext context) {
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
      statusBarColor: Colors.transparent, //top bar color
      statusBarIconBrightness: Brightness.dark, //top bar icons
      systemNavigationBarColor: Colors.white, //bottom bar color
      systemNavigationBarIconBrightness: Brightness.dark, //bottom bar icons
    ));

//....
}

非常感谢您的快速回复。它起作用了^_^有没有办法改变图标的颜色?我的appbar是白色的,以前是这样的,但现在我的文件在Kotlin中看起来像这样。如何获得透明条<代码>导入androidx.annotation.NonNull;导入io.颤振.Embedded.android.颤振活动导入io.颤振.Embedded.engine.颤振引擎导入io.颤振.plugins.GeneratedPluginRegistrant导入android.os.Build导入android.view.ViewTreeObserver导入android.view.WindowManager类主活动:颤振活动(){覆盖乐趣配置颤振引擎(@NonNull flatterengine:flatterengine){GeneratedPluginRegistrant.registerWith(flatterengine);}}}
import 'package:flutter/services.dart';
Widget build(BuildContext context) {
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
      statusBarColor: Colors.transparent, //top bar color
      statusBarIconBrightness: Brightness.dark, //top bar icons
      systemNavigationBarColor: Colors.white, //bottom bar color
      systemNavigationBarIconBrightness: Brightness.dark, //bottom bar icons
    ));

//....
}