Skip to content

Commit 55044a6

Browse files
authored
Constrain _RenderScaledInlineWidget child size in computeDryLayout (flutter#131765)
1 parent 7de053b commit 55044a6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/flutter/lib/src/widgets/widget_span.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ class _RenderScaledInlineWidget extends RenderBox with RenderObjectWithChildMixi
385385
Size computeDryLayout(BoxConstraints constraints) {
386386
assert(!constraints.hasBoundedHeight);
387387
final Size unscaledSize = child?.computeDryLayout(BoxConstraints(maxWidth: constraints.maxWidth / scale)) ?? Size.zero;
388-
return unscaledSize * scale;
388+
return constraints.constrain(unscaledSize * scale);
389389
}
390390

391391
@override

packages/flutter/test/widgets/text_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ void main() {
273273
textDirection: TextDirection.ltr,
274274
child: Center(
275275
child: SizedBox(
276-
width: 100.3,
277-
child: Text.rich(WidgetSpan(child: Row()), textScaleFactor: 0.3),
276+
width: 502.5454545454545,
277+
child: Text.rich(WidgetSpan(child: Row()), textScaleFactor: 0.95),
278278
),
279279
),
280280
),

0 commit comments

Comments
 (0)