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?
Asked
Active
Viewed 90 times
0
-
Does this answer your question? [How can I dismiss the on screen keyboard?](https://stackoverflow.com/questions/44991968/how-can-i-dismiss-the-on-screen-keyboard) – Mar 06 '20 at 08:44
1 Answers
1
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();

Omar Fayad
- 1,733
- 3
- 11
- 27