Skip to content

"Beginning of chat" widget #116

Open
@gazialankus

Description

@gazialankus

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions