getGroupAtInfo method

dynamic getGroupAtInfo(
  1. TencentCloudChatTextStyle textStyle,
  2. TencentCloudChatThemeColors colorTheme
)

Implementation

getGroupAtInfo(TencentCloudChatTextStyle textStyle, TencentCloudChatThemeColors colorTheme) {
  List<Widget> tips = [];

  var style = TextStyle(
    color: colorTheme.conversationItemGroupAtInfoTextColor,
    fontSize: textStyle.fontsize_12,
    fontWeight: FontWeight.w400,
  );
  if (widget.conversation.groupAtInfoList != null) {
    if (widget.conversation.groupAtInfoList!.isNotEmpty) {
      List<V2TimGroupAtInfo> mentionedInfoList = [];

      for (var element in widget.conversation.groupAtInfoList!) {
        if (element != null) {
          mentionedInfoList.add(element);
        }
      }

      int? atType = _getShowAtType(mentionedInfoList);
      if (atType != null) {
        String atTips = '';
        switch (atType) {
          case 1:
            atTips = "[${tL10n.atMeTips}] ";
            break;
          case 2:
            atTips = "[${tL10n.atAllTips}] ";
            break;
          case 3:
            atTips = "[${tL10n.atAllTips}] [${tL10n.atMeTips}] ";
            break;
          default:
            print("error: invalid atType!");
            break;
        }

        if (atTips.isNotEmpty) {
          tips.add(Text(
            atTips,
            style: style,
          ));
        }
      }
    }
  }
  if (tips.isNotEmpty) {
    return Row(
      children: tips,
    );
  } else {
    return Container();
  }
}