Merge pull request #219 from GetStream/hotfix/reaction-type
Reactions Hotfix
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
## 0.2.20+3
|
||||||
|
|
||||||
|
- Fix reaction picker score indicator
|
||||||
|
|
||||||
## 0.2.20+2
|
## 0.2.20+2
|
||||||
|
|
||||||
- Added `shouldAddChannel` to ChannelsBloc in order to check if a channel has to be added to the list when a new message arrives
|
- Added `shouldAddChannel` to ChannelsBloc in order to check if a channel has to be added to the list when a new message arrives
|
||||||
|
|||||||
@@ -31,9 +31,17 @@ class ReactionPicker extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: reactionToEmoji.keys.map((reactionType) {
|
children: reactionToEmoji.keys.map((reactionType) {
|
||||||
final ownReactionIndex = message.latestReactions
|
var user = StreamChat.of(context).user;
|
||||||
?.indexWhere((reaction) => reaction.type == reactionType) ??
|
final ownReactionIndex = message.latestReactions?.indexWhere(
|
||||||
|
(reaction) =>
|
||||||
|
reaction.type == reactionType &&
|
||||||
|
reaction.userId == user.id) ??
|
||||||
-1;
|
-1;
|
||||||
|
final totalScore = message.latestReactions
|
||||||
|
.where((r) => r.type == reactionType)
|
||||||
|
.map((r) => r.score)
|
||||||
|
.fold(0, (tot, s) => tot + s);
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
@@ -55,12 +63,11 @@ class ReactionPicker extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ownReactionIndex != -1
|
totalScore > 0
|
||||||
? Padding(
|
? Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 4.0),
|
padding: const EdgeInsets.only(bottom: 4.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
message.latestReactions[ownReactionIndex].score
|
totalScore.toString(),
|
||||||
.toString(),
|
|
||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
name: stream_chat_flutter
|
name: stream_chat_flutter
|
||||||
homepage: https://github.com/GetStream/stream-chat-flutter
|
homepage: https://github.com/GetStream/stream-chat-flutter
|
||||||
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
|
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
|
||||||
version: 0.2.20+2
|
version: 0.2.20+3
|
||||||
repository: https://github.com/GetStream/stream-chat-flutter
|
repository: https://github.com/GetStream/stream-chat-flutter
|
||||||
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user