Skip to main content

How to Hide Soft Keyboard in Flutter

A virtual keyboard a.k.a soft keyboard or on-screen keyboard is a software component that allows the input of characters without the need for physical keys. It can be used in conjunction with a physical keyboard or as a standalone input method. The soft keyboard is a necessary component of any mobile app that requires user input. However, there may be times when you want to hide the keyboard from view.

For example, we want to hide the keyboard when a user taps on a button or tappable widget.

In Flutter, we can hide the soft keyboard using the following snippets:

FocusScope.of(context).requestFocus(new FocusNode());
FocusScopeNode currentFocus = FocusScope.of(context);

I often hide the on-screen keyboard when a user taps the search button and waits for results from the network.

 _search() {

    //get latest pickings
    _odooStockPicking.searchByKeyword(_keywordController.text, limit, offset).then((response) async {

By continuing to use the site, you agree to the use of cookies.