Flutter 如何设置底部导航栏的颜色像phone x一样透明?

Flutter 如何设置底部导航栏的颜色像phone x一样透明?,flutter,transparent,bottombar,Flutter,Transparent,Bottombar,现在我正在运行最新的stable 1.12.13+修补程序。5 我需要完整的全屏,因为我的手机在安卓颤振 在颤振中可能吗? 我们可以显示很多应用程序,如安卓设置应用程序、联系人等 BottomNavigationBar中有一个名为backgroundColor的属性,您可以使用Colors.transparent使其与图片相似。但是,还有两个窍门: 您必须将BottomNavigationBar类型更改为BottomNavigationBar.fixed; 您必须更改标高,因为它将是一个较大的阴

现在我正在运行最新的stable 1.12.13+修补程序。5

我需要完整的全屏,因为我的手机在安卓颤振

在颤振中可能吗? 我们可以显示很多应用程序,如安卓设置应用程序、联系人等


BottomNavigationBar中有一个名为backgroundColor的属性,您可以使用Colors.transparent使其与图片相似。但是,还有两个窍门:

您必须将BottomNavigationBar类型更改为BottomNavigationBar.fixed; 您必须更改标高,因为它将是一个较大的阴影,颜色应该在那里。 代码示例:

bottomNavigationBar: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          backgroundColor: Colors.transparent,
          elevation: 0,  

如果你想在图标上产生移动效果,请为每个图标声明一种颜色。

我已经尝试过了,但在应用程序栏上,它是透明的,但问题是这些小部件在放置在脚手架内后仍然保持高度。我假设BottomNavigationBar的情况也一样,因此在本例中,您可以将其添加到堆栈中这是我的做法,因此它确实显示在您的内容顶部,并反映其透明度,如下所示:

Scaffold(
      body: Container(
          color: Colors.red,
          child: Stack(children: <Widget>[
            Align(
                alignment: Alignment.bottomCenter,
                child: BottomNavigationBar(
                    elevation: 0,
                    backgroundColor: Colors.transparent,
                    items: const <BottomNavigationBarItem>[
                      BottomNavigationBarItem(
                        icon: Icon(Icons.home),
                        title: Text('Home'),
                      ),
                      BottomNavigationBarItem(
                        icon: Icon(Icons.business),
                        title: Text('Business'),
                      ),
                      BottomNavigationBarItem(
                        icon: Icon(Icons.school),
                        title: Text('School'),
                      ),
                    ],
                    currentIndex: 0,
                    selectedItemColor: Colors.amber[800])),
            Center(child: Text('hello'))
          ])))

您会注意到底部导航栏将显示红色,因为它是透明的,并且将显示父级的颜色容器颜色为红色。

您可以通过将此代码段添加到构建方法中来实现这一点

SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
      systemNavigationBarColor: Colors.transparent);

您可以尝试禁用SafeArea如何设置导航栏颜色透明,如phone x?