flutter - 我想让我的底部导航栏透明
问题描述
我想让我的底部导航栏透明,我尝试了不透明的颜色属性,但它不起作用。只是为了让您有一个想法,我附上屏幕截图以便更好地理解
请忽略导航栏上的按钮,我只想要透明度,我的代码如下
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),
),
),
);
任何帮助将不胜感激。提前谢谢。
解决方案
最后经过大量思考和应用奇怪的方式,我能够以一种非常不同的方式做到这一点。我必须完成 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),
),
),
],
),
),
],
),
],
),
);
我不知道这是一种不好的方法还是正确的方法,但是经过大量思考过程后,我找不到除此之外的解决方案。如果有错误,请随时根据颤振规则进行修改。感谢大家的贡献。
推荐阅读
- javascript - 在下一个 js 中使用时正确输入 javascript
- powershell - Powershell - 参数的使用
- python - 通过 XPath 选择 h2 元素
- coq - 如何使用 coq 证明列表连接不可交换?
- java - 使用 GSON 中的动态字段将 JSON 反序列化为不同的类(改造)
- reactjs - 如何停止使用钩子销毁/卸载组件?
- angular - Swiper 幻灯片未在 ionic 5.7 中显示
- firebase - 如何从android studio中的firestore检索数据
- c++ - arm64 debian 上的 gcc-8 是否忽略友元运算符
我想比较两组对象。对于相同的代码,我在不同的机器上得到 2 个不同的输出。代码是用两个不同的编译器编译的。在x86-64机器上我使用gcc-11,在aarch64 ( raspberry pi4 ) 机器上我使用gcc-8。我必须在
- python - 如何以自定义格式化方式 python 获取类的输出?(NGROK 隧道名称)