flutter 调用方法时onTap属性出错

8yoxcaq7  于 2023-02-20  发布在  Flutter
关注(0)|答案(1)|浏览(106)
TextField(
                    textAlign: TextAlign.center,
                    obscureText: _obscureText,
                    onChanged: (value) {
                      //Do something with the user input.
                      password = value;
                    },
                    style: const TextStyle(color: Colors.black),
                    decoration: const InputDecoration(
                      hintText: 'Enter your Password.',
                      hintStyle: TextStyle(color: Colors.black26),
                      suffix: InkWell(
                        child: Icon(Icons.visibility),
                        onTap: _togglePasswordView,
                        //here is error in onTap
                        
                      ),
                      contentPadding:
                      EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
                      border: OutlineInputBorder(
                        borderRadius: BorderRadius.all(Radius.circular(32.0)),
                      ),

这是该页面的所有代码,后缀中的onTap函数存在错误。错误消息显示//无效常量值//错误的图像如下所示x1c 0d1x,

s1ag04yj

s1ag04yj1#

装饰:常量输入装饰
您将输入修饰定义为常量,但出错时它不是常量。删除常量

相关问题