flutter怎么让一个控件在childrens里面位于他们所有的下方其他控件可以覆盖
您可以使用Stack Widget来实现这个效果。将需要在所有其他控件下方的控件放在Stack的底部,然后将其他控件放在Stack的子节点中,它们将覆盖底部控件。
示例代码如下:
Stack(
children: [
Positioned(
bottom: 0,
child: Container(
width: 100,
height: 100,
color: Colors.red,
),
),
Container(
width: 200,
height: 200,
color: Colors.blue,
),
],
)
在这个例子中,红色Container被放置在Stack的底部,而蓝色Container被放置在Stack的顶部,并覆盖了红色Container。使用Positioned Widget可以控制底部控件的位置。
原文地址: http://www.cveoy.top/t/topic/fl1n 著作权归作者所有。请勿转载和采集!