Skip to content

Commit

Permalink
Constrain _RenderScaledInlineWidget child size in computeDryLayout (#…
Browse files Browse the repository at this point in the history
…131765)
  • Loading branch information
tgucio authored Aug 7, 2023
1 parent 7de053b commit 55044a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/widgets/widget_span.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/test/widgets/text_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
),
),
),
Expand Down

0 comments on commit 55044a6

Please sign in to comment.