4

Hide keyboard when tap out the Textfield – Flutter

 3 years ago
source link: http://chintanrathod.com/hide-keyboard-tap-textfield-flutter/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Hide keyboard when tap out the Textfield – Flutter

Chintan RathodAndroid–March 18, 2020March 18, 2020

Sometimes it is necessary to hide keyboard when user touches outside area of Input Field. This should hide keyboard so that one can perform different task.

Wrap your component with GestureDetector and call on tap:

_dismissKeyboard(BuildContext context) {
  FocusScope.of(context).requestFocus(new FocusNode());
@override
Widget build(BuildContext context) {
  return new GestureDetector(
    onTap: () {
      this._dismissKeyboard(context);
    child: new Container(
      color: Colors.white,
      child: new Column(
        children: <Widget>[/*...*/],
Views: 31
000000

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK