flutter - 有没有办法连接到安卓设备的激光扫描仪?
问题描述
公司给了我这个安卓设备 https://i.stack.imgur.com/SLGfy.jpg
有没有办法从颤振应用程序调用内置扫描仪?设备有一个硬件密钥可以随时激活扫描仪,我想在我的颤振应用程序中扫描条形码
解决方案
RawKeyboardListener(
onKey: (key) {
if (key.runtimeType.toString() == 'RawKeyDownEvent') {
appState.barcodeTxt.text += key.data.keyLabel;
if (appState.barcodeTxt.text.contains('\n')) {
// your custom `enter key` fun
appState.switchKeypadListioner(context, 'enter');
}
}
}
},
focusNode: appState.barcodeFocusNode,
child: TextField(
textInputAction: TextInputAction.go,
controller: appState.barcodeTxt,
autofocus: false,
onSubmitted: (val) {
// enter key handler
appState.switchKeypadListioner(context, 'enter');
},
keyboardType: TextInputType.number,
),
)
推荐阅读
- sql - 使用 SQL 在 XML 中插入节点
- python - 将值从 csv 文件传递到 python 类
- python - 如何将其转换为带有输出到 CSV 的 for 循环
- java - SonarQube 不显示覆盖范围内的类
- spring-boot - 使用 Spring AWS 集成进行检查点
- vba - Excel 2016 VBA 运行时错误 13
- apache-camel - Camel Netty 负载均衡器 - 未收到响应异常
- javascript - 在javascript中将键值对存储在数组中
- google-sheets-query - 有没有办法将 Google 表单查询重新映射到 Google 表格中的不同(现有)列?
- android - Amazon Cognito:从浏览器重定向到 Android 应用程序时如何停止出现“redirect_mismatch”错误