How to REALLY support different Phone sizes in flutter?

106 views Asked by At

I read tons of tutorials and seen lots of video but basically none of them solved my problem, so the question as the title. My doubt is this: if I develop a Flutter app I debug using my iPhone, and I set for example the font size of a text to, say, 16. How can I be sure that this value will be ok for every device? Ideally everything should scale proportionally in an automatic way: it is totally mad thinking to have a MANUAL setup in every widget for every screen, filling up the code of "if screen is small then 14, else 16 otherwise..." Come on this would be the most horrible code a dev could implement, and Flutter is a too wonderful framework to allow this. There must be something that I'm missing. Could you please help me?

1

There are 1 answers

0
Syed Mahfuzur Rahman On

You can use FittedBox.

FittedBox(
          fit: BoxFit.contain,
          child: Text(
            "Your Sample Text",
          ),
        ),

It will reduce the size of the text for small devices if needed.