flutter - 如何在颤动中设置文本可点击获取识别器错误
问题描述
如何在颤动中设置文本可点击获取识别器错误 -
Expanded(child: Text(BasicAction.formatDate(data.dataList[index].payDate), style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: UtilColors.darkGrey))),
Padding(
padding: EdgeInsets.all(4),
child: Text('Edit', recognizer: _recognizer, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500, color: UtilColors.blueColor)),
解决方案
尝试这个
GestureDetector(
onTap: () {
print("Pressed");
},
child: Text("GestureDetector"),
),
InkWell(
onTap: () {
print("Pressed");
},
child: Text("InkWell"),
),
RichText(
text: TextSpan(
recognizer: new TapGestureRecognizer()
..onTap = () {
print("Pressed");
},
text: "RichText",
),
)
推荐阅读
- docker - 使用 dockerfile 安静地安装 MONO
- android - 二进制 XML 文件第 24 行:膨胀类 android.widget.Spinner 时出错
- microsoft-graph-api - 是否可以使用 Microsoft Graph 来搜索整个组织的电子邮件数据库,而不仅仅是一个用户的?
- php - 如何解决类型错误:Laravel 中的参数太少而无法运行
- machine-learning - 网络在达到特定精度后停止收敛
- python - 如何将不同形状的卷积层输出池化为固定形状以传递给全连接层
- python - 查找类似于 xlwings 包的 PyWin32 方法
- swift - 结构初始化程序由于其自己文件的私有保护级别而无法访问
- html - 使左对齐的 div 占据所有空间
- c++ - Visual Studio C++ dll 参考