首页 > 解决方案 > 我想让我的底部导航栏透明

问题描述

我想让我的底部导航栏透明,我尝试了不透明的颜色属性,但它不起作用。只是为了让您有一个想法,我附上屏幕截图以便更好地理解

截屏

请忽略导航栏上的按钮,我只想要透明度,我的代码如下

return Scaffold(
  body: Column(
    .......
  bottomNavigationBar: Container(
    color: Colors.white,
    padding: EdgeInsets.all(20),
    child: Text(
      'SUIVANT',
      textAlign: TextAlign.center,
      style: TextStyle(
          fontFamily: 'Karla', fontSize: 20, fontWeight: FontWeight.bold),
    ),
  ),
);

任何帮助将不胜感激。提前谢谢。

标签: flutterdartbottomnavigationview

解决方案


最后经过大量思考和应用奇怪的方式,我能够以一种非常不同的方式做到这一点。我必须完成 BottomNavigationBar: 属性,因为它不允许被修改。我必须将主列包装在 Stack() 小部件中

return Scaffold(
  body: Stack(
    children: <Widget>[
      Column(
        children: <Widget>[
          //.......
          /*this is the Container() I had to add in stack after finishing the bottomnavbar*/
          Container(
            height: MediaQuery.of(context).size.height,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Container(),
                Container(
                  color: Colors.white.withOpacity(0.9),
                  width: MediaQuery.of(context).size.width,
                  padding: EdgeInsets.all(20),
                  child: Text(
                    'SUIVANT',
                    textAlign: TextAlign.center,
                    style: TextStyle(
                        fontFamily: 'Karla',
                        fontSize: 20,
                        fontWeight: FontWeight.bold),
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    ],
  ),
);

我不知道这是一种不好的方法还是正确的方法,但是经过大量思考过程后,我找不到除此之外的解决方案。如果有错误,请随时根据颤振规则进行修改。感谢大家的贡献。

这就是结果的样子


推荐阅读