Skip to content

Commit d1eeea7

Browse files
katex: Render overline and underline with border decoration.
Implements the visual rendering of overline and underline elements using Flutter's 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 460d426 commit d1eeea7

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
@@ -125,6 +125,19 @@ class _KatexSpan extends StatelessWidget {
125125
null => null,
126126
};
127127

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

0 commit comments

Comments
 (0)