Skip to content

Commit cab066d

Browse files
katex: Render overline and underline with using DecoratedBox.
Implements the visual rendering of overline and underline elements using DecoratedBox with a bottom border. When a span has a solid border-bottom-style and border width, we wrap the widget in a DecoratedBox with a BorderSide. The border color matches the katexSpan color (or defaults to the current text style color), and the border width is calculated from the em value specified in the inline styles.
1 parent 696342e commit cab066d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/widgets/katex.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ class _KatexSpan extends StatelessWidget {
123123
null => null,
124124
};
125125

126+
if (styles.borderBottomStyle == KatexSpanBorderBottomStyle.solid &&
127+
styles.borderBottomWidthEm != null) {
128+
final borderColor = color ?? DefaultTextStyle.of(context).style.color!;
129+
final borderWidth = styles.borderBottomWidthEm! * em;
130+
131+
widget = DecoratedBox(
132+
decoration: BoxDecoration(
133+
border: Border(
134+
bottom: BorderSide(color: borderColor, width: borderWidth, style: BorderStyle.solid))),
135+
child: widget,
136+
);
137+
}
138+
126139
TextStyle? textStyle;
127140
if (fontFamily != null ||
128141
fontSize != null ||

0 commit comments

Comments
 (0)