close #149 underline strike through color according to text color (#150)

pull/157/head
Thea Choem 4 years ago committed by GitHub
parent 63c2ef9d0e
commit 14817ec752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      lib/widgets/text_line.dart

@ -119,6 +119,7 @@ class TextLine extends StatelessWidget {
final textNode = node as leaf.Text;
final style = textNode.style;
var res = const TextStyle();
final color = textNode.style.attributes[Attribute.color.key];
<String, TextStyle?>{
Attribute.bold.key: defaultStyles.bold,
@ -128,7 +129,16 @@ class TextLine extends StatelessWidget {
Attribute.strikeThrough.key: defaultStyles.strikeThrough,
}.forEach((k, s) {
if (style.values.any((v) => v.key == k)) {
res = _merge(res, s!);
if (k == Attribute.underline.key || k == Attribute.strikeThrough.key) {
var textColor = defaultStyles.color;
if (color?.value is String) {
textColor = stringToColor(color?.value);
}
res = _merge(res.copyWith(decorationColor: textColor),
s!.copyWith(decorationColor: textColor));
} else {
res = _merge(res, s!);
}
}
});
@ -159,7 +169,6 @@ class TextLine extends StatelessWidget {
}
}
final color = textNode.style.attributes[Attribute.color.key];
if (color != null && color.value != null) {
var textColor = defaultStyles.color;
if (color.value is String) {

Loading…
Cancel
Save