title: How to dynamically adjust container size in flutter?
body: <p>I am using a white container with height</p>
  <p><code>height: MediaQuery.of(context).size.height</code></p>
  <p>And I am adding several red containers in it. When the number of these inside containers is less, the scrolling works perfectly like this</p>
  <p><a href="https://i.stack.imgur.com/ARSJH.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ARSJH.gif" alt="enter image description here" /></a></p>
  <p>But as I increase the number of containers inside the big container, scrolling kind of overflows the container, like this</p>
  <p><a href="https://i.stack.imgur.com/lN79M.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lN79M.gif" alt="enter image description here" /></a></p>
  <p>One solution I found out was that if I increase the height of white container, i.e:-</p>
  <p><code>height: MediaQuery.of(context).size.height*7</code></p>
  <p>But it makes the app look ugly and would eventually fail when the number of red containers is further increased. How can I fix this issue?</p>
  <p>Code for the Program:-</p>
  <pre><code>import 'package:flutter/material.dart';
  
  void main() {
    runApp(MaterialApp(    
      home: Test(),
    ));
  }
  
  
  
  class Test extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        home: SafeArea(
            child: Scaffold(        
                body: Container(
                  color: Colors.black,
                  child: ListView(
                  children: &lt;Widget&gt;[
                  Padding(
                    padding: EdgeInsets.only(top: 15.0, left: 10.0),
                  ),
                  SizedBox(
                    height: 25.0,
                  ),
                  Padding(
                    padding: EdgeInsets.only(left: 20.0),
                    child: Row(
                      children: &lt;Widget&gt;[
                        Text(
                          'TEST',
                          style: TextStyle(
                              fontFamily: 'Montserrat',
                              color: Colors.white,
                              fontWeight: FontWeight.bold,
                              fontSize: 25.0),
                        ),
                        SizedBox(
                          width: 10.0,
                        ),
                        
                      ],
                    ),
                   
                  ),
  
                  SizedBox(height: 60.0,),
  
                  
                  
  
  
                  
                  Container(
                   margin: EdgeInsets.only(top:180.0,),
                    height: MediaQuery.of(context).size.height,
                    decoration: BoxDecoration(
                      color: Color(0xFFEEEEEE),
                      borderRadius: BorderRadius.only(
                        topLeft: Radius.circular(75.0),
                        topRight: Radius.circular(75.0),
                      ),
                    ),
                    child: ListView(
                      primary: false,
                      padding: EdgeInsets.only(
                        left: 15.0,
                        right: 15.0,
                        top: 20.0,
                      ),
                      children: &lt;Widget&gt;[
                        Padding(
                          padding: const EdgeInsets.only(
                            top: 30.0,
                          ),
                          child: Column(
                            children: &lt;Widget&gt;[
                              
                              Row(
                                children: &lt;Widget&gt;[
                                  Expanded(
                                    child: Center(
                                      child: Text(
                                        'TEST',
                                        style: TextStyle(                                      
                                          color: Colors.black,
                                          fontSize: 30.0,
                                          fontWeight: FontWeight.bold,
                                        ),
                                      ),
                                    ),
                                  ),
                                ],
                              ),
                              
                              SizedBox(height: 20.0,),
                              
  
                              Column(  
                                children: &lt;Widget&gt;[  
                                  Container(  
                                    height: 150,
                                    color: Colors.red,
                                  ),
                                  SizedBox(height: 20,),
  
                                  Container(  
                                    height: 150,
                                    color: Colors.red,
                                  ),
                                  SizedBox(height: 20,),
  
                                  Container(  
                                    height: 150,
                                    color: Colors.red,
                                  ),
                                  SizedBox(height: 20,),
  
                                  Container(  
                                    height: 150,
                                    color: Colors.red,
                                  ),
                                  SizedBox(height: 20,),
  
                                  Container(  
                                    height: 150,
                                    color: Colors.red,
                                  ),
                                  SizedBox(height: 20,),
  
                                  Container(  
                                    height: 150,
                                    color: Colors.red,
                                  ),
                                  SizedBox(height: 20,),
  
                                  Container(  
                                    height: 150,
                                    color: Colors.red,
                                  ),
                                  SizedBox(height: 20,),                            
                               ],
                              )
                              
                              
  
                              
                                        
                             
                            ],
                          ),
                        ),
                      ],
                    ),
                  ),
              ],
            ),
                ),
        ),
      ),
      );
    }
  }
  
  
  </code></pre>