我做了一排排。现在,我要在这些行的顶部放置一个容器。我怎样才能做到这一点。我尝试过使用stack小部件,但是它只是将所有东西都堆叠在一起,因此我无法控制位置。
我如何在一堆行的顶部绘制一个容器。
感谢您的帮助。
您可以检查以下代码,尽管您的询问有些混乱。您需要使用Positioned
并在顶部和左侧设置一些值。
Scaffold(
body: Stack(
children: [
Positioned(
top:0 ,
left: 0,
child: Container(
height: 100,
width: 100,
color: Colors.red,
),
),
Positioned(
top:100 ,
left: 0,
child: Container(
height: 100,
width: 100,
color: Colors.red,
child: Row(),
),
),
Positioned(
top:200 ,
left: 0,
child: Container(
height: 100,
width: 100,
color: Colors.red,
child: Row(),
),
),
Positioned(
top:300 ,
left: 0,
child: Container(
height: 100,
width: 100,
color: Colors.red,
child: Row(),
),
),
],
),
)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句