Description
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.