Reputation: 1651
I want to set auto-size to TextWidget
in Flutter.
It's like Autosizing TextViews | Android Developers https://developer.android.com/guide/topics/ui/look-and-feel/autosizing-textview.html
Does Flutter support it?
How to implement auto-sizing TextWidge
t?
Upvotes: 4
Views: 1957
Reputation: 1651
I could implement it using FittedBox.
new FittedBox(
fit: BoxFit.contain,
child: new Padding(
padding: const EdgeInsets.all(8.0),
child: new Text(
'LooooooooooooooooooooooooooooooooooooooooooooongText',
),
),
),
Upvotes: 2
Reputation: 6867
You can puy your TextWidget inside Fexible Widget. Flexible Widget automatically gives it's child the available space.
Upvotes: 2