Code Monkey home page Code Monkey logo

Comments (8)

demchenkoalex avatar demchenkoalex commented on May 27, 2024 1

When new message is sent, chat will be scrolled to the bottom. This is how Telegram and Facebook Messenger work and there is no reason to do it differently. One problem is that I did it on message received event and forgot that it actually might be incoming message, not sent one, will fix that ASAP.

from flutter_chat_ui.

demchenkoalex avatar demchenkoalex commented on May 27, 2024

Fixed in v1.1.2.

from flutter_chat_ui.

jlubeck avatar jlubeck commented on May 27, 2024

@demchenkoalex I think this issue might have been misunderstood, since the experience now is worse than before.
Looks like now every time that I get a message, the chat scrolls down to the bottom. So on an active chat, there is no way for me to read old messages without getting thrown back to the bottom constantly.

The behavior before this fix was that when I was looking at old messages, it jumped around, but at least you were still NEAR the location of what you were reading.

If you see how all the other chat apps work, when you scroll up to look at old messages, you as the user control where you are, there is no auto scroll to the bottom, and no jumping around. You do usually also get a button at the bottom right to just scroll back to the bottom.

Hopefully this was clearer...

from flutter_chat_ui.

jlubeck avatar jlubeck commented on May 27, 2024

Yes, on message sent it's great that it scrolls to bottom. I was talking about received messages. Looking forward to the fix! :D

from flutter_chat_ui.

demchenkoalex avatar demchenkoalex commented on May 27, 2024

Regarding incoming messages and being somewhere in the chat history there is no fix. I don't see how it can be done from a library having no control over anything backend related. If we receive a message we add them, it is impossible to have arrays of not rendered messages or something, it will rather break everything else. Unfortunately having some kind of automatic solution may introduce those inconveniences and we will never be on Telegram/Messenger level just because they are apps and not libraries.

from flutter_chat_ui.

jlubeck avatar jlubeck commented on May 27, 2024

Mmm, I don't think the solution is backend related or to stop adding messages when you are not at the bottom... It's probably something with recalculating the scroll position or something like that when you are not at the bottom... but no worries. I'm more than happy to try to find the solution and then send a PR for you to review. Thanks for the quick replies as always

from flutter_chat_ui.

demchenkoalex avatar demchenkoalex commented on May 27, 2024

Fixed scroll to bottom for incoming messages here v1.1.4.

As for the jumps in the message history there is no easy fix. If not saving messages to some kind of an array for "future build" while browsing through the history, calculating position is the only option, but

  1. The list is animated so the height of the element is dynamic (can assume that this is not the problem because jumps are instant, meaning there is no animation when new element is added while browsing history)
  2. We need to calculate the incoming message(s) height(s), since we may have a date divider, message and spacer coming in at the same time, which is not a trivial task + probably will hurt performance badly (calculating size of List elements not visible on the screen, if possible at all)

There is also this issue flutter/flutter#74031 and I don't think that AnimatedList is fully finished and may need to be improved by Flutter team

from flutter_chat_ui.

jlubeck avatar jlubeck commented on May 27, 2024

Thank you for taking your time to checking this out again. Definitely sounds like a non trivial issue. But it's not unusable so it's not a breaking issue... I'll see if I can figure something out and share if I do. Thanks!

from flutter_chat_ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.