flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
161.78k stars 26.56k forks source link

[Android] Chromebook android numpad issue #123565

Open selvam920 opened 1 year ago

selvam920 commented 1 year ago

Whenever capture keylistener using RawKeyboard.instance.keypressed. i'm getting with numlock logical key. this only happening in chromebook android

[✓] Flutter (Channel stable, 3.7.8, on Microsoft Windows [Version 10.0.22621.1413], locale en-US) [✓] Windows Version (Installed version of Windows is version 10 or higher) Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1) [✓] Chrome - develop for the web [✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.5.3) [!] Android Studio (not installed) [✓] VS Code (version 1.76.2) [✓] Connected device (5 available) [✓] HTTP Host Availability

huycozy commented 1 year ago

Hi @selvam920 Can you be more specific on Steps to reproduce of this? (which key did you press? and which key is logged actually?...).

Can this sample code reproduce the issue?

Sample code ```dart import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; void main() { runApp( const MaterialApp( home: MyWidget(), ), ); RawKeyboard.instance.addListener((event) { final key = event.logicalKey.keyLabel; print('$key - ${event.runtimeType}'); }); } class MyWidget extends StatelessWidget { const MyWidget({super.key}); @override Widget build(BuildContext context) { return const Scaffold( body: Center( child: Text( 'Build some widgets!', ), ), ); } } ```

Also, please retry on the latest master channel to check if the issue is fixed or not. (since I don't have a such device, I can't verify this).

selvam920 commented 1 year ago

i have tested in windows, android phone & tv, it's working fine. When i run same app in lenovo duet chromebook android 9, the numlock key locked.

will share the sample code.

selvam920 commented 1 year ago

attached the sample code main.txt

selvam920 commented 1 year ago

the below screenshot debug chromebook android app

image

huycozy commented 1 year ago

Thanks, but when I run your sample code, then press key arrow left, enter, ctrl c and I can see it's printed on the console log output. I'm not sure how to reproduce the issue.

Can you also share the Steps to reproduce along with clear Actual result and Expected result?

selvam920 commented 1 year ago

I pressed control key, in debug the keypressed with num lock. Did you test in Chromebook?

huycozy commented 1 year ago

I don't have Chromebook device, I checked it on Android with a connected physical keyboard.

As I can see from your screenshot above, it seems there are two keys pressed (Control Left and Num Lock), right? And the issue is that Num Lock is printed even you have not pressed it, right?

From my end, when I press Control Left, the output from the console is:

D/ViewRootImpl( 5721): processKeyEvent,KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_CTRL_LEFT, scanCode=0, metaState=META_CTRL_ON|META_CTRL_LEFT_ON, flags=0x0, repeatCount=0, eventTime=3846879, downTime=3846879, deviceId=-1, source=0x101, displayId=-1 }
D/DecorView( 5721): dispatchKeyEvent handled=true, KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_CTRL_LEFT, scanCode=0, metaState=META_CTRL_ON|META_CTRL_LEFT_ON, flags=0x0, repeatCount=0, eventTime=3846879, downTime=3846879, deviceId=-1, source=0x101, displayId=-1 }, activity=com.example.reproduce_issues.MainActivity@883cbd5, mFeatureId=-1
I/flutter ( 5721): label: 
D/ViewRootImpl( 5721): processKeyEvent,KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_CTRL_LEFT, scanCode=0, metaState=META_CTRL_ON|META_CTRL_LEFT_ON, flags=0x80, repeatCount=1, eventTime=3846881, downTime=3846881, deviceId=-1, source=0x101, displayId=-1 }
D/DecorView( 5721): dispatchKeyEvent handled=true, KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_CTRL_LEFT, scanCode=0, metaState=META_CTRL_ON|META_CTRL_LEFT_ON, flags=0x80, repeatCount=1, eventTime=3846881, downTime=3846881, deviceId=-1, source=0x101, displayId=-1 }, activity=com.example.reproduce_issues.MainActivity@883cbd5, mFeatureId=-1
D/DecorView( 5721): dispatchKeyEvent handled=false, KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_CTRL_LEFT, scanCode=0, metaState=META_CTRL_ON|META_CTRL_LEFT_ON, flags=0x0, repeatCount=0, eventTime=3846879, downTime=3846879, deviceId=-1, source=0x101, displayId=-1 }, activity=com.example.reproduce_issues.MainActivity@883cbd5, mFeatureId=-1
I/flutter ( 5721): label: 
D/DecorView( 5721): dispatchKeyEvent handled=false, KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_CTRL_LEFT, scanCode=0, metaState=META_CTRL_ON|META_CTRL_LEFT_ON, flags=0x80, repeatCount=1, eventTime=3846881, downTime=3846881, deviceId=-1, source=0x101, displayId=-1 }, activity=com.example.reproduce_issues.MainActivity@883cbd5, mFeatureId=-1
D/ViewRootImpl( 5721): processKeyEvent,KeyEvent { action=ACTION_UP, keyCode=KEYCODE_CTRL_LEFT, scanCode=0, metaState=0, flags=0x0, repeatCount=0, eventTime=3847011, downTime=3847011, deviceId=-1, source=0x101, displayId=-1 }
D/DecorView( 5721): dispatchKeyEvent handled=true, KeyEvent { action=ACTION_UP, keyCode=KEYCODE_CTRL_LEFT, scanCode=0, metaState=0, flags=0x200, repeatCount=0, eventTime=3847011, downTime=3847011, deviceId=-1, source=0x101, displayId=-1 }, activity=com.example.reproduce_issues.MainActivity@883cbd5, mFeatureId=-1
D/DecorView( 5721): dispatchKeyEvent handled=false, KeyEvent { action=ACTION_UP, keyCode=KEYCODE_CTRL_LEFT, scanCode=0, metaState=0, flags=0x200, repeatCount=0, eventTime=3847011, downTime=3847011, deviceId=-1, source=0x101, displayId=-1 }, activity=com.example.reproduce_issues.MainActivity@883cbd5, mFeatureId=-1

Can you share the log printed when pressing Control Left?

selvam920 commented 1 year ago

this issue only in chromebook android

huycozy commented 1 year ago

Labeling the issue for further insights.

Issue summary

selvam920 commented 8 months ago

any update?

azulmouad commented 2 months ago

same issues in chromecast keyboard