You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using AutoSizeText.rich, it seems that I can only have correct autosizing when the fontSize is declared both in the AutoSizeText's style and in the TextSpan's, unlike what is said in the documentation.
A short sample to test it:
class MyHomePage extends StatelessWidget {
MyHomePage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: AppBar(
title: TextField(),
),
body: SafeArea(
child: Column(children: <Widget>[
Expanded(child: Center(child: SizedBox(width: 200, height: 200, child: AutoSizeText.rich(TextSpan(text: "Style is defined only in AutoSizeText",), style: TextStyle(fontSize: 200),),),),),
Expanded(child: Center(child: SizedBox(width: 200, height: 200, child: AutoSizeText.rich(TextSpan(text: "Style is defined only in TextSpan", style: TextStyle(fontSize: 200)),),),),),
Expanded(child: Center(child: SizedBox(width: 200, height: 200, child: AutoSizeText.rich(TextSpan(text: "Style is define in both AutoSizeText and TextSpan", style: TextStyle(fontSize: 200)), style: TextStyle(fontSize: 200),),),),),
],),
),
);
}
}
Only the last widget of the Column will be auto sized.
Using auto_size_text: ^1.1.0
The text was updated successfully, but these errors were encountered:
The case where only AutoSizeText has a style was a bug that I fixed.
The other case wasn't: Since your AutoSizeText doesn't have a style, the default style is used (probably fontSize = 14). To fit the large span, AutoSizeText has to scale the text down. But the default minFontSize is 12 and since the "reference fontSize" is 14, the text is not scaled down very far. Just set minFontSize to 0.1 and it will work. Note: You probably also have to use a smaller stepGranularity (like 0.1) because the steps will be very large.
It would be very helpful if you could verify that the first case is fixed before I release a new version.
When using AutoSizeText.rich, it seems that I can only have correct autosizing when the fontSize is declared both in the AutoSizeText's style and in the TextSpan's, unlike what is said in the documentation.
A short sample to test it:
Only the last widget of the Column will be auto sized.
Using auto_size_text: ^1.1.0
The text was updated successfully, but these errors were encountered: