Skip to content

Commit 5677317

Browse files
rajveermalviyagnprice
authored andcommitted
content [nfc]: Remove the inline property in _Katex widget
And inline the behaviour for `inline: false` in MathBlock widget.
1 parent 02a2898 commit 5677317

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

lib/widgets/content.dart

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,13 @@ class MathBlock extends StatelessWidget {
822822
children: [TextSpan(text: node.texSource)])));
823823
}
824824

825-
return _Katex(inline: false, nodes: nodes);
825+
return Center(
826+
child: Directionality(
827+
textDirection: TextDirection.ltr,
828+
child: SingleChildScrollViewWithScrollbar(
829+
scrollDirection: Axis.horizontal,
830+
child: _Katex(
831+
nodes: nodes))));
826832
}
827833
}
828834

@@ -835,24 +841,15 @@ const kBaseKatexTextStyle = TextStyle(
835841

836842
class _Katex extends StatelessWidget {
837843
const _Katex({
838-
required this.inline,
839844
required this.nodes,
840845
});
841846

842-
final bool inline;
843847
final List<KatexNode> nodes;
844848

845849
@override
846850
Widget build(BuildContext context) {
847851
Widget widget = _KatexNodeList(nodes: nodes);
848852

849-
if (!inline) {
850-
widget = Center(
851-
child: SingleChildScrollViewWithScrollbar(
852-
scrollDirection: Axis.horizontal,
853-
child: widget));
854-
}
855-
856853
return Directionality(
857854
textDirection: TextDirection.ltr,
858855
child: DefaultTextStyle(
@@ -1274,7 +1271,7 @@ class _InlineContentBuilder {
12741271
: WidgetSpan(
12751272
alignment: PlaceholderAlignment.baseline,
12761273
baseline: TextBaseline.alphabetic,
1277-
child: _Katex(inline: true, nodes: nodes));
1274+
child: _Katex(nodes: nodes));
12781275

12791276
case GlobalTimeNode():
12801277
return WidgetSpan(alignment: PlaceholderAlignment.middle,

0 commit comments

Comments
 (0)