please help with a problem I have in flutter. I put them in context:
I must create a responsive application. I will use MediaQuery.of(context).size, so in my universe I consider:
Note: I did a lot of tests on all the different types of devices that ADV Manager offers (TV, phone, tablet, automotive and wear OS) and I realized that the value of size.width is always the real value divided in two, some examples :
If the device has a width of 1000, size.width takes the value of 500.
If the device has a width of 2560, size.width takes the value of 1280.
etc., always the same result.
I have considered multiplying the size.width value by two (to get the actual value), but in the web browser the size.witdh value is correct so the problem is only on emulated android devices.
Can anyone have any idea what is wrong? Thanks in advance.
MediaQuery.of(context).size.width * MediaQuery.of(context).devicePixelRatio to get the width in physical pixels.
Documentation : Logical pixels are roughly the same visual size across devices. Physical pixels are the size of the actual hardware pixels on the device. The number of physical pixels per logical pixel is described by the devicePixelRatio.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With