use latestReactions in reaction picker (like it's done in react sdk)
This commit is contained in:
@@ -31,7 +31,7 @@ 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.ownReactions
|
final ownReactionIndex = message.latestReactions
|
||||||
?.indexWhere((reaction) => reaction.type == reactionType) ??
|
?.indexWhere((reaction) => reaction.type == reactionType) ??
|
||||||
-1;
|
-1;
|
||||||
return Column(
|
return Column(
|
||||||
@@ -49,7 +49,7 @@ class ReactionPicker extends StatelessWidget {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (ownReactionIndex != -1) {
|
if (ownReactionIndex != -1) {
|
||||||
removeReaction(
|
removeReaction(
|
||||||
context, message.ownReactions[ownReactionIndex]);
|
context, message.latestReactions[ownReactionIndex]);
|
||||||
} else {
|
} else {
|
||||||
sendReaction(context, reactionType);
|
sendReaction(context, reactionType);
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,8 @@ class ReactionPicker extends StatelessWidget {
|
|||||||
? Padding(
|
? Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 4.0),
|
padding: const EdgeInsets.only(bottom: 4.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
message.ownReactions[ownReactionIndex].score.toString(),
|
message.latestReactions[ownReactionIndex].score
|
||||||
|
.toString(),
|
||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user