arrays - 无法在颤动中显示图标 onTap
问题描述
每当调用 ontap 函数时,我都试图在文本上显示一个图标。
onTap: () {
if (cellStatus['$j$k'] ?? true) {
print('working');
setState(() {
cellStatus.addAll({'$j$k': false});
Icon(Icons.access_alarm);
});
}
},
我哪里错了。。
解决方案
在您的小部件内部
InkWell(
onTap:(){
setState(() {
cellStatus['$j$k'] = true;
});
} ,
child: !cellStatus['$j$k'] ? Text("example text") :
Icon(Icons.access_alarm) ,
),
推荐阅读
- javascript - 如何将日期格式化为今天的日期,例如上午 8:00 或晚上 9:00?时刻JS
- c# - 具有特定文化的 C# DisplayAttribute.GetName
- node.js - 设置passenger_nodejs在Nginx服务器中不起作用
- bash - 从 bash 函数调用时,`kubectl` 失败
- python - Pandas Pivot 表并保留两列作为组合标识符
- excel - Excel VBA Formulas to populate until last row , not working for VERY LAST row
- arrays - 如何在匹配后从字节数组中获取接下来的 2 个字节
- stripe-payments - 条纹支付 - 将篮子价格传递给 php 中的 checkout_session
- python - 如何将一个列表中的嵌套字典值附加到另一个列表中?
- laravel - 当我更改连接状态时,LiveWire 离线状态不起作用