fix reaction picker score indicator

This commit is contained in:
Salvatore Giordano
2021-01-18 11:10:40 +01:00
parent 85a103c5fc
commit 835c73204a
+6 -3
View File
@@ -37,6 +37,10 @@ class ReactionPicker extends StatelessWidget {
reaction.type == reactionType && reaction.type == reactionType &&
reaction.userId == user.id) ?? reaction.userId == user.id) ??
-1; -1;
final totalScore = message.latestReactions
.where((r) => r.type == reactionType)
.map((r) => r.score)
.reduce((tot, s) => tot + s);
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@@ -58,12 +62,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),
), ),
) )