From 62494e7a0af506f9bfce5a6ff316e63e1d812830 Mon Sep 17 00:00:00 2001 From: Salvatore Giordano Date: Fri, 9 Oct 2020 13:06:10 +0200 Subject: [PATCH] use latestReactions in reaction picker (like it's done in react sdk) --- lib/src/reaction_picker.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/reaction_picker.dart b/lib/src/reaction_picker.dart index 56127476..bdbcc669 100644 --- a/lib/src/reaction_picker.dart +++ b/lib/src/reaction_picker.dart @@ -31,7 +31,7 @@ class ReactionPicker extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: reactionToEmoji.keys.map((reactionType) { - final ownReactionIndex = message.ownReactions + final ownReactionIndex = message.latestReactions ?.indexWhere((reaction) => reaction.type == reactionType) ?? -1; return Column( @@ -49,7 +49,7 @@ class ReactionPicker extends StatelessWidget { onPressed: () { if (ownReactionIndex != -1) { removeReaction( - context, message.ownReactions[ownReactionIndex]); + context, message.latestReactions[ownReactionIndex]); } else { sendReaction(context, reactionType); } @@ -59,7 +59,8 @@ class ReactionPicker extends StatelessWidget { ? Padding( padding: const EdgeInsets.only(bottom: 4.0), child: Text( - message.ownReactions[ownReactionIndex].score.toString(), + message.latestReactions[ownReactionIndex].score + .toString(), style: TextStyle(color: Colors.white), ), )