当我在键盘上键入第一个字母时,它熄灭并隐藏了如何解决我正在使用的这种情况
页面中的许多文本表单字段具有键盘焦点,自定义字体,最大长度,onEditingComplete,onTap属性
示例代码:
TextFormField(
textInputAction: TextInputAction.next,
focusNode: myfocus,
controller: mycontroller,
maxLength: 500,
style: TextStyle(
color: Colors.black,
fontFamily: 'Poppins',
fontSize: 14
fontWeight: FontWeight.w400,
),
decoration: InputDecoration(
counterText: "",
labelText: name,
labelStyle: TextStyle(
fontFamily: 'Poppins',
fontSize: 12,
fontWeight: FontWeight.w400,
color: Colors.grey),
),
onEditingComplete: () =>
FocusScope.of(context).requestFocus(secondFocus),
onTap: () {
FocusScope.of(context).unfocus();
}, )
答案 0 :(得分:0)
只需从onTap中删除FocusScope.of(context).unfocus();
onTap: () {
FocusScope.of(context).unfocus();
}