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)),
),
void _togglePasswordView() {
setState(() {
_obscureText = !_obscureText;
});
}
}
这是该页面的所有代码,后缀中的onTap函数存在错误。错误消息显示//无效常量值//错误的图像如下所示x1c 0d1x,
1条答案
按热度按时间kkbh8khc1#
装饰:常量输入装饰
您将输入修饰定义为常量,但出错时它不是常量。删除常量