颤振容器高度与父高度相同

Flutter Container height same as parent height

我想用白色容器覆盖一张卡片,但容器总是需要一个高度(否则不显示)。我希望它和它的父堆栈一样大。我怎样才能使这项工作?卡片的高度各不相同。我想我遗漏了什么 ;)

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 

它在容器的情况下对我有用