Skip to content

Commit 6fde159

Browse files
committed
katex [nfc]: s/textStyle/ambientTextStyle/, like UserMention and GlobalTime
1 parent 51999fa commit 6fde159

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/widgets/content.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ class MathBlock extends StatelessWidget {
822822
child: SingleChildScrollViewWithScrollbar(
823823
scrollDirection: Axis.horizontal,
824824
child: KatexWidget(
825-
textStyle: ContentTheme.of(context).textStylePlainParagraph,
825+
ambientTextStyle: ContentTheme.of(context).textStylePlainParagraph,
826826
nodes: nodes))));
827827
}
828828
}
@@ -1145,7 +1145,7 @@ class _InlineContentBuilder {
11451145
: WidgetSpan(
11461146
alignment: PlaceholderAlignment.baseline,
11471147
baseline: TextBaseline.alphabetic,
1148-
child: KatexWidget(textStyle: widget.style, nodes: nodes));
1148+
child: KatexWidget(ambientTextStyle: widget.style, nodes: nodes));
11491149

11501150
case GlobalTimeNode():
11511151
return WidgetSpan(alignment: PlaceholderAlignment.middle,

lib/widgets/katex.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import 'content.dart';
1515
/// and applies the CSS styles defined in .katex class in katex.scss :
1616
/// https://github.com/KaTeX/KaTeX/blob/613c3da8/src/styles/katex.scss#L13-L15
1717
///
18-
/// Requires the [style.fontSize] to be non-null.
19-
TextStyle mkBaseKatexTextStyle(TextStyle style, Color baseColor) {
20-
return style.copyWith(
18+
/// Requires the [ambientStyle.fontSize] to be non-null.
19+
TextStyle mkBaseKatexTextStyle(TextStyle ambientStyle, Color baseColor) {
20+
return ambientStyle.copyWith(
2121
////// Overrides of our own styles:
2222
2323
// Bold formatting is removed below by setting FontWeight.normal…
@@ -32,7 +32,7 @@ TextStyle mkBaseKatexTextStyle(TextStyle style, Color baseColor) {
3232

3333
////// From the .katex class in katex.scss:
3434
35-
fontSize: style.fontSize! * 1.21,
35+
fontSize: ambientStyle.fontSize! * 1.21,
3636
fontFamily: 'KaTeX_Main',
3737
height: 1.2,
3838
fontWeight: FontWeight.normal,
@@ -47,11 +47,11 @@ TextStyle mkBaseKatexTextStyle(TextStyle style, Color baseColor) {
4747
class KatexWidget extends StatelessWidget {
4848
const KatexWidget({
4949
super.key,
50-
required this.textStyle,
50+
required this.ambientTextStyle,
5151
required this.nodes,
5252
});
5353

54-
final TextStyle textStyle;
54+
final TextStyle ambientTextStyle;
5555
final List<KatexNode> nodes;
5656

5757
@override
@@ -61,7 +61,7 @@ class KatexWidget extends StatelessWidget {
6161
return Directionality(
6262
textDirection: TextDirection.ltr,
6363
child: DefaultTextStyle(
64-
style: mkBaseKatexTextStyle(textStyle,
64+
style: mkBaseKatexTextStyle(ambientTextStyle,
6565
ContentTheme.of(context).textStylePlainParagraph.color!),
6666
child: widget));
6767
}

0 commit comments

Comments
 (0)