Recognize key inputs from keyboard in flutter

This Article is posted by seven.srikanth at 23-05-2019 18:10:27

Click here to support us by Subscribing to our youtube channel.

You need to use RawKeyboardListener. This is the widget that calls a callback whenever the user presses or releases a key on a keyboard.
A RawKeyboardListener is useful for listening to raw key events and hardware buttons that are represented as keys. Typically used by games and other apps that use keyboard for purposes other than text entry.
Below is the example code for recognizing a backspace. 
FocusScope.of(context).requestFocus(_focusNode);
RawKeyboardListener(
focusNode: _focusNode,
onKey: (RawKeyEvent event) {
if(event.runtimeType == RawKeyDownEvent &&
(even.logicalKey.keyId == KeyCode.backspace)) {
_focusNode.unfocus();
... // your code here
}   
},
child: ...
)

Tags: keyboard;


Click here to support us by Subscribing to our youtube channel.




0 Comments
Login to comment.
Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.




Wave animation in Flutter




Search Results





©2018 - Fluttercentral | Email to me - Seven.srikanth@gmail.com