getStickerAuxiliaryButton method
dynamic
getStickerAuxiliaryButton(
- User? user,
- Group? group,
- BuildContext context,
- Map<
String, dynamic> ? id,
Implementation
getStickerAuxiliaryButton(User? user, Group? group, BuildContext context,
Map<String, dynamic>? id) {
onStickerTap(Sticker st) async {
Map<String, String> customData = {};
customData["sticker_url"] = st.stickerUrl;
customData["sticker_name"] = st.stickerName;
String receiverID;
String receiverType;
int parentMessageId = id?['parentMessageId'] ?? 0;
if (user != null) {
receiverID = user.uid;
receiverType = ReceiverTypeConstants.user;
} else {
receiverID = group!.guid;
receiverType = ReceiverTypeConstants.group;
}
User? loggedInUser = await CometChat.getLoggedInUser();
if (loggedInUser != null) {
CustomMessage customMessage = CustomMessage(
receiverUid: receiverID,
type: stickerTypeConstant,
customData: customData,
receiverType: receiverType,
sender: loggedInUser,
category: CometChatMessageCategory.custom,
parentMessageId: parentMessageId,
muid: DateTime.now().microsecondsSinceEpoch.toString(),
updateConversation: true,
metadata: {
UpdateSettingsConstant.incrementUnreadCount: true,
},
);
CometChatUIKit.sendCustomMessage(customMessage);
}
}
return StickerAuxiliaryButton(
keyboardButtonIcon: configuration?.keyboardButtonIcon,
stickerButtonIcon: configuration?.stickerButtonIcon,
theme: configuration?.theme,
stickerIconTint: configuration?.stickerIconTint,
keyboardIconTint: configuration?.keyboardIconTint,
onStickerTap: () {
FocusManager.instance.primaryFocus?.unfocus();
CometChatUIEvents.showPanel(id, CustomUIPosition.composerBottom,
(context) {
return CometChatStickerKeyboard(
onStickerTap: onStickerTap,
keyboardStyle: configuration?.stickerKeyboardStyle,
emptyStateText: configuration?.emptyStateText,
emptyStateView: configuration?.errorStateView,
errorIcon: configuration?.errorIcon,
errorStateText: configuration?.errorStateText,
errorStateView: configuration?.errorStateView,
loadingStateView: configuration?.loadingStateView,
theme: configuration?.theme,
);
});
},
onKeyboardTap: () {
CometChatUIEvents.hidePanel(
id,
CustomUIPosition.composerBottom,
);
},
);
}