【发布时间】:2018-12-07 06:56:54
【问题描述】:
我想用白色容器覆盖卡片,但容器总是需要高度(否则不会显示)。我希望它和它的父级堆栈一样大。我怎样才能使这项工作?卡的高度不同。我想我错过了一些东西;)
return new Stack(
children: <Widget>[
new Card( ... ),
new Container(color: Colors.white70),
]
);
【问题讨论】:
我想用白色容器覆盖卡片,但容器总是需要高度(否则不会显示)。我希望它和它的父级堆栈一样大。我怎样才能使这项工作?卡的高度不同。我想我错过了一些东西;)
return new Stack(
children: <Widget>[
new Card( ... ),
new Container(color: Colors.white70),
]
);
【问题讨论】:
您可以使用Positioned.fill 来强制堆栈子级填充Stack。
Stack(
children: [
Card(),
Positioned.fill(
child: Container(color: Colors.red),
)
]
);
【讨论】:
height: double.infinity
在容器的情况下它对我有用
【讨论】: