fix for janky scrolling when tapping reply with SuperSliverView

I don't like this but it does work.
This commit is contained in:
Henry Hiles 2026-09-24 22:46:48 -04:00
commit 7ab92f76bf
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 27 additions and 19 deletions

View file

@ -92,27 +92,34 @@ final class ChatScroll<T>({
);
if (historyIndex != -1) {
historyListController.value.animateToItem(
index: historyIndex,
scrollController: scrollController,
alignment: 0.5,
duration: (_) => .new(milliseconds: 700),
curve: (_) => Curves.easeInOut,
// TODO: Replace SuperSliverView because of the bug that requires this: #94
// ignore: invalid_use_of_visible_for_testing_member
final offset = historyListController.value.getOffsetToReveal(
historyIndex,
0.5,
);
return;
}
await scrollController.animateTo(
offset,
duration: const Duration(milliseconds: 700),
curve: Curves.easeInOut,
);
} else {
final liveIndex = split.live.indexWhere((item) => id(item) == itemId);
if (liveIndex != -1) {
liveListController.value.animateToItem(
index: liveIndex,
scrollController: scrollController,
alignment: 0.5,
duration: (_) => .new(milliseconds: 700),
curve: (_) => Curves.easeInOut,
// ignore: invalid_use_of_visible_for_testing_member
final offset = liveListController.value.getOffsetToReveal(
liveIndex,
0.5,
);
await scrollController.animateTo(
offset,
duration: const Duration(milliseconds: 700),
curve: Curves.easeInOut,
);
}
}
}

View file

@ -95,10 +95,11 @@ final class const RoomChat({
Future<void> jumpToId(String eventId) async {
highlightedEvent.value = eventId;
await scroll.jumpToId(eventId);
final jump = scroll.jumpToId(eventId);
await Future.delayed(.new(seconds: 1), () {
if (highlightedEvent.value == eventId) highlightedEvent.value = null;
});
await jump;
}
IList<PopupMenuEntry> getEventOptions(Event event) =>