implement change cursor to SystemMouseCursors.click when hovering a link styled text

pull/437/head
KhanhNgocNguyen 4 years ago
parent 3a0add9a4c
commit 8c6e13b6a4
  1. 11
      lib/src/widgets/text_line.dart

@ -184,6 +184,7 @@ class TextLine extends StatelessWidget {
final style = textNode.style;
var res = const TextStyle(); // This is inline text style
final color = textNode.style.attributes[Attribute.color.key];
var hasLink = false;
<String, TextStyle?>{
Attribute.bold.key: defaultStyles.bold,
@ -203,6 +204,9 @@ class TextLine extends StatelessWidget {
res = _merge(res.copyWith(decorationColor: textColor),
s!.copyWith(decorationColor: textColor));
} else {
if (k == Attribute.link.key) {
hasLink = true;
}
res = _merge(res, s!);
}
}
@ -252,6 +256,13 @@ class TextLine extends StatelessWidget {
}
res = _applyCustomAttributes(res, textNode.style.attributes);
if (hasLink && readOnly) {
return TextSpan(
text: textNode.value,
style: res,
mouseCursor: SystemMouseCursors.click,
);
}
return TextSpan(text: textNode.value, style: res);
}

Loading…
Cancel
Save