title: Flutter, how to set max height to list view items
body: <p>what I have tried is below.</p>
  <pre><code>         SizedBox(
             width: MediaQuery.of(context).size.width * 0.88,
             height: MediaQuery.of(context).size.height * 0.42,
               child: ListView.builder(
                     itemCount: 10,                          
                     itemBuilder: (BuildContext context, int index) {
                              return _buildListItem();
                           }),
                     )
  </code></pre>
  <p>and the list widget</p>
  <pre><code> Widget _buildListItem() {
      return ConstrainedBox(
        constraints: BoxConstraints(
          minHeight: 20,
            maxHeight: 120),
         child:Container(child:Text(&quot;Looooongggg textttttttttt 
                the text size is alwayysss different &quot;),
         ),}
  </code></pre>
  <p>I want to make the list view item size dynamically, but also the max height is fixed at 120. In other words, no matter how long the text is, the container also wants to be to not go up to 120 or more.</p>
  <p>This code always shows me only max height containers. No matter how short the letters are,</p>
  <p>how could I achieve that?</p>