Skip to content
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

"Beginning of chat" widget #116

Open
gazialankus opened this issue Jan 10, 2025 · 0 comments · May be fixed by #117
Open

"Beginning of chat" widget #116

gazialankus opened this issue Jan 10, 2025 · 0 comments · May be fixed by #117

Comments

@gazialankus
Copy link

In the scrollable area, at the very top, I would like to place a widget as the beginning marker of the chat. There will be instructions and similar content there. I know that there is loadEarlier but it is just a temporary widget. So this would be a new parameter listStartWidget in MessageListOptions.

How this relates to onLoadEarlier: this beginning marker should only appear when we reach the very beginning of the chat and no earlier messages are there to be loaded. So it will show only under these conditions:

  • there is no onLoadEarlier
  • onLoadEarlier is called but it does not load anything (which requires it to inform us whether data was loaded)

At the moment we cannot know whether onLoadEarlier loaded anything or not. Two options come to mind:

  • Compare before and after contents of messages: this is hacky. While trying to load, user could add new messages which would make comparison at top difficult. We could compare the topmost message in before and after. Still hacky.
  • onLoadEarlier returns a bool?, returns false when it reached the beginning and next attempt will not load anything. Nullability makes it compatible with old code.

So my suggestion is:
Future<bool?> onLoadEarlier(); // returns false when top of chat is reached
Widget? listStartWidget // shown before the very first chat message on top

What do you think? I would be happy to create the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant