title: Flutter screen size calculation
body: <p>I am getting sick trying to adapt my app to a certain tablet dimensions using flutter.</p>
  
  <p>The tablet is a Samsung Galaxy Tab S5e with screen of 2560x1600.</p>
  
  <p>When I make flutter return the screen dimensions using:</p>
  
  <pre><code>print("Size W is ${MediaQuery.of(context).size.width}");
  print("Size H is ${MediaQuery.of(context).size.height}");
  </code></pre>
  
  <p>What I get is: </p>
  
  <pre><code>Size W is 1137.7777777777778
  Size H is 711.1111111111111
  </code></pre>
  
  <p>Then, from <a href="https://stackoverflow.com/questions/54722234/how-flutter-calculates-screen-width">this answer</a> I learned to use:</p>
  
  <pre><code>var pixRatio = MediaQuery.of(context).devicePixelRatio;
  </code></pre>
  
  <p>So now I can actually get the right value using:</p>
  
  <pre><code>print("Corrected size W is ${MediaQuery.of(context).size.width * pixRatio}");
  print("Corrected size H is ${MediaQuery.of(context).size.height * pixRatio}");
  </code></pre>
  
  <p>And get:</p>
  
  <pre><code>Corrected size W is 2560.0
  Corrected size H is 1600.0
  </code></pre>
  
  <p>The problem is that, every time I want to put a widget with dimension, <code>Container</code>, <code>Image</code>, specify a <code>text size</code> etc on the screen, I have to use the trick like</p>
  
  <pre><code>Container(
      width: 100 / pixRatio,
      height: 200 / pixRatio,
  ),
  </code></pre>
  
  <p>If i do not include the <code>/pixRatio</code> correction, it just draws incorrectly and I get lots of pixel overflows..</p>
  
  <p>Is that the only way to put widgets on the screen with the correct size??, I mean, do I really <strong>NEED</strong> to add every single time the <code>/pixRatio</code> correction on width and height??</p>
  
  <p>Sounds not very practical for me.   </p>