auto_size_text icon indicating copy to clipboard operation
auto_size_text copied to clipboard

Get Font Size

Open yosus opened this issue 3 years ago • 4 comments

Would like a feature to get the font-size used after layout. This is so I can standardize the font-size in adjacent boxes (on same page)

GlobalKey  textKey = GlobalKey();
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) {

   test.getActualFontSizeUsed();

});

// In build
Widget test =  AutoSizeText(
   'Trying to get Font Size',
   key: textKey,
);

yosus avatar Dec 09 '22 06:12 yosus

I think this would be quite easy to add support for, but I wonder if it wouldn't be better to have this in a callback instead, as it is calculated on build.

The way you would use this to "standardize the font-size" is a bit questionable to me, although I do understand the sentiment.

I'm just a user so I don't have much to say, whether it's a method or a callback. I wouldn't mind implementing it though.

Xazin avatar Dec 10 '22 22:12 Xazin

I also would like this ability. I have a SizedBox containing my text. If the text resizes, I want the SizedBox to resize in proportion to the text size. Right now, I have no ability to do that.

hanskokx avatar Aug 16 '23 20:08 hanskokx

I would also like to determine the adjusted font size. This is because I'm converting an AutoSizeText widget into a PDF Text widget, and I need to specify the exact font size after resizing.

raheel73 avatar Sep 21 '23 05:09 raheel73

I still want to get the resized font size

raheel73 avatar Sep 30 '23 19:09 raheel73