fetchNextBatchOnPageEnd method

void fetchNextBatchOnPageEnd(
  1. ScrollController scrollController,
  2. BuildContext context,
  3. WidgetRef ref
)

Implementation

void fetchNextBatchOnPageEnd(
  ScrollController scrollController,
  BuildContext context,
  WidgetRef ref,
) {
  double maxScroll = scrollController.position.maxScrollExtent;
  double currentScroll = scrollController.position.pixels;
  double delta = MediaQuery.of(context).size.width * 0.20;
  if (maxScroll - currentScroll <= delta) {
    ref.read(widget.paginatedController.notifier).fetchNextPage();
  }
}