parent
8da46dffe4
commit
41bdb04b72
1 changed files with 21 additions and 0 deletions
|
|
@ -94,6 +94,27 @@ final class ChatScroll({
|
||||||
);
|
);
|
||||||
}, [controllerData, anchorId.value]);
|
}, [controllerData, anchorId.value]);
|
||||||
|
|
||||||
|
final lastRowId = split.live.lastOrNull;
|
||||||
|
final previousLastRowId = useRef<int?>(null);
|
||||||
|
|
||||||
|
useEffect(() {
|
||||||
|
final previous = previousLastRowId.value;
|
||||||
|
previousLastRowId.value = lastRowId;
|
||||||
|
|
||||||
|
if (previous == null || lastRowId == null || previous == lastRowId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!atBottom.value || contextualEvent.value != null) return null;
|
||||||
|
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
if (!scrollController.hasClients) return;
|
||||||
|
|
||||||
|
scrollController.jumpTo(scrollController.position.minScrollExtent);
|
||||||
|
});
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}, [lastRowId]);
|
||||||
|
|
||||||
useEffect(
|
useEffect(
|
||||||
() {
|
() {
|
||||||
const loadThreshold = 500.0;
|
const loadThreshold = 500.0;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue