Skip to content

Commit afcdea7

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

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

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

@@ -842,26 +844,17 @@ TextStyle mkBaseKatexTextStyle(TextStyle style) {
842844

843845
class _Katex extends StatelessWidget {
844846
const _Katex({
845-
required this.inline,
846847
required this.textStyle,
847848
required this.nodes,
848849
});
849850

850-
final bool inline;
851851
final TextStyle textStyle;
852852
final List<KatexNode> nodes;
853853

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

858-
if (!inline) {
859-
widget = Center(
860-
child: SingleChildScrollViewWithScrollbar(
861-
scrollDirection: Axis.horizontal,
862-
child: widget));
863-
}
864-
865858
return Directionality(
866859
textDirection: TextDirection.ltr,
867860
child: DefaultTextStyle.merge(
@@ -1336,7 +1329,7 @@ class _InlineContentBuilder {
13361329
: WidgetSpan(
13371330
alignment: PlaceholderAlignment.baseline,
13381331
baseline: TextBaseline.alphabetic,
1339-
child: _Katex(inline: true, textStyle: widget.style, nodes: nodes));
1332+
child: _Katex(textStyle: widget.style, nodes: nodes));
13401333

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

0 commit comments

Comments
 (0)