Skip to content

Commit ae9c8ee

Browse files
authored
fix(ui): fix regression in emoji_code support for reactions (#2474)
1 parent 276ad42 commit ae9c8ee

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

packages/stream_chat_flutter/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## Upcoming Beta
2+
3+
- Fixed regression in `emoji_code` support for reactions.
4+
15
## 10.0.0-beta.11
26

37
- Included the changes from version [`9.22.0`](https://pub.dev/packages/stream_chat_flutter/changelog).

packages/stream_chat_flutter/lib/src/reactions/picker/reaction_picker.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class StreamReactionPicker extends StatelessWidget {
125125
return ReactionPickerIcon(
126126
type: reactionType,
127127
builder: reactionIcon.builder,
128+
emojiCode: reactionIcon.emojiCode,
128129
// If the reaction is present in ownReactions, it is selected.
129130
isSelected: ownReactionsMap[reactionType] != null,
130131
);
@@ -136,9 +137,13 @@ class StreamReactionPicker extends StatelessWidget {
136137
reactionIcons: [...indicatorIcons],
137138
onIconPicked: (reactionIcon) {
138139
final reactionType = reactionIcon.type;
139-
final reaction = ownReactionsMap[reactionType];
140+
final reactionEmojiCode = reactionIcon.emojiCode;
141+
final pickedReaction = switch (ownReactionsMap[reactionType]) {
142+
final reaction? => reaction,
143+
_ => Reaction(type: reactionType, emojiCode: reactionEmojiCode),
144+
};
140145

141-
return onReactionPicked?.call(reaction ?? Reaction(type: reactionType));
146+
return onReactionPicked?.call(pickedReaction);
142147
},
143148
);
144149

packages/stream_chat_flutter/lib/src/reactions/picker/reaction_picker_icon_list.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ class ReactionPickerIcon {
201201
/// {@macro reactionPickerIcon}
202202
const ReactionPickerIcon({
203203
required this.type,
204+
this.emojiCode,
204205
this.isSelected = false,
205206
this.iconSize = 24,
206207
required ReactionIconBuilder builder,
@@ -209,6 +210,11 @@ class ReactionPickerIcon {
209210
/// The unique identifier for the reaction type (e.g., "like", "love").
210211
final String type;
211212

213+
/// Optional emoji code for the reaction.
214+
///
215+
/// Used to display a custom emoji in the notification.
216+
final String? emojiCode;
217+
212218
/// A boolean indicating whether this reaction is currently selected by the
213219
/// user.
214220
final bool isSelected;

0 commit comments

Comments
 (0)