Comments (7)
Hi @UADACID the example is here https://docs.flyer.chat/flutter/chat-ui/advanced-usage#pagination you just need to add a boolean property, let's say _isRequesting
(similarly to the example's _page
) and set it to true before the request and to false after (after _page
in the example).
from flutter_chat_ui.
Hi @gtu-myowin no, function should always be passed, otherwise chat will think there is no pagination. But inside the function, _handleEndReached
, just don't fetch when _isRequesting
is true, do an early exit. Chat will be trying to use _handleEndReached
multiple times, but with the early exit nothing will be happening, and eventually if data will be loaded, _handleEndReached
won't be triggered, cause new items will appear (will trigger again if you will continue scrolling) and if there will be an error, it will try to re-fetch again on pull.
from flutter_chat_ui.
Hi @infernowalker
Thanks you!
Of course it is being called many times, it is a developer's job to set requesting state, fire a request, update data source and set requesting to false :) only one request :)
from flutter_chat_ui.
Hi @infernowalker
Thanks you!
Of course it is being called many times, it is a developer's job to set requesting state, fire a request, update data source and set requesting to false :) only one request :)
any example to handle this case ?
from flutter_chat_ui.
https://docs.flyer.chat/flutter/chat-ui/advanced-usage#pagination
Thanks you! 😆😆😆 @demchenkoalex
from flutter_chat_ui.
Hi @demchenkoalex, I just wanted to be sure. Are you saying to fire onEndReached
conditionally like this?
Chat(
messages: _messages,
onAttachmentPressed: _handleAtachmentPressed,
onMessageTap: _handleMessageTap,
onPreviewDataFetched: _handlePreviewDataFetched,
onSendPressed: _handleSendPressed,
showUserAvatars: true,
showUserNames: true,
user: _user,
onEndReached: _isRequesting ? null : _handleEndReached, // I'm talking about this line.
isLastPage: _isLastPage,
)
from flutter_chat_ui.
Thank you for your explanation. I will give it a try.
from flutter_chat_ui.
Related Issues (20)
- How to change the word "is typing" in TypingIndicatorOptions HOT 2
- While scrolling every message in the chat is rebuilt which is causing performance issues HOT 3
- when trying to send Video Message it successful but the video is invisible HOT 3
- Samsung Keyboard Delete message bug HOT 1
- Padding of text HOT 2
- Transparent `customBottomWidget` HOT 3
- PopScope and TextScaler aren't found HOT 1
- How do I stream messages like chatgpt? HOT 3
- How to copy and paste the image to inputbox and send images? HOT 1
- Unresolved Chat class
- Janky scroll on chat list HOT 3
- Update on V2 release and checklist HOT 3
- message.copyWith(status: types.Status.status) does not working
- Using ChatList Component as a Standalone Widget HOT 1
- messageList.insert(0, message) always shows incoming messages as my own. HOT 3
- flutter build web --wasm failed due to RangeError HOT 5
- Alternative input options (instead of text input) for a chat game HOT 2
- How do I make message that links to another page HOT 1
- The argument type 'ScrollController' can't be assigned to the parameter type 'AutoScrollController?'.
- the send button doesnt appear on my phone till i press symbols or space also in my emulator but it works perfectly with the pc keyboard on the emulator
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_chat_ui.