textSpan method

TextSpan textSpan({
  1. TextStyle? style,
  2. Function onTap()?,
})

从字符串生成富文件组件 >>> 生成可交互的文本片段

@param style 文本样式(可选) @param onTap 点击回调函数(可选) @return 包含点击事件的TextSpan组件

Implementation

TextSpan textSpan({
  TextStyle? style,
  Function onTap()?,
}) {
  TapGestureRecognizer rec = TapGestureRecognizer();
  rec.onTap = onTap;
  return TextSpan(text: this, style: style, recognizer: rec);
}