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
feat: add unseen messages banner and scroll to first unseen functionality #209
Conversation
Will ask @dariakhimych to create some designs :) Floating top button might a good addition too, as long as we can calculate the offset we need to scroll to. About |
Cool! To me, there are two concepts one could use to improve the seen by:
I actually like 1. now that you mentioned it because one can also compute 2. quite easily for most use cases. The only drawback of 1. is that we can "forget" about older messages that we have not read. On the other hand, I might even prefer this over the other way that e.g. Slack uses where you actually have to look at every message or the top scroll button does not disappear (or you can dismiss the top scroll button). But that is perhaps just me. We would just have to make sure that the unread message banner location is calculated on initialization and does not change later because otherwise it would go away immediately when the "last message seen" array changes for my user and points to the newest message that I now have seen. But 2. would surely also work and be more like Slack. I'm not super satisfied with how the statuses are then not the whole source of truth because "seenByAll" would be computed based on whether the array is full. Also, this way would require write permissions on the message which is basically a no-go actually. What do you think? |
d7036e3
to
44bd3ec
Compare
I tested out Also, now you can specify a |
- this also enables scroll to message functionality
44bd3ec
to
03647e8
Compare
Hey! No pressure but are there any updates in terms of the design? |
Yeah, will cycle back on this one. |
Icon: icon-arrow.zip in Telegram I noticed chat opens already on the "unread messages" banner, so this component on the screenshot is theoretically something else, scroll to bottom, when you scroll a bit of the chat, but if you want a scroll to first unread, you can just reverse the icon to point top. |
# Conflicts: # example/assets/messages.json # example/lib/main.dart # lib/src/widgets/chat.dart # lib/src/widgets/chat_list.dart # pubspec.yaml
@demchenkoalex I'd be in favour of adding the scroll to bottom indicator in a separate PR. If you agree, let us create a new issue for it with the icon attached. Please consider that the Also, I tried to make the distances configurable too but it is quite the pain right now because distances between messages are added in many different places (margins, spacer objects, etc). We should rework this when we go over the Themes. |
Yes. I have added icon to the project on main to not lose it.
There is actually another PR opened which will allow us to move from calculating diffs and animated list view to the normal list view, and
This was a limitation I faced when using animated list view. If the PR I mentioned above will work as I expect it to work, we will be able to unify all distances, as well as give option to render time inside the bubble. |
I looked at the PRs and unfortunately, they will not help in this regard. It's about which scroll controller we use if one is provided. We could either require users to pass in an Another small thing to decide: Should we jump to the latest unread or scroll like we do here? One could override it right now by setting the scrollTo duration to zero. |
I think we jump, but it can be configurable. As for the passing controller - users will need to always manually pass it? Less params to pass = better IMO, no way to set it as default one without users to explicitly pass it? or if they want to override it just say that they should use the one we export, similarly to the |
With "require", I actually just meant that if they provide one it has to be an |
This is fine then 👍 |
Thanks for the PR! |
What does it do?
Add an unread messages banner and the option to scroll to the first unread message on chat open.
Why is it needed?
Users should have a way of being brought directly to the content they need to see most urgently. In many cases this is the first unread message.
How to test it?
In the example app, I have set
scrollToUnseenOnOpen
so it should immediately scroll to the first message.Related issues/PRs
Closes #179 and closes #213
This is built on top of #208 and should not be merged before it. Second part of #179.
Open Questions / TODO
seenBy
array on messages to check for the first message which is not marked as seen by the current user?