Search code examples
flutterdartwidgetscaffold

Container height does not take entirely even thought I used MediaMediaQuery


In flutter, I used Container inside the Scaffold Widget. I gave the Height and Width of the container as below code (MediaQuery)

height:MediaQuery.of(context).size.height;
width: MediaQuery.of(context).size.width,

Even thought my screen does not take the screen height enter image description here


Solution

  • Your container might be taking the entire height but your items are not taking the space.

    The most probable solution to your problem is, wrap your container with expanded widget.

    If that doesn't work, and you have a column use the property

        mainAxisAlignment: MainAxisAlignment.spaceAround
    

    or

        mainAxisAlignment: MainAxisAlignment.spaceEvenly,