본문 바로가기
Flutter

[Flutter] flutter close keyboard on textfield submit(close-hide-keyboard)

by hymndaniel 2022. 4. 28.
GestureDetector(
  onTap: () {
    FocusManager.instance.primaryFocus?.unfocus();
  },
  child: Scaffold(
    appBar: AppBar(
      title: const Text('Close Keyboard Demo'),
      backgroundColor: Color(0xff6ae792),
    ),
    body: ...
  ),
);
 

 

Reference

https://www.flutterbeads.com/close-hide-keyboard-flutter/

 

3 Easy Steps to Close Keyboard in Flutter with Code (2022) - FlutterBeads

<span class="rt-reading-time" style="display: block;"><span class="rt-label rt-prefix"></span> <span class="rt-time">2</span> <span class="rt-label rt-postfix">min read</span></span> TextField is a very common widget in Flutter. When you click on the TextF

www.flutterbeads.com

 

728x90