Skip to content

Commit db0c1d8

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

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
@@ -818,7 +818,11 @@ class MathBlock extends StatelessWidget {
818818
children: [TextSpan(text: node.texSource)])));
819819
}
820820

821-
return _Katex(inline: false, nodes: nodes);
821+
return Center(
822+
child: SingleChildScrollViewWithScrollbar(
823+
scrollDirection: Axis.horizontal,
824+
child: _Katex(
825+
nodes: nodes)));
822826
}
823827
}
824828

@@ -831,24 +835,15 @@ const kBaseKatexTextStyle = TextStyle(
831835

832836
class _Katex extends StatelessWidget {
833837
const _Katex({
834-
required this.inline,
835838
required this.nodes,
836839
});
837840

838-
final bool inline;
839841
final List<KatexNode> nodes;
840842

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

845-
if (!inline) {
846-
widget = Center(
847-
child: SingleChildScrollViewWithScrollbar(
848-
scrollDirection: Axis.horizontal,
849-
child: widget));
850-
}
851-
852847
return Directionality(
853848
textDirection: TextDirection.ltr,
854849
child: DefaultTextStyle(
@@ -1265,7 +1260,7 @@ class _InlineContentBuilder {
12651260
: WidgetSpan(
12661261
alignment: PlaceholderAlignment.baseline,
12671262
baseline: TextBaseline.alphabetic,
1268-
child: _Katex(inline: true, nodes: nodes));
1263+
child: _Katex(nodes: nodes));
12691264

12701265
case GlobalTimeNode():
12711266
return WidgetSpan(alignment: PlaceholderAlignment.middle,

0 commit comments

Comments
 (0)