autoScrollToBottom method
Scroll the content to the bottom.
By default, this will scroll using the app's default animation
duration and curve. When jump
is false, this will scroll by jumping
instead.
Implementation
Future<void> autoScrollToBottom({bool jump = false}) async {
if (jump) {
jumpTo(position.maxScrollExtent);
} else {
await animateTo(
position.maxScrollExtent,
duration: rapidDuration,
curve: defaultCurve,
);
}
// Scroll again if we've received new content in the interim.
if (hasClients) {
final pos = position;
if (pos.pixels != pos.maxScrollExtent) {
jumpTo(pos.maxScrollExtent);
}
}
}