Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/stream_chat_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fixed shadowed messages not hidden in channel list items.
- Fixed `StreamMessageListView` firing `markThreadRead` on a reply-less parent, which produced a guaranteed 404 every time the thread view was opened before the first reply.
- Fixed dismissing the `StreamMessageListView` unread indicator being ignored while a channel is receiving a rapid burst of messages.
- Fixed `onReactionPicked` using an incorrect `BuildContext`, which could cause the parent route to be popped unexpectedly when used with nested navigators.

## 10.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class StreamMessageActionsModal extends StatelessWidget {
final spacing = context.streamSpacing;
final effectiveAlignment = alignment ?? StreamMessageLayout.alignmentDirectionalOf(context);

void onReactionPicked(Reaction reaction) {
void onReactionPicked(Reaction reaction, BuildContext context) {
final action = SelectReaction(message: message, reaction: reaction);
return Navigator.pop(context, action);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ class DefaultStreamMessageItem extends StatelessWidget {
currentUser: currentUser,
);

void onReactionPicked(Reaction reaction) {
void onReactionPicked(Reaction reaction, BuildContext context) {
final action = SelectReaction(message: message, reaction: reaction);
return Navigator.pop(context, action); // Pop the modal with the selected reaction action
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ import 'package:stream_chat_flutter/src/stream_chat_configuration.dart';
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
import 'package:stream_core_flutter/chat.dart';

/// {@template onReactionPicked}
/// Callback called when a reaction is picked.
/// {@endtemplate}
typedef OnReactionPicked = ValueSetter<Reaction>;

/// {@template streamMessageReactionPicker}
/// A chat-specific reaction picker that bridges [StreamReactionPicker] with
/// chat domain models.
Expand Down Expand Up @@ -37,7 +32,7 @@ class StreamMessageReactionPicker extends StatelessWidget {
final Message message;

/// {@macro onReactionPicked}
final OnReactionPicked? onReactionPicked;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change for anybody using the ReactionPicker directly. If the context is really needed we should make a new method and deprecate the old one.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. That's a great suggestion.

I can make this change. Do you have any recommendations for the new method name?

final Function(Reaction, BuildContext)? onReactionPicked;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -66,7 +61,7 @@ class StreamMessageReactionPicker extends StatelessWidget {
_ => Reaction(type: item.key, emojiCode: reactionEmojiCode),
};

return onReactionPicked?.call(pickedReaction);
return onReactionPicked?.call(pickedReaction, context);
}

return StreamReactionPicker(
Expand All @@ -84,7 +79,7 @@ class StreamMessageReactionPicker extends StatelessWidget {
if (!context.mounted || emoji == null) return;

final reaction = Reaction(type: emoji.shortName, emojiCode: emoji.emoji);
return onReactionPicked?.call(reaction);
return onReactionPicked?.call(reaction, context);
},
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void main() {
_wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: resolver,
),
Expand Down Expand Up @@ -54,7 +54,7 @@ void main() {
_wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (reaction) {
onReactionPicked: (reaction, _) {
pickedReaction = reaction;
},
),
Expand Down Expand Up @@ -98,7 +98,7 @@ void main() {
_wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (reaction) {
onReactionPicked: (reaction, _) {
pickedReaction = reaction;
},
),
Expand Down Expand Up @@ -136,7 +136,7 @@ void main() {
_wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: resolver,
),
Expand Down Expand Up @@ -172,7 +172,7 @@ void main() {
_wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: compactResolver,
),
Expand All @@ -186,7 +186,7 @@ void main() {
_wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: resolver,
),
Expand Down Expand Up @@ -216,7 +216,7 @@ void main() {
_wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: subsetResolver,
),
Expand Down Expand Up @@ -251,7 +251,7 @@ void main() {
_wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: subsetResolver,
),
Expand Down Expand Up @@ -290,7 +290,7 @@ void main() {
_wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: const _TypeBasedReactionIconResolver(),
),
Expand Down Expand Up @@ -320,7 +320,7 @@ void main() {
_wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: resolver,
),
Expand Down Expand Up @@ -350,7 +350,7 @@ void main() {
return _wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: resolver,
brightness: brightness,
Expand Down Expand Up @@ -379,7 +379,7 @@ void main() {
return _wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: resolver,
brightness: brightness,
Expand All @@ -401,7 +401,7 @@ void main() {
return _wrapWithMaterialApp(
StreamMessageReactionPicker(
message: message,
onReactionPicked: (_) {},
onReactionPicked: (_, _) {},
),
reactionIconResolver: const _SubsetDefaultReactionIconResolver(),
brightness: brightness,
Expand Down
Loading