Pagination #657
Replies: 10 comments
-
@demchenkoalex can you provide a demo example of how to add messages when a user scrolls to the top correctly? Updating the |
Beta Was this translation helpful? Give feedback.
-
I think pagination is described in the docs already, with a snippet, https://docs.flyer.chat/flutter/chat-ui/advanced-usage#pagination, it was working for years. I don't like this |
Beta Was this translation helpful? Give feedback.
-
also there is no page control, so your messages will be adding indefinitely, with the same |
Beta Was this translation helpful? Give feedback.
-
The ID was only "R" since I was only adding one message, and there are no messages with that ID, so it was a valid ID to demonstrate the bug. So you're saying that this code loads indefinitely because I am not updating the page count or stop adding new messages? How would this work if the function itself should only add one new message, how do I tell the |
Beta Was this translation helpful? Give feedback.
-
Reopening after accidentally closing. |
Beta Was this translation helpful? Give feedback.
-
Because this is how pagination works - it looks when you are close to the end of the list, and it triggers a function to load new data. If you do nothing in that function, it will be called indefinitely, because you are always close to the end of the list. If you take a standard example of having 20 items in the list, you scroll to the end and function is triggered, possibly setting loading state to true for the time of the api request, and then when next 20 items are loaded, setting a new page. Then in the function you block fetching in 2 cases: currently loading and current page is the same you try to load. Then, when only 1 item will be left, api will let you know that there are no more items, and your last page will be set in state, so pagination will never be triggered anymore. In your case, you want to add 1 message without any api request - you just need to have a state, similar to page, named however you like. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
hmm I never thought about this specific use case. I am currently super busy with a full redesign in |
Beta Was this translation helpful? Give feedback.
-
Could you tell us in advance what the v2 features are and what the design considerations are? 能否提前告知下,v2 版本有哪些特性功能,以及那些设计考量? Now I plan to add group chat function to my open source project (https://github.com/imboy-pub/imboy-flutter), which needs @group_member function, I don't know if flutter_chat_ui has good support for this function? 我现在打算把我的开源项目(https://github.com/imboy-pub/imboy-flutter)添加如群聊功能,需要 @group_member 的功能特性,不知道 flutter_chat_ui 有没有对该功能很好的支持 |
Beta Was this translation helpful? Give feedback.
-
currently v2 looks like not much, because I focused on architecture and performance first. As of right now I have:
I am trying to create a solid "core" that will be extendable to any use case. Then will build on top what I have now, then new features like replies, reactions etc. Everything should be plug&play (composition) so different parts can be swiped out to custom implementation easily |
Beta Was this translation helpful? Give feedback.
-
The flutter_chat_ui package allows developers to add pagination items when users scroll to the top of the Chat widget. However, when I do a basic implementation of adding a
TextMessage
to the underlyingList<Message>
used in theChat
widget, I continuously get this error.'package:flutter/src/widgets/layout_builder.dart': Failed assertion: line 173 pos 12: 'renderObject.child == child': is not true.
I have spent countless hours trying to figure this out, looking at the source code of the package itself, and modifying thegetMoreData
function, but seeing how there are no issues or anything about this, I must have something wrong.Here is my implementation of getMoreData
When I run this, and scroll to the top of my app, I get this error:
Beta Was this translation helpful? Give feedback.
All reactions