首页 > 解决方案 > 设置手势栏颜色透明[Flutter]

问题描述

我需要将导航栏设置为透明,但不隐藏。如左侧 Youtube Music 的示例。

在此处输入图像描述

我尝试了几种方法,每当我将它定义为透明时,条都是白色的。

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark.copyWith(
  systemNavigationBarColor: Colors.transparent,
  systemNavigationBarDividerColor: Colors.transparent,
));

请看右边的图片。我只需要白色部分是透明的,手势指示器需要保持可见。有人能帮我吗?

标签: flutterdart

解决方案


将您的导航栏放在容器中。然后不给容器颜色,它会自动将颜色设置为透明。要将容器与底部对齐,您可以这样做。希望这会起作用。

Align(
              alignment: Alignment.bottomLeft,
              child: Container(
                width: MediaQuery.of(context).size.width,
                height: 50.0,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                  children: <Widget>[

                  ],
                ),
              ),
            )

推荐阅读