android - Flutter Android TV 应用无法使用 D Pad 进行选择
问题描述
我正在使用 Flutter 开发 Android TV 应用程序。我能够运行该应用程序(现在是示例应用程序)。但我无法使用 d pad 选择按钮选择任何内容。
我发现我必须使用这样的东西才能实现这一点
捷径(
shortcuts: {
LogicalKeySet(LogicalKeyboardKey.select):
const Intent(ActivateAction.key)
},
child: MaterialApp())
但它在代码中给了我一个错误。我究竟做错了什么?
任何帮助表示赞赏。谢谢你。
解决方案
添加此代码肯定有助于 Android TV OK/Select 按钮,并且可以扩展为其他映射。为 Flutter 1.24-dev 构建并完美运行
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return Shortcuts(
shortcuts: <LogicalKeySet, Intent>{
LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(),
},
child: MaterialApp(
推荐阅读
- css - DIV 随位置移动:相对在该 div 和下一个 div 之间创建间隙
- powershell - 远程注销用户
- javascript - 如何在不使用 lambda 函数的 React 渲染组件中向处理程序事件发送参数?
- testing - 我们可以根据测试用例中的值将 URL 参数附加到端点吗?
- javascript - 我的javascript函数有问题吗?
- c# - AspNetCore 在其他程序集中包含 Razor Pages
- android - 如何在 AndroidStudio 中从 JavaFX 访问类和接口?
- oracle - 没有可用于 SDO_GEOM.SDO_LENGTH 和 SDO_GEOM.SDO_AREA 的尺寸,并且给出公差的解决方法不起作用
- javascript - 如何使用纬度和经度从两个位置获取距离
- ffmpeg - Ffmpeg 将视频拆分为多个块,但持续时间长度不同