@@ -275,6 +275,7 @@ class ParseContext {
275
275
bool spansOnly = false ;
276
276
bool inBlock = false ;
277
277
TextStyle childStyle;
278
+ TextStyle linkStyle;
278
279
bool shrinkToFit;
279
280
int maxLines;
280
281
double indentPadding = 0 ;
@@ -292,6 +293,7 @@ class ParseContext {
292
293
this .spansOnly = false ,
293
294
this .inBlock = false ,
294
295
this .childStyle,
296
+ this .linkStyle,
295
297
this .shrinkToFit,
296
298
this .maxLines,
297
299
this .indentPadding = 0 ,
@@ -312,6 +314,7 @@ class ParseContext {
312
314
spansOnly = parseContext.spansOnly;
313
315
inBlock = parseContext.inBlock;
314
316
childStyle = parseContext.childStyle ?? TextStyle ();
317
+ linkStyle = parseContext.linkStyle ?? TextStyle ();
315
318
shrinkToFit = parseContext.shrinkToFit;
316
319
maxLines = parseContext.maxLines;
317
320
indentPadding = parseContext.indentPadding;
@@ -550,6 +553,7 @@ class HtmlRichTextParser extends StatelessWidget {
550
553
ParseContext parseContext = ParseContext (
551
554
rootWidgetList: widgetList,
552
555
childStyle: DefaultTextStyle .of (context).style,
556
+ linkStyle: linkStyle ?? TextStyle (),
553
557
shrinkToFit: shrinkToFit,
554
558
maxLines: maxLines,
555
559
indentSize: indentSize,
@@ -647,7 +651,7 @@ class HtmlRichTextParser extends StatelessWidget {
647
651
themeData: Theme .of (buildContext),
648
652
onLinkTap: onLinkTap,
649
653
textStyle: parseContext.childStyle,
650
- linkStyle: parseContext.childStyle.merge (linkStyle),
654
+ linkStyle: parseContext.childStyle.merge (parseContext. linkStyle),
651
655
);
652
656
653
657
// in this class, a ParentElement must be a BlockText, LinkTextSpan, Row, Column, TextSpan
@@ -716,6 +720,10 @@ class HtmlRichTextParser extends StatelessWidget {
716
720
backgroundColor: monokaiTheme['root' ].backgroundColor,
717
721
color: monokaiTheme['root' ].color,
718
722
));
723
+ nextContext.linkStyle = parseContext.linkStyle.merge (TextStyle (
724
+ fontFamily: 'monospace' ,
725
+ backgroundColor: monokaiTheme['root' ].backgroundColor,
726
+ ));
719
727
break ;
720
728
case "ins" :
721
729
case "u" :
0 commit comments