Is there a command in Flutter to make the onscreen keyboard on mobile devices appear? I am aware of using FocusNode
s to get the keyboard to show for TextField
s but I have a situation that does not use any TextField
s and I would still like to be able to open and dismiss the onscreen keyboard.
Thanks!
Edit: Here's the piece of code I'm using. It's being called on the onPointerDown
callback of a Listener widget
void handleTap(PointerDownEvent pointerDownEvent) {
// Get input focus
_keyboardFocusNode.requestFocus(); // Works fine
print("In callback"); // Prints fine
// Bring up keyboard
SystemChannels.textInput.invokeMethod('TextInput.show'); // Nothing happens
...
}
I'm testing this on the iOS simulator. I have hardware keyboard unchecked (to use the software keyboard instead).
to show Keyboard use:
SystemChannels.textInput.invokeMethod("TextInput.show");
And to hide it:
SystemChannels.textInput.invokeMethod("TextInput.hide");