Search code examples
flutterflutter-packages

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


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