[英]AcessibilityEvent in Flutter / Dart
I'm 3 weeks looking for how to use the accessibility event with dart, has anyone got anything yet?我有 3 周的时间在寻找如何通过 dart 使用可访问性事件,有人知道吗? I did not find anything in the documentation我在文档中没有找到任何内容
Accessibility information can be provided via the Semantics widget.可通过语义小部件提供可访问性信息。 Most widgets in the Material and Cupertino libraries already provide relevant semantics, such as MaterialButton
s identifying as a button and so on. Material 和 Cupertino 库中的大多数小部件已经提供了相关的语义,例如MaterialButton
标识为按钮等。 The Semantics
widget is only necessary if you create your own widgets out of primitive layouts or painters.仅当您使用原始布局或画家创建自己的小部件时,才需要Semantics
小部件。
For example, say you wanted to make your own button and started with a Text
widget and a gesture detector.例如,假设您想制作自己的按钮并从Text
小部件和手势检测器开始。
Widget build(_) {
return Container(
child: GestureDetector(
onTap: () { ... }
child: Text('MY BUTTON'),
)
);
}
This will already contain some semantic information from the Text
and GestureDetector
widgets.这将已经包含来自Text
和GestureDetector
小部件的一些语义信息。 While running the app, you can press S
(capital "S") if TalkBack or VoiceOver is enabled to print the current semantic tree.在运行应用程序时,如果启用了 TalkBack 或 VoiceOver,您可以按S
(大写“S”)打印当前语义树。
[ +6 ms] I/flutter ( 6511): SemanticsNode#0
[ ] I/flutter ( 6511): │ Rect.fromLTRB(0.0, 0.0, 1080.0, 1794.0)
[ ] I/flutter ( 6511): │
[ ] I/flutter ( 6511): └─SemanticsNode#1
[ ] I/flutter ( 6511): Rect.fromLTRB(0.0, 0.0, 79.0, 16.0) with transform
[ ] I/flutter ( 6511): [2.625,0.0,0.0,436.3125; 0.0,2.625,0.0,876.0; 0.0,0.0,1.0,0.0;
[ ] I/flutter ( 6511): 0.0,0.0,0.0,1.0]
[ ] I/flutter ( 6511): actions: tap
[ ] I/flutter ( 6511): label: "MY BUTTON"
[ ] I/flutter ( 6511): textDirection: ltr
In this case to specifically identify this as a button, you can wrap your widgets with a Semantics
widget an provide button: true
and container: true
.在这种情况下,要明确将其标识为按钮,您可以使用Semantics
小部件包装您的小部件,提供button: true
和container: true
。
Widget build(_) {
return Semantics(
container: true,
button: true,
child: Container(
child: GestureDetector(
onTap: () { ... }
child: Text('MY BUTTON'),
)
)
);
}
No, I mean accessibility events, to automate my gizmo and in the future make a teamviewer on flutter不,我的意思是可访问性事件,以自动化我的 Gizmo,并在未来在 flutter 上制作团队查看器
Send Clicks, etcs.发送点击等。
Check this link out.看看这个链接。 It introduces accessibility bridge in flutter than can be used to achieve what you want.它在颤振中引入了可访问性桥梁,可用于实现您想要的。
https://api.flutter.dev/javadoc/io/flutter/view/AccessibilityBridge.html https://api.flutter.dev/javadoc/io/flutter/view/AccessibilityBridge.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.