Constrain _RenderScaledInlineWidget child size in computeDryLayout (#131765)

This commit is contained in:
Tomasz Gucio 2023-08-07 10:28:07 +02:00 committed by GitHub
parent 7de053b2b8
commit 55044a605f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -385,7 +385,7 @@ class _RenderScaledInlineWidget extends RenderBox with RenderObjectWithChildMixi
Size computeDryLayout(BoxConstraints constraints) {
assert(!constraints.hasBoundedHeight);
final Size unscaledSize = child?.computeDryLayout(BoxConstraints(maxWidth: constraints.maxWidth / scale)) ?? Size.zero;
return unscaledSize * scale;
return constraints.constrain(unscaledSize * scale);
}
@override

View File

@ -273,8 +273,8 @@ void main() {
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox(
width: 100.3,
child: Text.rich(WidgetSpan(child: Row()), textScaleFactor: 0.3),
width: 502.5454545454545,
child: Text.rich(WidgetSpan(child: Row()), textScaleFactor: 0.95),
),
),
),