Skip to content

Commit d8c0465

Browse files
committed
fix: underlines of "u" tags rendered in wrong color
When you use a "u" html tag, you expect the underline to match the textcolor. Therefore we need to get the style of the child element and use it's color if it exists.
1 parent 71feaf6 commit d8c0465

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/src/builtins/styled_element_builtin.dart

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,17 @@ class StyledElementBuiltIn extends HtmlExtension {
414414
continue monospace;
415415
underline:
416416
case "u":
417-
styledElement.style = Style(
418-
textDecoration: TextDecoration.underline,
419-
);
417+
for (var child in styledElement.children) {
418+
if (child.attributes.containsKey("style")) {
419+
final newStyle = inlineCssToStyle(child.attributes["style"], null);
420+
if (newStyle != null) {
421+
styledElement.style = styledElement.style.merge(Style(textDecorationColor: newStyle.color));
422+
}
423+
}
424+
}
425+
styledElement.style = styledElement.style.merge(Style(
426+
textDecoration: TextDecoration.underline
427+
));
420428
break;
421429
case "var":
422430
continue italics;

0 commit comments

Comments
 (0)