Reputation: 509
I am making a sign-up form. My problem is when the user fills the last field in my form and hit enter on the keyboard, but the keyboard does not dismiss. Is there any way to dismiss the keyboard?
Upvotes: 0
Views: 107
Reputation: 1793
If you want to dismiss the keyboard when the user clicks anywhere on the screen:
wrap the scaffold with GestureDetector:
GestureDetector(
onTap: () {
setState(() {
FocusScope.of(context).requestFocus(new FocusNode());
});
},
child: Scaffold());
If you want to dismiss the keyboard when the user fills the last textField:
track the textfields controllers and when you are at the last one use yourControllerName.unfocus();
Upvotes: 1