Flutter阻止默认系统键盘弹出



  • 1、进入flutter的services目录
    cd flutter/packages/flutter/lib/src/services


    2、修改text_input.dart文件的TextInputConnection类的show方法,将以下代码注释掉
    SystemChannels.textInput.invokeMethod<void>('TextInput.show');

      /// Requests that the text input control become visible.
      void show() {
        assert(attached);
        // SystemChannels.textInput.invokeMethod<void>('TextInput.show');
      }
    

    3、重新编译下工程即可


Log in to reply