我正在尝试使用基本文本字段在这里构建一个简单的登录屏幕,但我无法让键盘出现在模拟器中。
通过物理键盘输入可以正常工作,但在 iOS 模拟器中没有可见的键盘。我必须明确打开它吗?
感觉我在这里遗漏了一些非常基本的东西。
buildLoginScreen() {
return new Container(
padding: EdgeInsets.only(left: 50.0, right: 50.0),
child: new Column(
children: <Widget>[
new TextField(
style: new TextStyle(color: Colors.white),
autofocus: true,
autocorrect: false,
decoration: new InputDecoration(
labelText: 'Login',
),
onChanged: (text) { _userLoginEmail = text; },
),
new TextField(
autofocus: false,
autocorrect: false,
obscureText: true,
decoration: new InputDecoration(
labelText: 'Password'
),
onChanged: (text) { _userLoginPassword = text; },
)
],
),
);
}
解决方案 事实证明,如果连接了硬件键盘,它将抑制软件键盘。 cmd + shift + k 断开硬件键盘或 cmd + k 切换软件键盘。
最佳答案
https://stackoverflow.com/questions/51095762/