fix for janky scrolling when tapping reply with SuperSliverView
I don't like this but it does work.
This commit is contained in:
parent
aecfac9533
commit
7ab92f76bf
2 changed files with 27 additions and 19 deletions
|
|
@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue