@@ -595,16 +595,20 @@ void main() {
595
595
final content = ContentExample .mathBlockKatexSizing;
596
596
await prepareContent (tester, plainContent (content.html));
597
597
598
+ final context = tester.element (find.byType (MathBlock ));
599
+ final baseTextStyle =
600
+ mkBaseKatexTextStyle (ContentTheme .of (context).textStylePlainParagraph);
601
+
598
602
final mathBlockNode = content.expectedNodes.single as MathBlockNode ;
599
603
final baseNode = mathBlockNode.nodes! .single as KatexSpanNode ;
600
604
final nodes = baseNode.nodes! .skip (1 ); // Skip .strut node.
601
605
for (var katexNode in nodes) {
602
606
katexNode = katexNode as KatexSpanNode ;
603
- final fontSize = katexNode.styles.fontSizeEm! * kBaseKatexTextStyle .fontSize! ;
607
+ final fontSize = katexNode.styles.fontSizeEm! * baseTextStyle .fontSize! ;
604
608
checkKatexText (tester, katexNode.text! ,
605
609
fontFamily: 'KaTeX_Main' ,
606
610
fontSize: fontSize,
607
- fontHeight: kBaseKatexTextStyle .height! );
611
+ fontHeight: baseTextStyle .height! );
608
612
}
609
613
});
610
614
@@ -617,17 +621,21 @@ void main() {
617
621
final content = ContentExample .mathBlockKatexNestedSizing;
618
622
await prepareContent (tester, plainContent (content.html));
619
623
620
- var fontSize = 0.5 * kBaseKatexTextStyle.fontSize! ;
624
+ final context = tester.element (find.byType (MathBlock ));
625
+ final baseTextStyle =
626
+ mkBaseKatexTextStyle (ContentTheme .of (context).textStylePlainParagraph);
627
+
628
+ var fontSize = 0.5 * baseTextStyle.fontSize! ;
621
629
checkKatexText (tester, '1' ,
622
630
fontFamily: 'KaTeX_Main' ,
623
631
fontSize: fontSize,
624
- fontHeight: kBaseKatexTextStyle .height! );
632
+ fontHeight: baseTextStyle .height! );
625
633
626
634
fontSize = 4.976 * fontSize;
627
635
checkKatexText (tester, '2' ,
628
636
fontFamily: 'KaTeX_Main' ,
629
637
fontSize: fontSize,
630
- fontHeight: kBaseKatexTextStyle .height! );
638
+ fontHeight: baseTextStyle .height! );
631
639
});
632
640
633
641
testWidgets ('displays KaTeX content with different delimiter sizing' , (tester) async {
@@ -643,13 +651,15 @@ void main() {
643
651
final baseNode = mathBlockNode.nodes! .single as KatexSpanNode ;
644
652
var nodes = baseNode.nodes! .skip (1 ); // Skip .strut node.
645
653
646
- final fontSize = kBaseKatexTextStyle.fontSize! ;
654
+ final context = tester.element (find.byType (MathBlock ));
655
+ final baseTextStyle =
656
+ mkBaseKatexTextStyle (ContentTheme .of (context).textStylePlainParagraph);
647
657
648
658
final firstNode = nodes.first as KatexSpanNode ;
649
659
checkKatexText (tester, firstNode.text! ,
650
660
fontFamily: 'KaTeX_Main' ,
651
- fontSize: fontSize,
652
- fontHeight: kBaseKatexTextStyle .height! );
661
+ fontSize: baseTextStyle. fontSize! ,
662
+ fontHeight: baseTextStyle .height! );
653
663
nodes = nodes.skip (1 );
654
664
655
665
for (var katexNode in nodes) {
@@ -658,8 +668,8 @@ void main() {
658
668
final fontFamily = katexNode.styles.fontFamily! ;
659
669
checkKatexText (tester, katexNode.text! ,
660
670
fontFamily: fontFamily,
661
- fontSize: fontSize,
662
- fontHeight: kBaseKatexTextStyle .height! );
671
+ fontSize: baseTextStyle. fontSize! ,
672
+ fontHeight: baseTextStyle .height! );
663
673
}
664
674
}, skip: true ); // TODO: Re-enable this test after adding support for parsing
665
675
// `vertical-align` in inline styles. Currently it fails
0 commit comments