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) { if (historyIndex != -1) {
historyListController.value.animateToItem( // TODO: Replace SuperSliverView because of the bug that requires this: #94
index: historyIndex, // ignore: invalid_use_of_visible_for_testing_member
scrollController: scrollController, final offset = historyListController.value.getOffsetToReveal(
alignment: 0.5, historyIndex,
duration: (_) => .new(milliseconds: 700), 0.5,
curve: (_) => Curves.easeInOut,
); );
return; await scrollController.animateTo(
} offset,
duration: const Duration(milliseconds: 700),
curve: Curves.easeInOut,
);
} else {
final liveIndex = split.live.indexWhere((item) => id(item) == itemId); final liveIndex = split.live.indexWhere((item) => id(item) == itemId);
if (liveIndex != -1) { if (liveIndex != -1) {
liveListController.value.animateToItem( // ignore: invalid_use_of_visible_for_testing_member
index: liveIndex, final offset = liveListController.value.getOffsetToReveal(
scrollController: scrollController, liveIndex,
alignment: 0.5, 0.5,
duration: (_) => .new(milliseconds: 700),
curve: (_) => Curves.easeInOut,
); );
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 { Future<void> jumpToId(String eventId) async {
highlightedEvent.value = eventId; highlightedEvent.value = eventId;
await scroll.jumpToId(eventId); final jump = scroll.jumpToId(eventId);
await Future.delayed(.new(seconds: 1), () { await Future.delayed(.new(seconds: 1), () {
if (highlightedEvent.value == eventId) highlightedEvent.value = null; if (highlightedEvent.value == eventId) highlightedEvent.value = null;
}); });
await jump;
} }
IList<PopupMenuEntry> getEventOptions(Event event) => IList<PopupMenuEntry> getEventOptions(Event event) =>