Android's Display Size settings

Hello everyone,

I’m currently developing a cross-platform application and I have a problem related to Android’s Display Size settings.
For what concerns Font size settings, I can prevent it to affect my app by simply applying the following:

MediaQuery.of(context).copyWith( textScaler: const TextScaler.linear(1.0))

And I was wondering if something similar exists for Display size or if I should rather set something in the Android’s native files.

Thanks in advance

Don’t mess with platform sizes. This is useful, for instance, if the user has some vision problem and want to set the font to large. Both Android and iPhone have this option.

Always adapt your app to what the device say it is (font size, screen dimensions and device pixel ratio) and not the other way around!

2 Likes

I totally agree with that!

Problem is: the application is, briefly, a combination of gameplay and educational content. For this reason, my PM asked if it was feasible to lock the Display Size setting.

That’s why I was wondering if I could achieve that

And what if the device is a foldable one? Or a Tablet? There is always a “what if” in this scenario.

Fun fact: your PM is not well versed in technology, that’s why companies hires specialists, such as mobile developers. :wink:

2 Likes

Ahah again, totally agree with you (hopefully becoming a PM myself sooner rather than later :sweat_smile:)…but as for now they didn’t give me that much of freedom in designing things, so that’s why I was wondering if there was some evil way to bruteforce that :smiling_face_with_tear:

Problem is device pixel ratio (MediaQuery.devicePixelRatioOf(context)). This is calculated by that the device say your DPI is (using developer options in Android allow you to change that). So, your screen size is always logical pixels (not the screen resolution itself), based on that information.

Every Android out there have a different display size (physical) and different DPI (logical), so, it is impossible to adapt every screen to your desired display size. iOS is the same: iPhone E is smaller than iPhone “normal” and that is smaller than iPhone pro. Also, my iPhone 11 is device pixel ratio 2, while the 16e is 3, so… it’s too many variables and too many devices to consider (there are dozens of thousands of devices out there, literally).

Maybe if you show some images of what you are trying to accomplish…

1 Like

That’s what I aimed for, a well structured answer to show to our client in order to confirm what I already told them!
No need to show anything as I already addressed the problem ahahah they just did not understand how views could change that much depending on the device!
Thanks a lot again