无法禁用键盘自动出现
Not able to disable keyboard appearing automatically
当我进入此页面时,键盘会自动出现,我想禁用 that.When 有人按回车 email.I 只希望键盘在那个时候出现。
我已经尝试了一切似乎都没有 work.Can 请有人帮助我
Form(
child: Column(
children: [
TextFormField(
// focusNode: fEmail,
onFieldSubmitted: (term) {
// fEmail!.unfocus();
FocusScope.of(context).unfocus();
// FocusScope.of(context).requestFocus(fPass);
},
textInputAction: TextInputAction.next,
autofocus: true,
style:TextStyle(color: Colors.black, fontSize: 30),
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Enter Your Email',
hintStyle: TextStyle(color: Colors.white60),
),
),
TextFormField(
onFieldSubmitted: (term) {
fPass!.unfocus();
FocusScope.of(context).unfocus();
// FocusScope.of(context).requestFocus(fButton);
},
focusNode: fPass,
textInputAction: TextInputAction.next,
autofocus: true,
style:TextStyle(color: Colors.black, fontSize: 30),
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Enter Your PassWord',
hintStyle: TextStyle(color: Colors.white60),
),
),
],
),
),
从您的代码中删除 autofocus: true,
或将其设置为 autofocus: false
,
参考焦点和文本字段here
参考自动对焦 属性 here
您可以使用焦点节点来控制行为。
如果您在代码中放置 autofocus=true
,它将自动聚焦于当前树中最顶层的文本字段小部件。
默认输入 autofocus = false
或删除参数 false
。
您可以使用焦点节点来控制行为。
如果你把 autofocus: true
如果你的代码。此行将自动聚焦于最顶部的文本字段小部件。
在我们的代码中输入 autofocus: false
它将禁用您的键盘,它会在文本字段中自动打开。
参考焦点和文本字段:here
参考自动对焦属性:here
当我进入此页面时,键盘会自动出现,我想禁用 that.When 有人按回车 email.I 只希望键盘在那个时候出现。 我已经尝试了一切似乎都没有 work.Can 请有人帮助我
Form(
child: Column(
children: [
TextFormField(
// focusNode: fEmail,
onFieldSubmitted: (term) {
// fEmail!.unfocus();
FocusScope.of(context).unfocus();
// FocusScope.of(context).requestFocus(fPass);
},
textInputAction: TextInputAction.next,
autofocus: true,
style:TextStyle(color: Colors.black, fontSize: 30),
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Enter Your Email',
hintStyle: TextStyle(color: Colors.white60),
),
),
TextFormField(
onFieldSubmitted: (term) {
fPass!.unfocus();
FocusScope.of(context).unfocus();
// FocusScope.of(context).requestFocus(fButton);
},
focusNode: fPass,
textInputAction: TextInputAction.next,
autofocus: true,
style:TextStyle(color: Colors.black, fontSize: 30),
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'Enter Your PassWord',
hintStyle: TextStyle(color: Colors.white60),
),
),
],
),
),
从您的代码中删除 autofocus: true,
或将其设置为 autofocus: false
,
参考焦点和文本字段here
参考自动对焦 属性 here
您可以使用焦点节点来控制行为。
如果您在代码中放置 autofocus=true
,它将自动聚焦于当前树中最顶层的文本字段小部件。
默认输入 autofocus = false
或删除参数 false
。
您可以使用焦点节点来控制行为。
如果你把 autofocus: true
如果你的代码。此行将自动聚焦于最顶部的文本字段小部件。
在我们的代码中输入 autofocus: false
它将禁用您的键盘,它会在文本字段中自动打开。
参考焦点和文本字段:here
参考自动对焦属性:here