这是我的方法:
Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage("https://cdn.pixabay.com/photo/2018/09/17/16/24/cat-3684184_960_720.jpg")
)
),
),
Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Theme(
data: Theme.of(context).copyWith(canvasColor: Colors.transparent),
child: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(Icons.photo_camera), title: Text("Test")),
BottomNavigationBarItem(
icon: Icon(Icons.photo_camera), title: Text("Test")),
],
),
)
],
)
],
);
这将用背景图像(底层)和底部导航栏填满整个屏幕(图像纯粹是微不足道的,但你明白了),其内容与end对齐的列内的底部导航栏。
为了完成目的,我将在原始问题的 cmets 中粘贴解释。
深入思考后,我意识到这不会带来同样的效果
结果符合预期,因为两个女孩的形象会在上面
导航栏。我建议使用带有两个女孩图像的堆栈
作为底层(堆栈的底部)和一个全屏列
MainAxisSize 设置为 MainAxisSize.max 和 MainAxisAlignment 设置为
MainAxisAlignment.end。我可以把它写在答案中,但我无法测试
现在,所以我更喜欢写评论。希望对你有帮助
更新
以前的解决方案仍然有导航栏阴影。
屏幕(小部件)的这种构建方法没有,因为我用Row 实现了我自己的BottomNavigationBar:
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(
"https://media.idownloadblog.com/wp-content/uploads/2016/04/macinmac-portrat-splash.jpg"))),
),
Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
GestureDetector(
onTap: () {
print("Tap!");
},
child: Icon(
Icons.photo_camera,
size: 50,
)),
GestureDetector(
onTap: () {
print("Tap!");
},
child: Icon(
Icons.photo_camera,
size: 50,
)),
GestureDetector(
onTap: () {
print("Tap!");
},
child: Icon(
Icons.photo_camera,
size: 50,
)),
GestureDetector(
onTap: () {
print("Tap!");
},
child: Icon(
Icons.photo_camera,
size: 50,
)),
],
)
],
)
],
);
这是我手机的截图:
奖金
可以通过调用实现全屏
SystemChrome.setEnabledSystemUIOverlays([]);
来源:here