auto_size_text icon indicating copy to clipboard operation
auto_size_text copied to clipboard

AutoSizeText is resizing, but cut the resulting string

Open 0xbadb0d00 opened this issue 4 years ago • 6 comments

Version

  • Flutter version: 1.12.13+hotfix.5
  • auto_size_text version: 2.1.0

Hello, I'am trying to use your wonderful plugin, but it, even if plugin did a resizing, doesn't work correctly.

I am trying following test code to show that string in just 2 lines:

`

                        new SizedBox(
                          height: 30.0,
                          child: new AutoSizeText(
                            "qA6HMMbvyCKZM8rmy66iVKZyy6B5ogeJijipTJMUkvi62an95HVh6WGoBwSV8ZSZNWGD3lFVVx4MX3ZHIP8vu71kEwhHD0k5JUlFYeBP4kY9rcDfKyQAlbeP8ck0o4hi7wcq4tsXTFGEcAJmfsSkA6XNdzLwOPmwDjwA7gbdhXN7knItyxaY1r3ze68OPsAXV6jIvx63M339XQigzshq8TVLsy3XiPa2Fju5bcnidgrlRdCztcFJXANoyF2G2VT4qhc1aI2qHi5JR3kadh8XYleSClis06lPdt896hyTsFRP",
                            maxLines: 2,
                          ),
                        ),

`

This is what I see with a normal Text Widget: qemu-system-x86_64_5vRQDm4MyB

This is instead what I see with AutoSizeText Widget: qemu-system-x86_64_Ewac31h6Qi

The text size switched from 14 to 12 with AutoSizeText Widget, but the resulting text is cutted.

Can you please check it? Do you have any suggestion?

0xbadb0d00 avatar Jul 23 '20 17:07 0xbadb0d00

I have also faced the same issue. Am I missing something here?

SizedBox(
        width: 324.0
        height: 30.0,
        child: AutoSizeText(
          'some long text string',
          style: TextStyle(color: Colors.red),
          maxLines: 1,
          group: someTextGroup,
        ),
      )

1207roy avatar Jul 26 '20 04:07 1207roy

Check the minFontSize setting, the default is 12 points. In the screenshots, the font size appears to be larger with the AutoSizeText than with the normal Text widget. What is the font size with the normal Text widget?

matthewlloyd avatar Aug 03 '20 19:08 matthewlloyd

i am having this problem as well it is just cutting the string

easazade avatar Nov 23 '20 15:11 easazade

Just use FittedBox instead of AutoSizeText

FittedBox(
    child: Text('my long text ...'),
)

easazade avatar Nov 26 '20 00:11 easazade

Set minFontSize to 8 or 10. Still feels legible with this font size.

rohan20 avatar Jul 16 '21 20:07 rohan20

Just use FittedBox instead of AutoSizeText

FittedBox(
    child: Text('my long text ...'),
)

image Just wrapping the (Autosize)Text Widget into a FittedBox does it. No need to resort only to Text.

flawnn avatar Jun 18 '23 17:06 flawnn