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
Wrap with following code:
GestureDetector(
onTap: () {
/* Hide Keyboard */
FocusManager.instance.primaryFocus?.unfocus();
},
)