title: Flutter ListView.builder() widget's cross Axis is taking up the entire Screen height
body: <p>I am using <code>ListView.builder</code>(scrollDirection: Horizontal) widget inside a <code>Container</code> in Flutter. The main Axis of the ListView is taking up the entire screen width which is expected. I want the ListView's crossAxis(vertical direction) to take up the ListView's Item height (only wrapping the content), but it is taking up the entire screen height.</p>
  <p>I have created the DartPard to explain the Issue. I want the ListView to take up the Item height and not the entire screen height.
  Dart Pad Link : <a href="https://dartpad.dev/85c44151099080922266f14d5a8bcbff?null_safety=true" rel="nofollow noreferrer">DartPard which shows the issue I am facing</a></p>
  <pre><code>import 'package:flutter/material.dart';
  
  final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
  
  void main() {
    runApp(MyApp());
  }
  
  class MyApp extends StatelessWidget {
     @override
     Widget build(BuildContext context) {
       return MaterialApp(
            theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
            debugShowCheckedModeBanner: false,
            home: Scaffold(
                body: SafeArea(
                child: Container(
                color: Colors.white,
                child: ListView.builder(
                    itemCount: 10,
                    scrollDirection: Axis.horizontal,
                itemBuilder: (context, index) {
                    return Container(
                             color: Colors.red,
                             child: Text(
                               'Item $index', 
                               style: TextStyle(color: Colors.black),
                    ),  
                );
              },
            ),
           ),
          ),
         ),
        );
       }
      }
  </code></pre>
  <p>Few workarounds which will work :</p>
  <ol>
  <li>Using <code>Row</code> or <code>Wrap</code> instead of <code>ListView</code>.</li>
  <li>Giving a Fixed height to the ListView.</li>
  </ol>
  <p>I know the above listed approaches will work. But I want to achieve this using a ListView only.</p>