我有一个型号为TC200J的斑马电话,该电话带有一个集成的条形码扫描仪,因此我需要检测扫描仪何时提供回车输出。
我尝试使用RawKeyboardListener,但是在打印输出时得到以下消息:
I/flutter (11369): test RawKeyDownEvent#46d61(logicalKey: LogicalKeyboardKey#53717(keyId: "0x100053717", keyLabel: null, debugName: "Game Button Right 1"), physicalKey: PhysicalKeyboardKey#53717(usbHidUsage: "0x00053717", debugName: "Game Button Right 1"))
I/flutter (11369): test RawKeyUpEvent#8553c(logicalKey: LogicalKeyboardKey#53717(keyId: "0x100053717", keyLabel: null, debugName: "Game Button Right 1"), physicalKey: PhysicalKeyboardKey#53717(usbHidUsage: "0x00053717", debugName: "Game Button Right 1"))
这是代码:
RawKeyboardListener(
focusNode: barraFocus,
onKey: (key){
print('test $key');
},
child: TextField(
),
)