Open UmairSaqibBhutta opened 1 month ago
you mean that all messages are showed on 1 side?
yes exactly.
alignment is set here https://github.com/flyerhq/flutter_chat_ui/blob/2b5978c33600ec8d3574e6828c6cd030cafc254a/lib/src/widgets/message/message.dart#L357 where final currentUserIsAuthor = user.id == message.author.id;
. I see you pass _user
so make sure it's id equals to id of author.id
field of a message when you want messages aligned to the right, and not equals if you want messages on the left.
in your logic I also see you do
if (message.author.id != userId) {
log("adding msg");
if (messageList[0].id != message.id) {
messageList.insert(0, message);
}
}
and then you use messageList
as message and not snapshot data, so according to your logic you only add messages where message author is not current user, so you will only see messages on the left side
I am fetching other user messages from Firebase and showing them in the chat list. but it always indicates streambuilder data messages as my own. I am given the proper author ID but I have the same issue.