Flutter TextField: how to lose focus on tap outside?
TextField()
It loses focus only when tap another widget that can take focus such as TextField.
What if the TextField is the only one widget in the page?
Flutter TextField: how to lose focus on tap outside?
TextField()
It loses focus only when tap another widget that can take focus such as TextField.
What if the TextField is the only one widget in the page?
2
Answers
wrap your Scaffold with GestureDetector
and when ontap unfocus
like this
You can use this code to unfocus keyboard