getParsePattern method

Widget getParsePattern(
  1. BuildContext context,
  2. String text,
  3. bool isMarkdown
)

Implementation

Widget getParsePattern(BuildContext context, String text, bool isMarkdown) {
  return isMarkdown
      ? MarkdownBody(
          data: text,
          selectable: true,
          onTapLink: (String value, String? href, String title) {
            if (href != null) {
              openLink(href);
            } else {
              openLink(value);
            }
          },
        )
      : ParsedText(
          parse: messageOptions.parsePatterns != null
              ? messageOptions.parsePatterns!
              : defaultParsePatterns,
          text: text,
          style: TextStyle(
            color: isOwnMessage
                ? messageOptions.currentUserTextColor(context)
                : messageOptions.textColor,
          ),
        );
}