fix: Scrolling in fragmented timeline
This commit is contained in:
parent
53af09227f
commit
cacb944918
4 changed files with 45 additions and 43 deletions
|
|
@ -224,9 +224,14 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
final timeline = this.timeline;
|
||||
if (timeline == null) return;
|
||||
Logs().v('Requesting future...');
|
||||
final mostRecentEventId = timeline.events.first.eventId;
|
||||
|
||||
final mostRecentEvent = timeline.events.filterByVisibleInGui().firstOrNull;
|
||||
|
||||
await timeline.requestFuture(historyCount: _loadHistoryCount);
|
||||
setReadMarker(eventId: mostRecentEventId);
|
||||
|
||||
if (mostRecentEvent != null) {
|
||||
setReadMarker(eventId: mostRecentEvent.eventId);
|
||||
}
|
||||
}
|
||||
|
||||
void _updateScrollController() {
|
||||
|
|
@ -241,11 +246,6 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
setState(() => _scrolledUp = false);
|
||||
setReadMarker();
|
||||
}
|
||||
|
||||
if (scrollController.position.pixels == 0 ||
|
||||
scrollController.position.pixels == 64) {
|
||||
requestFuture();
|
||||
}
|
||||
}
|
||||
|
||||
void _loadDraft() async {
|
||||
|
|
@ -458,7 +458,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
|
||||
void onInsert(int i) {
|
||||
// setState will be called by updateView() anyway
|
||||
animateInEventIndex = i;
|
||||
if (i <= 5) animateInEventIndex = i;
|
||||
}
|
||||
|
||||
Future<void> _getTimeline({String? eventContextId}) async {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue