findAtText method

EySpecialText? findAtText(
  1. String? data,
  2. int? index,
  3. TextStyle? textStyle,
  4. SpecialTextGestureTapCallback? onTap,
)

Implementation

EySpecialText? findAtText(String? data, int? index, TextStyle? textStyle, SpecialTextGestureTapCallback? onTap) {
  String sub = data?.substring(index ?? 0 + 1) ?? "";
  var split = sub.split(RegExp(r'(@| )', caseSensitive: false));
  if (split.isEmptyList || split[0].isEmptyString) {
    return null;
  }
  var atTextStyle = textStyle?.copyWith(color: atFontColor ?? Colors.blue, fontSize: atFontSize ?? 16.0);
  var text = "@${split[0]}";
  var specialText = AtText(
      targetText: text,
      textStyle: atTextStyle,
      tapCallback: onTap,
      start: index,
      showAtBackground: false,
      extrasMap: extrasMap);
  specialText.setStartFlag("@");
  specialText.setTextType(SpecialTextType.at);
  specialText.setOffset(0);
  return specialText;
}