addTextSegmentTapGestures method

void addTextSegmentTapGestures()

Implementation

void addTextSegmentTapGestures() {
  for (var element in _textSegments) {
    if (element.isUrl && widget.onUrlTap != null) {
      final recognizer = TapGestureRecognizer()
        ..onTap = () {
          widget.onUrlTap!(element.name!);
        };

      _textSegmentsTapGestureRecognizers.add(recognizer);
    } else if ((element.isHashtag) && widget.onHashtagTap != null) {
      final recognizer = TapGestureRecognizer()
        ..onTap = () {
          widget.onHashtagTap!(element.name!);
        };

      _textSegmentsTapGestureRecognizers.add(recognizer);
    } else if (element.isMention && widget.onMentionTap != null) {
      final recognizer = TapGestureRecognizer()
        ..onTap = () {
          widget.onMentionTap!(element.name!);
        };

      _textSegmentsTapGestureRecognizers.add(recognizer);
    } else if (element.isTag && widget.onCustomTagTap != null) {
      final recognizer = TapGestureRecognizer()
        ..onTap = () {
          widget.onCustomTagTap!(element.name!);
        };
      _textSegmentsTapGestureRecognizers.add(recognizer);
    }
  }
}