Closed PawfectLLC closed 8 months ago
And I have tried to change state.loading part to a chat as well. didn't work either.
builder: (context, state) {
if (state.isLoading) {
//return Center(child: CircularProgressIndicator());
return chat.Chat(
messages: state.conversations != null? state.conversations.where((element) => element.id == widget.conversationId).first.messages: [],
onSendPressed: (partialText) => _handleSendText(partialText),
//user: types.User(id: state.conversations.where((element) => element.id == widget.conversationId).first.otherUsername),
user: types.User(id: widget.currentUserId),
showUserAvatars: true,
//onEndReached: _loadMoreMessages,
onAttachmentPressed: _handleImageSelection,
onMessageTap: _handleMessageTap,
);
} else if (state.errorMessage != null) {
//return Center(child: Text(state.errorMessage!));
return Center(child: Text("No conversations found"));
} else
if (state.conversations.isNotEmpty) {
return chat.Chat(
messages: state.conversations.where((element) => element.id == widget.conversationId).first.messages,
onSendPressed: (partialText) => _handleSendText(partialText),
//user: types.User(id: state.conversations.where((element) => element.id == widget.conversationId).first.otherUsername),
user: types.User(id: widget.currentUserId),
showUserAvatars: true,
//onEndReached: _loadMoreMessages,
onAttachmentPressed: _handleImageSelection,
onMessageTap: _handleMessageTap,
);
}
else {
return Center(child: Text("No conversations found"));
}
}
where does this grey loading screen comes from? it is not a part of the library for sure
where does this grey loading screen comes from? it is not a part of the library for sure
Hi Alex, thanks for getting back to me. I have no idea where this screen is coming from, as you can see in my code. There’s nowhere that I have called a loading screen. The gray loading screen happened after I called Chat. Could it be somewhere inside the library where it could call the system’s loading screen? Thanks!
No, never coded any loading screens 😕 I also have example with firebase where messages come and I never saw any loading screens either
AH! Thank you so much for the clarification! It is coming from my end of getting user's avatar. Finally figured it out! Thank you so much!
https://github.com/flyerhq/flutter_chat_ui/assets/137581900/a4eecad6-7a94-44b8-8e9d-67ffd621a4d2
the video shows the issue i am facing: sending message has no issue, but receiving message shows a flash screen. I used a bloc state to update the chat, and each time state is updated, chat is updated. I don't know why this happened, because both sending message and receiving message are from the same function, with the same state update mechanism. Can someone help me with this issue? Thanks a million.
below is my code: