infinite_paging_widget

CI pub package

A lightweight Flutter infinite scroll list/grid with load-more pagination.

Pass your items and an onLoadMore callback — when the user scrolls near the bottom, the widget asks for the next page. Supports empty, loading, error, header, footer, pull-to-refresh, and end-of-list slots out of the box.

Demo

Features

  • List and grid layouts via PagingDisplayType
  • Near-bottom load-more with configurable loadThreshold
  • Guards against overlapping load requests
  • Empty / loading / error / header / footer / no-more slots
  • Optional pull-to-refresh via onRefresh
  • Scroll axis, reverse, cache extent, and keyboard dismiss controls
  • Optional list separators and external ScrollController
  • Zero third-party dependencies beyond Flutter

Install

dependencies:
  infinite_paging_widget: ^0.2.0
import 'package:infinite_paging_widget/infinite_paging_widget.dart';

Usage

InfinitePagingWidget<String>(
  items: items,
  hasMore: hasMore,
  isLoading: isLoading,
  onLoadMore: () => loadNextPage(),
  onRefresh: () => refreshFromStart(),
  noMoreWidget: (context) => const Padding(
    padding: EdgeInsets.all(16),
    child: Text('End of list', textAlign: TextAlign.center),
  ),
  itemBuilder: (context, item, index) {
    return ListTile(title: Text(item));
  },
)

Grid

InfinitePagingWidget<Product>(
  displayType: PagingDisplayType.grid,
  gridCrossAxisCount: 2,
  gridChildAspectRatio: 0.75,
  items: products,
  hasMore: hasMore,
  isLoading: isLoading,
  onLoadMore: loadNextPage,
  itemBuilder: (context, product, index) => ProductCard(product: product),
)

Customization

Parameter Description
items Current page contents
itemBuilder Builds each row/cell
onLoadMore Called near the bottom when hasMore
displayType PagingDisplayType.list or .grid
hasMore Suppress further loads when false
enableLoadMore Disable pagination without clearing hasMore
isLoading External loading flag
loadThreshold Pixels from bottom that trigger load
loadingWidget Initial + bottom loading UI
loadMorePadding Padding around the bottom loading slot
emptyWidget Shown when items is empty
errorWidget Optional error slot below content
noMoreWidget Shown when !hasMore and items exist
onRefresh Pull-to-refresh callback (wraps RefreshIndicator)
header / footer Slivers above / below the content
separatorBuilder List separators only
scrollController Optional external controller
scrollDirection / reverse Scroll axis and direction
cacheExtent / primary Viewport cache and primary scroll view
keyboardDismissBehavior Keyboard dismiss mode while scrolling

Example

See the example/ app for fake pagination in both list and grid modes, including pull-to-refresh and an end-of-list message.

License

MIT

Libraries

infinite_paging_widget
A Flutter infinite scroll list/grid with load-more pagination.