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.06k stars 240 forks source link

Text with more lines than maxLines results in the font size being the minFontSize #57

Open gapspt opened 4 years ago

gapspt commented 4 years ago

Steps to Reproduce Trying to resize a text that has more lines in itself more than the allowed maxLines results in the font size to be the minFontSize and the displayed lines to be only maxLines, leaving an empty space bellow. Expected result - Either: 1 - Cap the input text to maxLines lines first and then apply the rest of the resizing algorithm; or 2 - Apply the maximum possible lines possible when reaching the minFontSize.

The first option would be more consistent with the behaviour of Text(), which caps the lines to maxLines.

Code sample

Row(
      children: <Widget>[
        SizedBox(
          width: 100,
          height: 100,
          child: Text("1\n2\n3\n4\n5", maxLines: 4),
        ),
        SizedBox(
          width: 100,
          height: 100,
          child: AutoSizeText("1\n2\n3\n4\n5", maxLines: 4, minFontSize: 5),
        ),
      ],
    )

Screenshots Screenshot for the example above: image

Version

AhmedNourJamalElDin commented 4 years ago

I face the following problem and I think it's the same in this issue: showing 1,2,3,4,5,6,7 in separate lines with maxLines = 4

1 2 3 4

now resizing to show the rest

1 2 3 4 5 6 7

this would only show the first 4 numbers even though there are some space to fill (the difference between maxFontSize and minFontSize)