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: pollsTypeConstant,
      title:
          configuration?.optionTitle ?? Translations.of(context).poll,
      iconUrl: configuration?.optionIconUrl ?? AssetConstants.polls,
      iconUrlPackageName:
          configuration?.optionIconUrlPackageName ?? UIConstants.packageName,
      titleStyle: TextStyle(
              color: theme.palette.getAccent(),
              fontSize: theme.typography.subtitle1.fontSize,
              fontWeight: theme.typography.subtitle1.fontWeight)
          .merge(configuration?.optionStyle?.titleStyle),
      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;
        if (user != null) {
          uid = user.uid;
        }
        if (group != null) {
          guid = group.guid;
        }
        if (uid != null || guid != null) {
          return Navigator.push(
              context,
              MaterialPageRoute(
                  builder: (context) => CreatePoll(
                        user: uid,
                        group: guid,
                        theme: theme,
                        style: configuration?.createPollsStyle,
                        addAnswerText: configuration?.addAnswerText,
                        answerHelpText: configuration?.answerHelpText,
                        answerPlaceholderText:
                            configuration?.answerPlaceholderText,
                        closeIcon: configuration?.closeIcon,
                        createPollIcon: configuration?.createPollIcon,
                        deleteIcon: configuration?.deleteIcon,
                        questionPlaceholderText:
                            configuration?.questionPlaceholderText,
                        title: configuration?.title,
                      )));
        }
      });
}