diff --git a/packages/stream_chat_flutter/CHANGELOG.md b/packages/stream_chat_flutter/CHANGELOG.md index 64978f2a3..e2b1eb256 100644 --- a/packages/stream_chat_flutter/CHANGELOG.md +++ b/packages/stream_chat_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## Upcoming Beta + +- Fixed regression in `emoji_code` support for reactions. + ## 10.0.0-beta.11 - Included the changes from version [`9.22.0`](https://pub.dev/packages/stream_chat_flutter/changelog). diff --git a/packages/stream_chat_flutter/lib/src/reactions/picker/reaction_picker.dart b/packages/stream_chat_flutter/lib/src/reactions/picker/reaction_picker.dart index ce0a4ed96..3b3ece780 100644 --- a/packages/stream_chat_flutter/lib/src/reactions/picker/reaction_picker.dart +++ b/packages/stream_chat_flutter/lib/src/reactions/picker/reaction_picker.dart @@ -125,6 +125,7 @@ class StreamReactionPicker extends StatelessWidget { return ReactionPickerIcon( type: reactionType, builder: reactionIcon.builder, + emojiCode: reactionIcon.emojiCode, // If the reaction is present in ownReactions, it is selected. isSelected: ownReactionsMap[reactionType] != null, ); @@ -136,9 +137,13 @@ class StreamReactionPicker extends StatelessWidget { reactionIcons: [...indicatorIcons], onIconPicked: (reactionIcon) { final reactionType = reactionIcon.type; - final reaction = ownReactionsMap[reactionType]; + final reactionEmojiCode = reactionIcon.emojiCode; + final pickedReaction = switch (ownReactionsMap[reactionType]) { + final reaction? => reaction, + _ => Reaction(type: reactionType, emojiCode: reactionEmojiCode), + }; - return onReactionPicked?.call(reaction ?? Reaction(type: reactionType)); + return onReactionPicked?.call(pickedReaction); }, ); diff --git a/packages/stream_chat_flutter/lib/src/reactions/picker/reaction_picker_icon_list.dart b/packages/stream_chat_flutter/lib/src/reactions/picker/reaction_picker_icon_list.dart index e5004f7ca..9a7bfc7f6 100644 --- a/packages/stream_chat_flutter/lib/src/reactions/picker/reaction_picker_icon_list.dart +++ b/packages/stream_chat_flutter/lib/src/reactions/picker/reaction_picker_icon_list.dart @@ -201,6 +201,7 @@ class ReactionPickerIcon { /// {@macro reactionPickerIcon} const ReactionPickerIcon({ required this.type, + this.emojiCode, this.isSelected = false, this.iconSize = 24, required ReactionIconBuilder builder, @@ -209,6 +210,11 @@ class ReactionPickerIcon { /// The unique identifier for the reaction type (e.g., "like", "love"). final String type; + /// Optional emoji code for the reaction. + /// + /// Used to display a custom emoji in the notification. + final String? emojiCode; + /// A boolean indicating whether this reaction is currently selected by the /// user. final bool isSelected;