解决 在Column 中使用ListViewGridView 布局报错

6 min read
Column(
  children: <Widget>[
    Expanded( // wrap in Expanded
      child: ListView(...),
    ),
  ],
)
Column(
  children: <Widget>[
    SizedBox(
      height: 400, // fixed height
      child: ListView(...),
    ),
  ],
)
Column(
  children: <Widget>[
    ListView(
      shrinkWrap: true, // use this
    ),
  ],
)
// ...
  ListView(
    // Says to the `ListView` that it must wrap its
    // height (if it's vertical) and width (if it's horizontal).
    shrinkWrap: true,
  ),
// ...