Skip to content

Commit 0aadb27

Browse files
katex: Wrap KatexVlistNode in IntrinsicWidth
Ensures overline and underline widths match text’s width instead of expanding to 100% of the container.
1 parent 3d3b1c1 commit 0aadb27

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/widgets/katex.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,13 @@ class _KatexVlist extends StatelessWidget {
232232
Widget build(BuildContext context) {
233233
final em = DefaultTextStyle.of(context).style.fontSize!;
234234

235-
return Stack(children: List.unmodifiable(node.rows.map((row) {
236-
return Transform.translate(
237-
offset: Offset(0, row.verticalOffsetEm * em),
238-
child: _KatexSpan(row.node));
239-
})));
235+
return IntrinsicWidth(
236+
child: Stack(children: List.unmodifiable(node.rows.map((row) {
237+
return Transform.translate(
238+
offset: Offset(0, row.verticalOffsetEm * em),
239+
child: _KatexSpan(row.node));
240+
}))),
241+
);
240242
}
241243
}
242244

0 commit comments

Comments
 (0)