refactor: More stable scroll to event

This commit is contained in:
krille-chan 2023-12-26 18:51:53 +01:00
commit 7d112b1e18
No known key found for this signature in database
3 changed files with 21 additions and 4 deletions

View file

@ -367,6 +367,8 @@ class ChatController extends State<ChatPageWithRoom> {
return;
}
String? scrollToEventIdMarker;
Future<void>? _setReadMarkerFuture;
void setReadMarker({String? eventId}) {
@ -912,6 +914,9 @@ class ChatController extends State<ChatPageWithRoom> {
});
return;
}
setState(() {
scrollToEventIdMarker = eventId;
});
await scrollController.scrollToIndex(
eventIndex,
preferPosition: AutoScrollPosition.middle,