simc / auto_size_text

Flutter widget that automatically resizes text to fit perfectly within its bounds.
https://pub.dev/packages/auto_size_text
MIT License
2.05k stars 236 forks source link

AutoSizeText as a child of ListView dosn't autosize the text #112

Open Sbenari opened 2 years ago

Sbenari commented 2 years ago

It appears that AutoSizeText picks the maximum font size when is a child of ListView, instead of auto-sizing the text based on available space. In my case, I use 300 as the font size.

Steps to Reproduce I've placed the AutoSiezext as a child of the ListView.

Code sample

Expanded(
flex: 9,
itemCount: resultS.length,
separatorBuilder: (BuildContext context, int index) => Divider(thickness: 1, color: Colors.grey.shade800),
itemBuilder: (BuildContext context, int index) {
child: AutoSizeText(
resultS[index],
textScaleFactor: 1.0,
style: const TextStyle(
fontFamily: 'Arial-Narrow',                                     
letterSpacing: -0.5,
color: Colors.yellow,
fontSize: 300,
),
minFontSize: 0,
//overflow: TextOverflow.ellipsis,
),                                                 
alignment: Alignment.topRight);
},
),
),

Screenshots The list of the yellow numbers is What I should get. in this case, ScreenUtil is used instead of AutoSizeText Screen Shot 2022-04-04 at 4 33 46 PM

This is what I'm getting when using AutoSizeText Screen Shot 2022-04-04 at 4 28 57 PM

Version