首页 > 解决方案 > 如何在颤动中设置文本可点击获取识别器错误

问题描述

如何在颤动中设置文本可点击获取识别器错误 -

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)),

标签: fluttertextgesturedetector

解决方案


尝试这个

            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",
              ),
            )

推荐阅读