findSpecialText method

  1. @override
EySpecialText? findSpecialText({
  1. String? data,
  2. String? textStack,
  3. int? index,
  4. TextStyle? textStyle,
  5. SpecialTextGestureTapCallback? tapCallback,
})
override

找到符合条件的文本

Implementation

@override
EySpecialText? findSpecialText(
    {String? data, String? textStack, int? index, TextStyle? textStyle, SpecialTextGestureTapCallback? tapCallback}) {
  var textType = _matchTextType(textStack);
  if (textType == SpecialTextType.at) {
    return findAtText(data, index, textStyle, tapCallback);
  } else if (textType == SpecialTextType.emoji) {
    return findEmojiText(data, textStack, index, textStyle);
  } else if (textType == SpecialTextType.link) {
    return findLinkText(data, textStack, index, textStyle, tapCallback);
  } else if (textType == SpecialTextType.color) {
    return findColorText(data, textStack, index, colorTagStyle ?? textStyle, tapCallback);
  } else if (index != null && super.referenceMap.containsKey(index)) {
    return ReferenceMarkText(
      text: textStack ?? "",
      markText: super.referenceMap[index] ?? "",
      textStyle: textStyle,
      markTextColor: markTextColor,
      markTextSize: markTextSize,
      lineSpacing: lineSpacing,
      index: index,
      referenceWordCall: referenceWordCall,
    );
  } else if ((isMarkPinyin ?? false) && wordsPinyinMap.isNotEmptyMap()) {
    if (enablePinYinCheck) {
      if (hasPinYin) {
        return pinyinMark(data, textStack, index, tapCallback);
      } else {
        return null;
      }
    } else {
      return pinyinMark(data, textStack, index, tapCallback);
    }
  }
  return null;
}