'How ListView scroll to bottom accurately?
It seems Controller.position.maxScrollExtent is a predicted value since the bottom items haven't been rendered,Controller.jumpTo(Controller.position.maxScrollExtent)) can not work.
Solution 1:[1]
ScrollController _controller = ScrollController();
void jumpTo() {
SchedulerBinding.instance!.addPostFrameCallback((_) {
if (_controller.hasClients) {
_controller.animateTo(
_controller.position.maxScrollExtent,
duration: const Duration(milliseconds: 100),
curve: Curves.elasticInOut,
);
}
});
}
Assign this _controller to Listview controller
and call jumpTo()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rasityilmaz |
