【发布时间】:2023-02-19 14:15:31
【问题描述】:
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函数有错误。错误消息显示//无效的常量值// 错误的图片在这里,
【问题讨论】:
-
suffix: InkWell( child: Icon(Icons.visibility), onTap: _togglePasswordView, //这里是onTap中的错误),
-
你试过了吗
onTap: ()=> _togglePasswordView(),