_RenderScaledInlineWidget constrains child size (#130648)
Fixes https://github.com/flutter/flutter/issues/130588
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user