Home > Net >  Is there a way to reduce the overall text size in my application?
Is there a way to reduce the overall text size in my application?

Time:05-03

I need my app to be responsive on 4 inch, because I got some overflows. I was searching the web without success. My first thought is to reduce text based on resolution screen. But it would require some time to do all screens of my app.

Is there a way to reduce the overall text size in my application?

Like in css we can :

font-size: 80%;

Is it possible in flutter ?

Thank you

CodePudding user response:

try adding this package for responsive text https://pub.dev/packages/auto_size_text it will work perfectly if your text is inside SizedBox

hope it was helpful

CodePudding user response:

If it's about just reducing text size, you can use textScaleFactor.

Small Example to see the difference :

class MyStatelessWidget extends StatelessWidget {
  const MyStatelessWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(children: [
      Text(
        "HEY",
      ),
      Text("HEY", style: TextStyle(fontSize: 32)),
      MediaQuery(
          data: MediaQuery.of(context).copyWith(textScaleFactor: 2.0),
          child: Text("Foo", style: TextStyle(fontSize: 32))),
    ]);
  }
}

See more here doc

  • Related