Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -375,7 +375,7 @@ class _RenderScaledInlineWidget extends RenderBox with RenderObjectWithChildMixi
// Only constrain the width to the maximum width of the paragraph.
// Leave height unconstrained, which will overflow if expanded past.
child.layout(BoxConstraints(maxWidth: constraints.maxWidth / scale), parentUsesSize: true);
size = child.size * scale;
size = constraints.constrain(child.size * scale);
}

@override
Expand Down
17 changes: 17 additions & 0 deletions packages/flutter/test/widgets/text_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,23 @@ void main() {
expect(renderText.size.height, singleLineHeight * textScaleFactor * 3);
});

testWidgets("Inline widgets' scaled sizes are constrained", (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/130588
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox(
width: 100.3,
child: Text.rich(WidgetSpan(child: Row()), textScaleFactor: 0.3),
),
),
),
);

expect(tester.takeException(), isNull);
});

testWidgets('semanticsLabel can override text label', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester);
await tester.pumpWidget(
Expand Down