ios 中未显示 Flutter 键盘

Flutter keyboard not showing in ios

我 运行 在 ios 模拟器中安装我的应用程序,但为什么当我单击文本字段时我的键盘突然不显示?在我修复我的应用程序图标之前,它工作得很好。

尝试删除应用程序并重新安装,但仍然无效。当我 运行 android 上的应用程序并单击相同的文本字段时,键盘正在显示。

代码如下:

                       TextField(
                          keyboardType: TextInputType.multiline,
                          controller: inputTextController,
                          onChanged: (text) {
                              if (!_isWriting){
                                _isWriting = true;

                                  //update typing status when type messages
                                  var msg = {};
                                  msg["api_key"] = apiKey;
                                  msg["type"] = "status_typing";
                                  msg["id_sender"] = idUser;
                                  msg["id_receiver"] = idReceiver;
                                  msg["room_id"] = conversation!.roomId;
                                  String msgString = json.encode(msg);
                                  homes.channel.sink.add(msgString);

                                setState((){});
                                Future.delayed(Duration(seconds: 2)).whenComplete((){
                                  _isWriting = false;
                                  setState((){});
                                });
                              }
                            },
                          maxLines: null,
                          style: TextStyle(
                            color: Colors.black,
                          ),
                          decoration: InputDecoration(
                              contentPadding: EdgeInsets.only(top: 13, bottom: 13),
                              border: InputBorder.none,
                              hintText: 'Type a message',
                              hintStyle: TextStyle(
                                color: Color(0xff99999B),
                              )
                          ),
                        ),

有什么解决办法吗?

要在模拟器中显示键盘,请遵循此命令

cmd + shift + k

转到模拟器 window 中的 I/O 菜单并在键盘内取消单击“连接硬件键盘”或打开模拟器 window 并按 cmd+shift+k