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

Add textBuilder(double fontSize, TextStyle style, int maxLines) #84

Open esDotDev opened 3 years ago

esDotDev commented 3 years ago

It would be nice to use this widget's ability to calculate the optimal font size, but replace it with our own Widgets that use that info.

For example, I might want to replace the default Text(), with a TextFormField(). Having a builder would be a simple, flexible approach serving any future use cases.

This should be as simple as adding:

if(widget.textBuilder != null) return widget.textBuilder(fontSize, style, maxLines);

@ line 414- auto_size_text.dart