Unverified Commit 0d1cc33b authored by LongCatIsLooong's avatar LongCatIsLooong Committed by GitHub

`_RenderScaledInlineWidget` constrains child size (#130648)

Fixes https://github.com/flutter/flutter/issues/130588
parent bf4d6597
......@@ -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
......
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment