I have a screen with multiple widgets. Some of them are clickable. There is one textInput widget that opens a keyboard when clicked on it. I want to hide it whenever clicked anywhere outside it. But if i click on any GestureDetector outside keyboard, then it handles that action with keyboard open. I want to simply close it first.
I tried wrapping my whole screen in a gestureDetector and use focusNode.unfocus()
in its onTap, but it didn’t work
3
Answers
I guess you can close the
keyboard
if already open before clicking on anotherGestureDetector
widgetsSomething like:
Wrap with following code: