@@ -78,6 +78,11 @@ class HtmlParser extends StatelessWidget {
78
78
textSpan: parsedTree,
79
79
style: cleanedTree.style,
80
80
textScaleFactor: MediaQuery .of (context).textScaleFactor,
81
+ renderContext: RenderContext (
82
+ buildContext: context,
83
+ parser: this ,
84
+ style: Style .fromTextStyle (Theme .of (context).textTheme.bodyText2),
85
+ ),
81
86
);
82
87
}
83
88
@@ -319,6 +324,7 @@ class HtmlParser extends StatelessWidget {
319
324
style: newContext.style.generateTextStyle (),
320
325
),
321
326
style: newContext.style,
327
+ renderContext: context,
322
328
),
323
329
)
324
330
],
@@ -409,6 +415,7 @@ class HtmlParser extends StatelessWidget {
409
415
[],
410
416
),
411
417
style: newContext.style,
418
+ renderContext: context,
412
419
),
413
420
),
414
421
);
@@ -757,6 +764,7 @@ class ContainerSpan extends StatelessWidget {
757
764
children: children,
758
765
),
759
766
style: newContext.style,
767
+ renderContext: newContext,
760
768
),
761
769
);
762
770
}
@@ -766,20 +774,20 @@ class StyledText extends StatelessWidget {
766
774
final InlineSpan textSpan;
767
775
final Style style;
768
776
final double textScaleFactor;
777
+ final RenderContext renderContext;
769
778
770
779
const StyledText ({
771
780
this .textSpan,
772
781
this .style,
773
782
this .textScaleFactor = 1.0 ,
783
+ this .renderContext,
774
784
});
775
785
776
786
@override
777
787
Widget build (BuildContext context) {
778
788
return SizedBox (
779
- width:
780
- style.display == Display .BLOCK || style.display == Display .LIST_ITEM
781
- ? double .infinity
782
- : null ,
789
+ width: (style.display == Display .BLOCK || style.display == Display .LIST_ITEM ) && renderContext.parser.shrinkWrap != true
790
+ ? double .infinity : renderContext.parser.shrinkWrap == true ? MediaQuery .of (renderContext.buildContext).size.width : null ,
783
791
child: Text .rich (
784
792
textSpan,
785
793
style: style.generateTextStyle (),
0 commit comments