Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the flutter MediaQuery starting from top of the screen

Tags:

flutter

When I am using the MediaQuery to resize a container, like this =>

height: MediaQuery.of(context).size.height - 100,

the subtraction or the resizing of the container starts from the bottom instead of from the top. Please someone should help me out

like image 433
august Avatar asked Mar 02 '23 22:03

august


1 Answers

You could wrap it with Align. It happens because naturally Flutter draw the Widgets from Top Left.

Something like this:

Align(
  alignment: Alignment.bottomCenter,
  child: Container(
    height: MediaQuery.of(context).size.height - 100,
    color: Colors.white,
  ),
),
like image 82
Federick Jonathan Avatar answered Mar 05 '23 18:03

Federick Jonathan