How to fix the position of the text by resizing the font size according to the device screen size in flutter app?

Issue

I have used a BottomAppBar widget and a floatingActionButton, In the picture some letters goes down which doesn’t look nice.so instead is there a way to make those font size vary automatically depending on the screen size and remain in the same row?enter image description here

Solution

Simply just wrap your Text widget to FittedBox widget like,

AppBar(
   centerTitle: true,
   title: FittedBox(fit:BoxFit.fitWidth, 
   child: Text('This is fitted box test')
  ),
),

Or you can use this lib
https://pub.dev/packages/auto_size_text

Answered By – Cyrus the Great

Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *