Skip to content

Commit 0b1e0f2

Browse files
khanhnguyen-96KhanhNgocNguyen
and
KhanhNgocNguyen
authored
implement change cursor to SystemMouseCursors.click when hovering a link styled text (singerdmx#437)
Co-authored-by: KhanhNgocNguyen <[email protected]>
1 parent 3a0add9 commit 0b1e0f2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/src/widgets/text_line.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ class TextLine extends StatelessWidget {
184184
final style = textNode.style;
185185
var res = const TextStyle(); // This is inline text style
186186
final color = textNode.style.attributes[Attribute.color.key];
187+
var hasLink = false;
187188

188189
<String, TextStyle?>{
189190
Attribute.bold.key: defaultStyles.bold,
@@ -203,6 +204,9 @@ class TextLine extends StatelessWidget {
203204
res = _merge(res.copyWith(decorationColor: textColor),
204205
s!.copyWith(decorationColor: textColor));
205206
} else {
207+
if (k == Attribute.link.key) {
208+
hasLink = true;
209+
}
206210
res = _merge(res, s!);
207211
}
208212
}
@@ -252,6 +256,13 @@ class TextLine extends StatelessWidget {
252256
}
253257

254258
res = _applyCustomAttributes(res, textNode.style.attributes);
259+
if (hasLink && readOnly) {
260+
return TextSpan(
261+
text: textNode.value,
262+
style: res,
263+
mouseCursor: SystemMouseCursors.click,
264+
);
265+
}
255266
return TextSpan(text: textNode.value, style: res);
256267
}
257268

0 commit comments

Comments
 (0)