auto_size_text icon indicating copy to clipboard operation
auto_size_text copied to clipboard

Allow for individual scale factor in a group

Open davystrong opened this issue 5 years ago • 2 comments

I am having a problem were I am using two different font families that I would like to automatically resize together, so I put them both in the same group. However, one of the fonts looks smaller than the other, using the same font size. I would like to be able to set a scale factor for one that wouldn't affect the other. Both of them would still resize at the same time but they would always maintain the same ratio. I tried using textScaleFactor, however this doesn't seem to be independent: the second widget seems to use the same textScaleFactor as the first.

davystrong avatar Jan 23 '20 17:01 davystrong

If I modify the build function of _AutoSizeTextState like this:

if (widget.group != null) {
   widget.group._updateFontSize(this, fontSize / widget.factor);
   text =
      _buildText(widget.group._fontSize * widget.factor, style, maxLines);
}

(adding factor in the constructor), it does exactly what I want. I could work on a PR but I imagine that this overlaps with the expected functionality of textScaleFactor. Should it be changed or should a new parameter be added (if you think this is useful)?

davystrong avatar Jan 23 '20 18:01 davystrong

I decided to create a new parameter groupScaleFactor as textScaleFactor seems to be linked to accessibility.

davystrong avatar Feb 21 '20 01:02 davystrong