Skip to content

Commit f17ab35

Browse files
content [nfc]: Remove the inline property in _Katex widget
And inline the behaviour for `inline: false` in MathBlock widget.
1 parent 80dcd47 commit f17ab35

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/widgets/content.dart

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,11 @@ class MathBlock extends StatelessWidget {
820820
children: [TextSpan(text: node.texSource)])));
821821
}
822822

823-
return _Katex(inline: false, nodes: nodes);
823+
return Center(
824+
child: SingleChildScrollViewWithScrollbar(
825+
scrollDirection: Axis.horizontal,
826+
child: _Katex(
827+
nodes: nodes)));
824828
}
825829
}
826830

@@ -833,24 +837,15 @@ const kBaseKatexTextStyle = TextStyle(
833837

834838
class _Katex extends StatelessWidget {
835839
const _Katex({
836-
required this.inline,
837840
required this.nodes,
838841
});
839842

840-
final bool inline;
841843
final List<KatexNode> nodes;
842844

843845
@override
844846
Widget build(BuildContext context) {
845847
Widget widget = _KatexNodeList(nodes: nodes);
846848

847-
if (!inline) {
848-
widget = Center(
849-
child: SingleChildScrollViewWithScrollbar(
850-
scrollDirection: Axis.horizontal,
851-
child: widget));
852-
}
853-
854849
return Directionality(
855850
textDirection: TextDirection.ltr,
856851
child: DefaultTextStyle(
@@ -1272,7 +1267,7 @@ class _InlineContentBuilder {
12721267
: WidgetSpan(
12731268
alignment: PlaceholderAlignment.baseline,
12741269
baseline: TextBaseline.alphabetic,
1275-
child: _Katex(inline: true, nodes: nodes));
1270+
child: _Katex(nodes: nodes));
12761271

12771272
case GlobalTimeNode():
12781273
return WidgetSpan(alignment: PlaceholderAlignment.middle,

0 commit comments

Comments
 (0)