Closed tofutim closed 2 years ago
I feel guilty doing this, but
final postScaleSize = Size(renderBox.size.width * textScaleFactor,
renderBox.size.height * textScaleFactor);
_targetCenter = renderBox.localToGlobal(postScaleSize.center(Offset.zero),
ancestor: overlay);
and
///
/// TextScaleFactor when scaling text in WidgetSpan
final double textScaleFactor;
did the trick for me.
I bet it is possible to get the textScaleFactor if we can track back to the parent widgetspan...
when my text scale is 1.0, I get
as expected, but somehow when I increase the textscale, say to 2.0, I end up with the arrow no longer in the middle
hmm, in fact, it is pointing to .25, .25, instead of .5, .5 of the widget.
Update. It seems that "renderbox" gives the same size regardless of whether textscale is 2.0 or 1.0 which is the problem.
Update 2. https://github.com/flutter/flutter/issues/70885 "RenderObjects of WidgetSpan.child not scaled according to textScaleFactor #70885"; indeed I do have the text inside a WidgetSpan.