I have a Flutter app targeting Android.
I am testing on Samsung Galaxy A32 5G. Phone display spec is:
Display Size: 6.5 inches, 102.0 cm2 (~81.6% screen-to-body ratio)
Resolution: 720 x 1600 pixels, 20:9 ratio (~270 ppi density)
I use below code to determine the screen size and I change fonts sizes and other parameters based on this:
MediaQuery.maybeOf(context)?.size.width
MediaQuery.maybeOf(context)?.size.height
When I run above code on a physical phone I get these dp values for width and height:
360 x 752
When I create an emulator using the same screen spec I get these values:
480 x 1050
This is a very large discrepancy. The physical device is returning values for a very small phone and indeed things look very small on screen. Phone was factory reset so it is not any user defined settings.
App looks great on the emulator, but really bad on the real device. I am now thinking the testing I've done using emulators is meaningless.
What is going on here?
from Why is there a discrepancy between Android display dp values on physical device and emulator
No comments:
Post a Comment