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 241 forks source link

Failing tests for version 0.2.0 #2

Closed apaatsio closed 6 years ago

apaatsio commented 6 years ago

The tests are failing for the 0.2.0 release: https://travis-ci.com/leisim/auto_size_text/builds/85639827

Is the version 0.2.0 supposed to work? I can't get it to work. Even when I'm trying something like AutoSizeText('foo', minFontSize: 50.0, maxFontSize: 100.0) the text is rendered at the default font size (12.0).

simc commented 6 years ago

I didn't have time to write the tests yet. There are a few old ones which fail.

I'm already using v0.2.0 in production and it works perfectly. Could you show me how you use the widget?

You can also try the demo app.

apaatsio commented 6 years ago

Here's a simple example app that is not working expectedly for me:

Widget build(BuildContext context) {
  return MaterialApp(
    home: SafeArea(
      top: true,
      child: Material(
        child: Row(
          children: [
            Expanded(
              child: AutoSizeText(
                'This should be at least size 25.0',
                minFontSize: 25.0,
              ))]))));
}

Edit: Here's a screenshot. It looks like the default font size. I expected the text to be bigger.

screenshot_20181010-131914

simc commented 6 years ago

Thank you! I can reproduce the problem and I'm working on it ;)

simc commented 6 years ago

Sorry for the inconvenience. It should work now (v0.2.1). Please open the issue again if there are still problems.

apaatsio commented 6 years ago

Now the minFontSize works in the sense that the font size is exactly at minFontSize. But it still doesn't stretch the text to the full width of the screen (using the code example I posted in the earlier comment).

2018-10-10 15 25 31

simc commented 6 years ago

The font size does not exceed the fontSize of your TextStyle (or the inherited fontSize if none is set). Try something like

AutoSizeText(
  "This should work now",
  style: TextStyle(fontSize:100.0),
  minFontSize: 25.0,
)
apaatsio commented 6 years ago

Ok, that way it works exactly as I want. Thanks!