Reputation: 393
I am building a Wordle game in Flutter and planning to show the on-screen input keyboard. I tried the following
class WordleGame extends FlameGame with KeyboardEvents {
KeyEventResult onKeyEvent(
RawKeyEvent event,
Set<LogicalKeyboardKey> keysPressed,
) {}
}
but the keyboard is not showing up? Is this the right behavior? How can I show the keyboard for the duration of the game?
Upvotes: 0
Views: 72
Reputation: 11512
but the keyboard is not showing up? Is this the right behavior?
Yes, The KeyboardEvents
mixin doesn't handle the virtual keyboard on phones and such, it just handles the events that are triggered when a key is pressed (either on a virtual keyboard or a real one).
How can I show the keyboard for the duration of the game?
To open the virtual keyboard I think you'll have to have a TextField
widget or similar (it doesn't have to be visible).
Upvotes: 1