From 0b1e0f217981a9ba4613fdddba2326382e9ad8da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kh=C3=A1nh=20Nguy=E1=BB=85n?= Date: Tue, 2 Nov 2021 23:05:33 +0700 Subject: [PATCH] implement change cursor to SystemMouseCursors.click when hovering a link styled text (#437) Co-authored-by: KhanhNgocNguyen --- lib/src/widgets/text_line.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/src/widgets/text_line.dart b/lib/src/widgets/text_line.dart index c4b6cc17..e9e5f229 100644 --- a/lib/src/widgets/text_line.dart +++ b/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; { 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); }