What is the universal range of the user defined textScaleFactor in Flutter?

469

On the iOS simulator and my iPhoneXS Max the default is 1.0 Even when Display View setting is Zoomed or Standard.

When I go to Accessibility and change the size to the max available size (step by step):

flutter: text scale 1.1176470588235294
flutter: text scale 1.2352941176470589
flutter: text scale 1.3529411764705883

If i check the toggle for the "Larger Accessibility Sizes", the max I get:

flutter: text scale 3.1176470588235294

Going down with the slider in Accessibility (only 3 steps available):

flutter: text scale 0.9411764705882353
flutter: text scale 0.8823529411764706
flutter: text scale 0.8235294117647058

I don't know how useful those values can be to you, but to answer your questions you SHOULD NOT expect min=0.8 & max=2 ...

In any case, if you need to constrain the factor somehow, as I don't know any way to inject them in the MediaQuery that MaterialApp uses, you should have a custom function that normalizes the MediaQuery.textScaleFactorOf(context), maybe at the root of your widget tree, and manually apply that to each Text::textScaleFactor ?

Share:
469
Landon
Author by

Landon

Updated on December 11, 2022

Comments

  • Landon
    Landon over 1 year

    After my fruitless search for the expected range of the textScaleFactor parameter I attempted to answer my q by printing...

    MediaQuery.textScaleFactorOf(context);
    

    2 times while debugging on my Note 9: The output was 0.8 & 2 when I set the font size (in my accessibility settings) @ its min & max, resp..

    My q is: Can I expect this to be the universal range across all devices?

    If you're unsure, I would certainly accept an answer from someone posting their own test results (especially if they were to test on iphone).

  • Landon
    Landon about 5 years
    This was very helpful, ty! I would like to wait a couple of days to see if the current range (i.e., 0.8-3.118, after accounting for your results) can be extended any further by additional answers.