Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #83
Closes #82
Started working on this.
Here's what i did
Added an optional parameter anchor to MessageList and started fetching newer Messages similar to how older messages were being fetched around the anchor(if one is given)
Changed the single sliver to two slivers that grow in opposite directions. The center is after the anchor message with newer messages growing downward in the bottom sliver
Handled the case of when user is looking at the latest messages by adding a condition that when the scroll is less than (viewport size + 300 px) away from the bottom it scrolls down to the bottom. This is required now as adding new messages doesn't cause the messages to jump up. Fetching newer messages causes no jump or scroll though
The navigateToBottom button was initially set to scroll down to 0 which was after the changes was only scrolling down to the zero index of the toplist so i changed it to scrolldown to maxScrollExtent.
But still the navigate button works correctly when new messages are fetched as part of the scrolling process but when a single message is added to the list the maxScrollExtent does not scroll all the way down as it (for some reason) calculates the maxScrollExtent wrong.
What I did to fix the above problem was to call the scrollDown function repeatedly until the end is reached.
Videos:
20250119-1825-45.3281596.mp4
20250119-1831-50.5506127.mp4
Chat:
https://chat.zulip.org/#narrow/channel/516-mobile-dev-help/topic/Control.20scroll.20position.20on.20new.20and.20newly-fetched.20messages