当我将一个项目添加到列表时,我想滚动到底部,所以我这样做:
SchedulerBinding.instance.addPostFrameCallback((_) {
print('maxScrollExtent: ${messageListViewCtrl.position.maxScrollExtent}');
messageListViewCtrl.animateTo(
messageListViewCtrl.position.maxScrollExtent,
duration: const Duration(milliseconds: 100),
curve: Curves.easeOut,
);
});
但是maxScrollExtent不是最新的,仍然是上次,我只做:
Future.delay(Duration(seconds: 2), () { //messageListViewCtrl.position.maxScrollExtent, now it's latest ! })