File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -375,7 +375,7 @@ class _RenderScaledInlineWidget extends RenderBox with RenderObjectWithChildMixi
375375    // Only constrain the width to the maximum width of the paragraph. 
376376    // Leave height unconstrained, which will overflow if expanded past. 
377377    child.layout (BoxConstraints (maxWidth:  constraints.maxWidth /  scale), parentUsesSize:  true );
378-     size =  child.size *  scale;
378+     size =  constraints. constrain ( child.size *  scale) ;
379379  }
380380
381381  @override 
Original file line number Diff line number Diff line change @@ -266,6 +266,23 @@ void main() {
266266    expect (renderText.size.height, singleLineHeight *  textScaleFactor *  3 );
267267  });
268268
269+   testWidgets ("Inline widgets' scaled sizes are constrained" , (WidgetTester  tester) async  {
270+     // Regression test for https://github.com/flutter/flutter/issues/130588 
271+     await  tester.pumpWidget (
272+       const  Directionality (
273+         textDirection:  TextDirection .ltr,
274+         child:  Center (
275+           child:  SizedBox (
276+             width:  100.3 ,
277+             child:  Text .rich (WidgetSpan (child:  Row ()), textScaleFactor:  0.3 ),
278+           ),
279+         ),
280+       ),
281+     );
282+ 
283+     expect (tester.takeException (), isNull);
284+   });
285+ 
269286  testWidgets ('semanticsLabel can override text label' , (WidgetTester  tester) async  {
270287    final  SemanticsTester  semantics =  SemanticsTester (tester);
271288    await  tester.pumpWidget (
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments