getAttachmentOptions method

dynamic getAttachmentOptions(
  1. CometChatTheme theme,
  2. BuildContext context
)

Implementation

getAttachmentOptions(CometChatTheme theme, BuildContext context) {
  if (attachmentOptions != null) {
    List<CometChatMessageComposerAction> actionList =
        attachmentOptions!(context, user, group, {});

    for (CometChatMessageComposerAction attachmentOption in actionList) {
      _actionItems.add(ActionItem(
          id: attachmentOption.id,
          title: attachmentOption.title,
          iconUrl: attachmentOption.iconUrl,
          iconUrlPackageName: attachmentOption.iconUrlPackageName,
          titleStyle: attachmentOption.titleStyle ??
              TextStyle(
                  color: theme.palette.getAccent(),
                  fontSize: theme.typography.subtitle1.fontSize,
                  fontWeight: theme.typography.subtitle1.fontWeight),
          iconTint: attachmentOption.iconTint ?? theme.palette.getAccent700(),
          background: attachmentOption.background,
          cornerRadius: attachmentOption.cornerRadius,
          iconBackground: attachmentOption.iconBackground,
          iconCornerRadius: attachmentOption.iconCornerRadius,
          onItemClick: attachmentOption.onItemClick));
    }
  } else {
    final defaultOptions = CometChatUIKit.getDataSource()
        .getAttachmentOptions(theme, context, composerId);

    for (CometChatMessageComposerAction attachmentOption in defaultOptions) {
      _actionItems.add(ActionItem(
          id: attachmentOption.id,
          title: attachmentOption.title,
          iconUrl: attachmentOption.iconUrl,
          iconUrlPackageName: attachmentOption.iconUrlPackageName,
          titleStyle: attachmentOption.titleStyle ??
              TextStyle(
                  color: theme.palette.getAccent(),
                  fontSize: theme.typography.subtitle1.fontSize,
                  fontWeight: theme.typography.subtitle1.fontWeight),
          iconTint: attachmentOption.iconTint ?? theme.palette.getAccent700(),
          background: attachmentOption.background,
          cornerRadius: attachmentOption.cornerRadius,
          iconBackground: attachmentOption.iconBackground,
          iconCornerRadius: attachmentOption.iconCornerRadius,
          onItemClick: attachmentOption.onItemClick));
    }
  }
}