Reputation: 943
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?
Upvotes: 0
Views: 232
Reputation: 5922
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
Upvotes: 1
Reputation: 486
Use one of the following methods!
Use flutter AutoSizeText widget
https://pub.dev/packages/auto_size_text
AutoSizeText(
"yourText",
style: TextStyle(fontSize: 30.0),
),
You can use flutter FittedBox also:
https://api.flutter.dev/flutter/widgets/FittedBox-class.html
AppBar(
centerTitle: true,
title: FittedBox(fit:BoxFit.fitWidth,
child: Text('Text which need to be resized')
),
),
Upvotes: 1