create method

List<TextSpan> create(
  1. String text,
  2. TextStyle? style
)

Implementation

List<TextSpan> create(String text, TextStyle? style) {
  final children = <TextSpan>[];

  _split(
    text: text,
    regExp: linkRegExp,
    style: style,
    children: children,
    onTap: onLinkTap,
    onNonMatch: (string, children) {
      _split(
        text: string,
        regExp: atSignRegExp,
        style: style,
        children: children,
        onTap: onAtSignTap,
        matchList: filteredMemberList?.map((e) => '@$e'),
        onNonMatch: (string, children) {
          _split(
            text: string,
            regExp: hashTagRegExp,
            style: style,
            children: children,
            onTap: onHashTagTap,
            matchList: filteredHashTagList?.map((e) => '#$e'),
            onNonMatch: (string, children) {
              children.add(TextSpan(text: string, style: style));
            },
          );
        },
      );
    },
  );

  return children.where((element) => element.text?.isNotEmpty ?? false).toList();
}