Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 颤振键盘侦听器不使用条形码扫描仪设备_Flutter_Barcode - Fatal编程技术网

Flutter 颤振键盘侦听器不使用条形码扫描仪设备

Flutter 颤振键盘侦听器不使用条形码扫描仪设备,flutter,barcode,Flutter,Barcode,Im使用外部条形码设备进行输入(使用扫描+提交(enter)组合)。 我有RawKeyboardListener作为TextField的父项,但它在扫描时不起作用。它看到输入键,但没有条形码,并给出了一些错误 对android的平台密钥支持正在生成不受支持的修改器 组合。”包:flatter/src/services/raw_keyboard.dart':失败 断言:第721行第11位:“空” 原始键盘省道 final Map<ModifierKey, KeyboardSide> m

Im使用外部条形码设备进行输入(使用扫描+提交(enter)组合)。 我有RawKeyboardListener作为TextField的父项,但它在扫描时不起作用。它看到输入键,但没有条形码,并给出了一些错误

对android的平台密钥支持正在生成不受支持的修改器 组合。”包:flatter/src/services/raw_keyboard.dart':失败 断言:第721行第11位:“空”

原始键盘省道

final Map<ModifierKey, KeyboardSide> modifiersPressed =
    event.data.modifiersPressed;
final Map<PhysicalKeyboardKey, LogicalKeyboardKey> modifierKeys =
    <PhysicalKeyboardKey, LogicalKeyboardKey>{};
for (final ModifierKey key in modifiersPressed.keys) {
  final Set<PhysicalKeyboardKey> mappedKeys =
      _modifierKeyMap[_ModifierSidePair(key, modifiersPressed[key])];
  assert(
//Line 721;
          mappedKeys != null,
          'Platform key support for ${Platform.operatingSystem} is '
          'producing unsupported modifier combinations.');
      for (final PhysicalKeyboardKey physicalModifier in mappedKeys) {
        modifierKeys[physicalModifier] = _allModifiers[physicalModifier];
      }
    }
    _allModifiersExceptFn.keys.forEach(_keysPressed.remove);
    if (event.data is! RawKeyEventDataFuchsia &&
        event.data is! RawKeyEventDataMacOs) {
      // On Fuchsia and macOS, the Fn key is not considered a modifier key.
      _keysPressed.remove(PhysicalKeyboardKey.fn);
    }
    _keysPressed.addAll(modifierKeys);

如果您想从RawKeyboardListener获取条形码作为字符串,则必须将每个字符附加到现有字符串中。RawKeyboardListener监听“按下”键,因此您无法插入整个条形码

有一些工作示例:

String inputK = "";  
FocusNode focusNode = FocusNode();
RawKeyboardListener(
  autofocus: true,
  focusNode: focusNode,
  onKey: (RawKeyEvent event){
    if(event.runtimeType.toString() == 'RawKeyDownEvent'){
    String key = event.logicalKey.keyLabel;
    if(key != null){
      setState(() {
          inputK += key;
      });
    }
}
  },
  child: Container(),
);

这个问题有解决办法吗?我的datalogic Memork扫描仪也有同样的问题。我只收到最后一次输入的事件。实际条形码编号不会触发事件

更新。。。
我在扫描仪中找到一个设置,将键盘楔形输入模式从文本输入更改为按键压力,然后键盘监听器开始工作:-)

如果我是正确的,您正在为颤振应用程序使用条形码扫描仪设备(例如TaoTronics条形码USB激光扫描仪)?
[√] Flutter (Channel stable, 1.20.2, on Microsoft Windows [Version 10.0.18363.1016], locale tr-TR)
    • Flutter version 1.20.2 at C:\src\flutter\flutter_windows_v1.12.13+hotfix.5-stable\flutter
    • Framework revision bbfbf1770c (3 weeks ago), 2020-08-13 08:33:09 -0700
    • Engine revision 9d5b21729f
    • Dart version 2.9.1

 
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at C:\Users\DELL\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[√] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 42.1.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.48.2)
    • VS Code at C:\Users\DELL\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.13.2

[√] Connected device (2 available)
    • G0550 (mobile)                     • SAN8PSS5S5PMVEUKRCY • android-arm • Android 4.2.2 (API 17)
    • Android SDK built for x86 (mobile) • emulator-5554       • android-x86 • Android 10 (API 29) (emulator)

• No issues found!
String inputK = "";  
FocusNode focusNode = FocusNode();
RawKeyboardListener(
  autofocus: true,
  focusNode: focusNode,
  onKey: (RawKeyEvent event){
    if(event.runtimeType.toString() == 'RawKeyDownEvent'){
    String key = event.logicalKey.keyLabel;
    if(key != null){
      setState(() {
          inputK += key;
      });
    }
}
  },
  child: Container(),
);