feat: Tried fix

This commit is contained in:
Deven Joshi
2020-10-30 17:10:06 +05:30
parent 67499020cb
commit f10d63f713
+36 -31
View File
@@ -29,37 +29,42 @@ class ReactionPicker extends StatelessWidget {
borderRadius: BorderRadius.circular(24), borderRadius: BorderRadius.circular(24),
), ),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: user.id == message.user.id ? MainAxisAlignment.end : MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: reactionIcons.map((reactionIcon) { children: [
final ownReactionIndex = message.ownReactions?.indexWhere( if(user.id == message.id)
(reaction) => reaction.type == reactionIcon.type) ?? SizedBox(
-1; width: 50.0,
return IconButton( ),
iconSize: 24, ...reactionIcons.map((reactionIcon) {
icon: Icon( final ownReactionIndex = message.ownReactions?.indexWhere(
reactionIcon.iconData, (reaction) => reaction.type == reactionIcon.type) ??
color: ownReactionIndex != -1 -1;
? StreamChatTheme.of(context).accentColor return IconButton(
: Theme.of(context).iconTheme.color.withOpacity(.5), iconSize: 24,
), icon: Icon(
onPressed: () { reactionIcon.iconData,
if (ownReactionIndex != -1) { color: ownReactionIndex != -1
removeReaction( ? StreamChatTheme.of(context).accentColor
context, : Theme.of(context).iconTheme.color.withOpacity(.5),
message.ownReactions[ownReactionIndex], ),
); onPressed: () {
} else { if (ownReactionIndex != -1) {
sendReaction( removeReaction(
context, context,
reactionIcon.type, message.ownReactions[ownReactionIndex],
); );
} } else {
}, sendReaction(
); context,
}).toList(), reactionIcon.type,
), );
}
},
);
}).toList(),
]),
); );
} }