flyerhq / flutter_chat_ui

Actively maintained, community-driven chat UI implementation with an optional Firebase BaaS.
https://flyer.chat
Apache License 2.0
1.59k stars 687 forks source link

Ability to disable auto scroll #629

Open JHubi1 opened 3 weeks ago

JHubi1 commented 3 weeks ago

Is your feature request related to a problem?

At the moment, the chat view always scrolls to the bottom of the latest message if one is updated. In general, that is great, but there might be a situation in which a different behavior is needed.

What solution would you suggest?

I'd like to see a property value like autoscroll which is set to true by default and that toggles the scrolling to the bottom.

Code snippets 📝

Chat(
  messages: messages,
  key: chatKey,
  autoscroll: false
)

Is there any additional solution to that?

The function that scrolls to the bottom is made to an argument, so it can be overwritten with an empty function and the scroll would be disabled as well.

Code snippets 📝

Chat(
  messages: messages,
  key: chatKey,
  onNewMessage: (id) {}
)

Related issues/PRs

Issue #354 mentions the issue, but doesn't go into detail.

demchenkoalex commented 1 week ago

everything is going to v2 now, lately I have been working 2-3 hours a day for the past 2 weeks or so, with ai agent example as well, so it will be miles better for ai