我使用类似这样的方式在段落中插入超链接。
RichText(
text: TextSpan(
children: [
TextSpan(text: 'This is a going to be a Text which has '),
TextSpan(
text: 'single tap',
style: style,
recognizer: TapGestureRecognizer()
..onTap = () {
// single tapped
},
),
],
),
)
现在,它可以正常工作,但是当鼠标滑过文本时,我无法获得手形光标?
我正在寻找如何实现它,并找到了这个
MouseRegion(
cursor: SystemMouseCursors.click,
child: Container(
height: 30,
width: 30,
color: Colors.red,
),
),
但无法将TextSpan中的一个包装在Container和MouseRegion中。
WidgetSpan
应该能够帮助您解决这个问题。请查看此答案。 - Adrian Moisa