【发布时间】:2021-10-02 15:04:49
【问题描述】:
我想要一个可点击的可选择文本,在这种情况下,我使用 Flutter Web 和 html 库,我有一个可点击的电话号码,它允许用户从浏览器中选择一个应用程序来打电话。
我的问题是,当悬停在此文本上时,光标是可选文本中的“文本”,但我希望光标变为“指针”/“链接选择”。换句话说,我希望它能够像默认的“真实”HTML 那样工作。
class Example extends StatelessWidget{
@override
Widget build(BuildContext context) {
return Column(
children: [
SelectableText(
'Phone us:',
style: TextStyle(fontSize: 24),
),
SelectableText(
'Tel: +123 1231 231',
style: TextStyle(fontSize: 20),
onTap: ()=>{html.window.location.href = "tel:+1231231231"},
),
],
);
}
}
我尝试将可选文本包装在 MouseRegion() 中,但这也不起作用。
class Example extends StatelessWidget{
@override
Widget build(BuildContext context) {
return Column(
children: [
SelectableText(
'Phone us:',
style: TextStyle(fontSize: 24),
),
MouseRegion(
cursor: SystemMouseCursors.click,
child: SelectableText(
'Tel: +123 1231 231',
style: TextStyle(fontSize: 20),
onTap: ()=>{html.window.location.href = "tel:+1231231231"},
),
),
],
);
}
}
【问题讨论】:
标签: html flutter mouse-cursor