animateToBottom method

Future<void> animateToBottom()

Implementation

Future<void> animateToBottom() async {
  await Future<void>.delayed(const Duration(milliseconds: 200));
  while (shouldAnimateToBottom) {
    // See animateToTop: the scroll view may have detached while suspended.
    if (!scrollController.hasClients) return;
    shouldAnimateToBottom =
        scrollController.offset < scrollController.position.maxScrollExtent;
    await scrollController.animateTo(
      min(
        scrollController.offset + 30,
        scrollController.position.maxScrollExtent,
      ),
      duration: const Duration(milliseconds: 20),
      curve: Curves.easeInOutCubic,
    );
  }
}