-
Notifications
You must be signed in to change notification settings - Fork 36
implement: Keep Chat scroll position when leaving and re-entering it #471 #1484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
I've only encountered one case where this functionality doesn't work, when the top object is the last long message. In this case, a jump to the end of the message occurs and I have not found a reason for this behavior given the |
|
@sorewanya, this sounds like a bug, I guess. |
"fix" e2e test
yes, and I think try to solve it by use Finaly I use directly Unfortunately, I couldn't find the reason for this behavior when scrolling to the very top or scrolling a little past the display of second(of bottom) messages after the last one. |
|
FCM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work! Please, take a detailed look at the UX moments I've commented you about - those are essential for frontend application. Those things are first priority always.
Also please don't forget about Effective Dart and Contribution Guide. Those documents exist for the teams to be able to cooperate as efficiently as possible. And the review process shouldn't be considered as an opportunity for someone to comment you about those documents being violated. You should do a self-review ideally with those things in mind before sending the PR for a final review, please.
use addPostFrameCallback; don't animate, use jumpToIndex; don't save index, use itemId
…/messenger into KeepChatScrollPosition
SleepySquash
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some thoughts I had by looking at the code, please. Take a look, please!
| listController.position.pixels > | ||
| MediaQuery.of(context).size.height * 2 + 200; | ||
| MediaQuery.of(context).size.height * 2 + 200 || | ||
| (_lastVisibleItem?.index ?? 0) > 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand correctly that this one here is a try to fix the "scroll down" button? Perhaps a different mechanism should be implemented in order for that button to work as intended? I don't really like an idea of adding some more logic just to "patch a hole".
##Background
Messenger Gapopa. Chat page. Scroll in chat.
##Problem to solve
To do: save scroll position when re-entering chat.
Suggested time to implement: ~2 days.
For example: open chat and scroll, after that go to any otherr page or a different chat, then go back to the chat and make sure that the scroll stays exactly the same as it was when leaving the chat.
##Requirements:
the scroll position should be saved when re-entering chat.
when closing the application the scroll position should NOT be saved.
Possible solutions
As a possibility, you can save the ID and offset of the top/bottom element in chat and reuse it. There should be no persist, since remembering the position is not required.
Solution
Save it in the 'static Map' with the key id.val , and in the value the object with the selected object ChatItemId and the offset taken from _topVisibleItem
Checklist
k::labels applied