Skip to content

Commit aa3b96c

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

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

lib/widgets/content.dart

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -817,10 +817,12 @@ class MathBlock extends StatelessWidget {
817817
children: [TextSpan(text: node.texSource)])));
818818
}
819819

820-
return _Katex(
821-
inline: false,
822-
textStyle: ContentTheme.of(context).textStylePlainParagraph,
823-
nodes: nodes);
820+
return Center(
821+
child: SingleChildScrollViewWithScrollbar(
822+
scrollDirection: Axis.horizontal,
823+
child: _Katex(
824+
textStyle: ContentTheme.of(context).textStylePlainParagraph,
825+
nodes: nodes)));
824826
}
825827
}
826828

@@ -841,26 +843,17 @@ TextStyle mkBaseKatexTextStyle(TextStyle style) {
841843

842844
class _Katex extends StatelessWidget {
843845
const _Katex({
844-
required this.inline,
845846
required this.textStyle,
846847
required this.nodes,
847848
});
848849

849-
final bool inline;
850850
final TextStyle textStyle;
851851
final List<KatexNode> nodes;
852852

853853
@override
854854
Widget build(BuildContext context) {
855855
Widget widget = _KatexNodeList(nodes: nodes);
856856

857-
if (!inline) {
858-
widget = Center(
859-
child: SingleChildScrollViewWithScrollbar(
860-
scrollDirection: Axis.horizontal,
861-
child: widget));
862-
}
863-
864857
return Directionality(
865858
textDirection: TextDirection.ltr,
866859
child: DefaultTextStyle.merge(
@@ -1335,7 +1328,7 @@ class _InlineContentBuilder {
13351328
: WidgetSpan(
13361329
alignment: PlaceholderAlignment.baseline,
13371330
baseline: TextBaseline.alphabetic,
1338-
child: _Katex(inline: true, textStyle: widget.style, nodes: nodes));
1331+
child: _Katex(textStyle: widget.style, nodes: nodes));
13391332

13401333
case GlobalTimeNode():
13411334
return WidgetSpan(alignment: PlaceholderAlignment.middle,

0 commit comments

Comments
 (0)