Skip to content

Commit bd353ef

Browse files
rajveermalviyagnprice
authored andcommitted
content: Add a workaround for incorrect sizing in WidgetSpan, for KaTeX
1 parent b38301f commit bd353ef

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/widgets/content.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,9 +873,15 @@ class _KatexNodeList extends StatelessWidget {
873873
return WidgetSpan(
874874
alignment: PlaceholderAlignment.baseline,
875875
baseline: TextBaseline.alphabetic,
876-
child: switch (e) {
877-
KatexSpanNode() => _KatexSpan(e),
878-
});
876+
// Work around a bug where text inside a WidgetSpan could be scaled
877+
// multiple times incorrectly, if the system font scale is larger
878+
// than 1x.
879+
// See: https://github.com/flutter/flutter/issues/126962
880+
child: MediaQuery(
881+
data: MediaQueryData(textScaler: TextScaler.noScaling),
882+
child: switch (e) {
883+
KatexSpanNode() => _KatexSpan(e),
884+
}));
879885
}))));
880886
}
881887
}

0 commit comments

Comments
 (0)