How can I dismiss the on screen keyboard?

前端 未结 18 2315
星月不相逢
星月不相逢 2020-11-30 18:31

I am collecting user input with a TextFormField and when the user presses a FloatingActionButton indicating they are done, I want to dismiss the on

18条回答
  •  北海茫月
    2020-11-30 18:53

    This may simplify the case. Below code will work only if keyboard is open

    if(FocusScope.of(context).isFirstFocus) {
     FocusScope.of(context).requestFocus(new FocusNode());
    }
    

提交回复
热议问题