auto_size_text icon indicating copy to clipboard operation
auto_size_text copied to clipboard

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

Open gapspt opened this issue 4 years ago • 1 comments

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

  • Flutter version: 1.17.1
  • auto_size_text version: ^2.1.0

gapspt avatar May 21 '20 18:05 gapspt

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)

AhmedNourJamalElDin avatar May 28 '20 21:05 AhmedNourJamalElDin