getAttachmentOption method

CometChatMessageComposerAction getAttachmentOption(
  1. CometChatTheme theme,
  2. BuildContext context,
  3. Map<String, dynamic>? id
)

Implementation

CometChatMessageComposerAction getAttachmentOption(
    CometChatTheme theme, BuildContext context, Map<String, dynamic>? id) {
  return CometChatMessageComposerAction(
      id: collaborativeDocumentExtensionTypeConstant,
      title: configuration?.optionTitle ??
          Translations.of(context).collaborativeDocument,
      iconUrl: configuration?.optionIconUrl ??
          AssetConstants.collaborativeDocument,
      iconUrlPackageName:
          configuration?.optionIconUrlPackageName ?? UIConstants.packageName,
      titleStyle: configuration?.optionStyle?.titleStyle ??
          TextStyle(
              color: theme.palette.getAccent(),
              fontSize: theme.typography.subtitle1.fontSize,
              fontWeight: theme.typography.subtitle1.fontWeight),
      iconTint: configuration?.optionStyle?.iconTint ??
          theme.palette.getAccent700(),
      background: configuration?.optionStyle?.background,
      cornerRadius: configuration?.optionStyle?.cornerRadius,
      iconBackground: configuration?.optionStyle?.iconBackground,
      iconCornerRadius: configuration?.optionStyle?.iconCornerRadius,
      onItemClick: (context, user, group) {
        String? uid, guid;
        String receiverType = '';
        if (user != null) {
          uid = user.uid;
          receiverType = ReceiverTypeConstants.user;
        }
        if (group != null) {
          guid = group.guid;
          receiverType = ReceiverTypeConstants.group;
        }

        if (uid != null || guid != null) {
          sendCollaborativeDocument(
              context, uid ?? guid ?? '', receiverType, theme);
        }
      });
}