Flutter 富文本 部分文字可以触发点击

在Flutter中的一段文字中截取部分文字使其可以触发点击事件。

 Widget _buildBottomTip() {
    
    
    return Container(
      child: Text.rich(
        TextSpan(
          children: [
            TextSpan(
                text: "这是要显示的文字",
                style: DHTextStyle.style(12, R.color.color_73767a)),
            TextSpan(
                text: "这是可以点击的文字",
                style: TextStyle(color: ColorStyles.color_app_theme_text),
                recognizer: TapGestureRecognizer()
                  ..onTap = () {
    
    
                    print('点击文字触发方法');
                  })
          ],
        ),
      ),
    );
  }

猜你喜欢

转载自blog.csdn.net/tongwei117/article/details/132289263