【发布时间】:2018-10-22 19:43:27
【问题描述】:
我想把 Stack 放在 Stack 里面,如果我改变内部 Stack 的定位小部件的位置,它就不起作用。
作品:
Stack(
children: [
Positioned(
top: 150.0,
child: Text("Text#1"),
),
Positioned(
top: 100.0,
child: Stack(
children: [
Positioned(
child: Text("Text#2"),
)
],
),
)
],
)
如果我在内部堆栈定位中添加“顶部:200.0”,内部堆栈消失并且颤振抛出错误
Stack(
children: [
Positioned(
top: 150.0,
child: Text("Text#1"),
),
Positioned(
top: 100.0,
child: Stack(
children: [
Positioned(
top:200.0,
child: Text("Text#2"),
)
],
),
)
],
【问题讨论】:
-
我知道原因,但我不明白你想要达到什么目的。您是否使用
Positioned来模仿Padding的行为? -
我有一些基于 Stack 构建的图表,我想让这些图表像在 Tinder 中一样滑动,所以我将这些图表打包到另一个堆栈中
标签: dart flutter flutter-layout