Flutter Semantics 在单击和双击时读取按钮标题
我的UI中有一个工具提示,上面有语义标签“工具提示要了解您的电话”。以下是相同的代码段。
Semantics(
label: 'Tooltip to know about your number',
child: InkWell(
child: Image.asset('images/info_selected.png'),
onTap: (){
//some action top show tooltip
},
),
),
当访问性打开时,我单击了Info inf infunwell,它宣布“工具提示要了解您的电话号码”,如预期的。但是我在这里的问题,当我双击时,它也宣布相同。它只能执行我在double点击时在ontap函数中编写的功能。最佳的方法是什么,当我双击时,它不应该宣布?
相同的代码在Android中工作正常,只有在我单击时才宣布。只有iOS屏幕读取器在单点击和双击上都宣布标签
。
I have a tooltip in my UI which has semantics label "Tooltip to know about your number". Below is the code snippet for the same.
Semantics(
label: 'Tooltip to know about your number',
child: InkWell(
child: Image.asset('images/info_selected.png'),
onTap: (){
//some action top show tooltip
},
),
),
When accessibility is ON , and I single tap on info Inkwell, it announce "Tooltip to know about your number" as expected. But my issue here , Its also announcing the same when I double tap.. It should only do the functionality which I wrote inside onTap function when I double tap. What is the best way to make it like , it should not announce when I double tap?
Same code is working fine in android and it announce only when I single tap.. only iOS screen reader is announcing the label on both single tap and double tap..
Same issue when I use Gesture Detector or Button instead of InkWell..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Inkwell具有
onTap
和onDoubleTap
两个功能可用参考 - https://api.flutter.dev/flutter/material/material/inkwell-class.html
输出: -
>代码: -
Inkwell have a
onTap
andonDoubleTap
both functions availableReference - https://api.flutter.dev/flutter/material/InkWell-class.html
Output :-
Code :-
要阻止屏幕阅读器读取
label
参数中的内容以外的任何内容,请添加excludeSemantics: true
。因此,您的代码将如下所示:另一个可能令人感兴趣的参数是
onTapHint
。我用过的一个参考:
https://www.woolha.com/tutorials/flutter-using-语义-合并语义-示例
To keep screen readers from reading anything other than what you have in your
label
parameter, addexcludeSemantics: true
. So your code would look like this:Another parameter which may be of interest is
onTapHint
.One reference I've used:
https://www.woolha.com/tutorials/flutter-using-semantics-mergesemantics-examples