Home > Software engineering >  How to easily center using Positioned and MediaQuery?
How to easily center using Positioned and MediaQuery?

Time:06-29

Could someone help me figure out how to use the Positioned widget in a Stack to center a Widget given that I have the screenHeight and screenWidth?

What I always do is use the left/right/top/bottom properties and use my eyes to center something, but I feel like given the MediaQuery there must be some way to divide the width and height in half or so and center. I just can't wrap my head around the simple math currently.

CodePudding user response:

You can use container with full width and height that you want then for that specific element you can use align() to center that one

  • Related