Skip to content

Commit 48d4cd5

Browse files
committed
katex [nfc]: s/textStyle/ambientTextStyle/, like UserMention and GlobalTime
1 parent 9f0757d commit 48d4cd5

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…
@@ -39,7 +39,7 @@ TextStyle mkBaseKatexTextStyle(TextStyle style, Color baseColor) {
3939

4040
////// From the .katex class in katex.scss:
4141
42-
fontSize: style.fontSize! * 1.21,
42+
fontSize: ambientStyle.fontSize! * 1.21,
4343
fontFamily: 'KaTeX_Main',
4444
height: 1.2,
4545
fontWeight: FontWeight.normal,
@@ -54,11 +54,11 @@ TextStyle mkBaseKatexTextStyle(TextStyle style, Color baseColor) {
5454
class KatexWidget extends StatelessWidget {
5555
const KatexWidget({
5656
super.key,
57-
required this.textStyle,
57+
required this.ambientTextStyle,
5858
required this.nodes,
5959
});
6060

61-
final TextStyle textStyle;
61+
final TextStyle ambientTextStyle;
6262
final List<KatexNode> nodes;
6363

6464
@override
@@ -68,7 +68,7 @@ class KatexWidget extends StatelessWidget {
6868
return Directionality(
6969
textDirection: TextDirection.ltr,
7070
child: DefaultTextStyle(
71-
style: mkBaseKatexTextStyle(textStyle,
71+
style: mkBaseKatexTextStyle(ambientTextStyle,
7272
ContentTheme.of(context).textStylePlainParagraph.color!),
7373
child: widget));
7474
}

0 commit comments

Comments
 (0)