refactor chatview to have two sliver lists
Co-authored-by: Erwan Leboucher <erwanleboucher@gmail.com>
This commit is contained in:
parent
eeb2e2f54b
commit
110caff170
4 changed files with 161 additions and 152 deletions
|
|
@ -29,16 +29,9 @@ class RoomChatController(final String roomId)
|
|||
|
||||
if (!room.hasFetchedState) {
|
||||
final state = await client.getRoomState(.new(roomId: roomId));
|
||||
|
||||
await ref.read(RoomsController.provider.notifier).addState(roomId, state);
|
||||
}
|
||||
|
||||
// While there are under 20 events, try to load more
|
||||
// until there's no more or the conditions are met.
|
||||
if (room.hasMore && room.timeline.length < 20) {
|
||||
loadOlder();
|
||||
}
|
||||
|
||||
return room.timeline
|
||||
.toEntryIList(compare: (a, b) => (a?.key ?? 0).compareTo(b?.key ?? 0))
|
||||
.map((element) => element.value)
|
||||
|
|
|
|||
Loading…
Reference in a new issue