Want to listen to keyboard on screen in Flutter? The keyboard will automatically appear when the text field is focused. So you can add a listner to the focusnode to listen the focus change and hide respective widget.
Here is a quick example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
void _listener(){ if(_myNode.hasFocus){ // keyboard appeared }else{ // keyboard dismissed } } FocusNode _myNode = new FocusNode()..addListener(_listner); TextField _myTextField = new TextField( focusNode: _mynNode, ... ... ); new Container( child: _myTextField ); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.