新增在TextFormField flutter中按下后缀图标时无法打开键盘

问题描述

预期:当我按下后缀图标时,如果键盘处于打开状态,请不要关闭它,否则不要打开它。

现实:当我按下后缀图标时,如果键盘处于打开状态,则仍会打开,但是当键盘处于关闭状态时,请快速将其打开。

我尝试了FocusScope.of(context).unfocus(),但没有成功

如果有帮助,请在此处粘贴代码

 return TextFormField(
      //scrollPadding: EdgeInsets.all(30.0),controller: field_controller,validator: (text) {
        return field_validator(text);
      },keyboardType: keyboard_type,//maxLength: 30,textAlign: TextAlign.center,obscureText: _visible_password2,decoration: Inputdecoration(
        hintText: field_name,labelText: field_name,suffixIcon:IconButton(
          autofocus: true,icon: Icon(
            !_visible_password2
                ? CupertinoIcons.eye
                : CupertinoIcons.eye_slash,size: 20.0,color:
            _visible_password2 ? Color(0xFF3f7182) : Color(0xFF707070),),onpressed: () {
            //Todo : BUG

            setState(() {

              _visible_password2 = !_visible_password2;

            });
          },

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)