Flutter: Minimum height on horizontal list view : <p>I'm trying to create a horizontal scrolling list of items in Flutter, and I want that list to only take up the necessary height based on its children. By design “<code>ListView</code> tries to expand to fit the space available in its cross-direction” (from the <a href="https://flutter.io/layout" rel="noreferrer">Flutter docs</a>), which I also notice in that it takes up the whole height of the viewport, but is there a way to make it not do this? Ideally something similar to this (which obviously doesn't work):</p>

<pre class="lang-dart prettyprint-override"><code>new ListView(
  scrollDirection: Axis.horizontal,
  crossAxisSize: CrossAxisSize.min,
  children: &lt;Widget&gt;[
    new ListItem(),
    new ListItem(),
    // ...
  ],
);
</code></pre>

<hr>

<p>I realize that one way to do this is by wrapping the <code>ListView</code> in a <code>Container</code> with a fixed height. However, I don't necessarily know the height of the items:</p>

<pre class="lang-dart prettyprint-override"><code>new Container(
  height: 97.0,
  child: new ListView(
    scrollDirection: Axis.horizontal,
    children: &lt;Widget&gt;[
      new ListItem(),
      new ListItem(),
      // ...
    ],
  ),
);
</code></pre>

<hr>

<p>I was able to hack together a “solution” by nesting a <code>Row</code> in a <code>SingleChildScrollView</code> in a <code>Column</code> with a <code>mainAxisSize: MainAxisSize.min</code>. However, this doesn't feel like a solution, to me:</p>

<pre class="lang-dart prettyprint-override"><code>new Column(
  mainAxisSize: MainAxisSize.min,
  children: &lt;Widget&gt;[
    new SingleChildScrollView(
      scrollDirection: Axis.horizontal,
      child: new Row(
        children: &lt;Widget&gt;[
          new ListItem(),
          new ListItem(),
          // ...
        ],
      ),
    ),
  ],
);
</code></pre>
