MoInfiniteScrollSliver<T> constructor
const
MoInfiniteScrollSliver<T> ({
- Key? key,
- required PageFetcher<
T> fetcher, - required Widget itemBuilder(
- BuildContext context,
- T item
- int limit = 20,
- int prefetchOffset = 3,
- MoInfiniteScrollController<
T> ? controller, - Widget? loadingPlaceholder,
- Widget? emptyPlaceholder,
- Widget? errorPlaceholder,
- Widget? loadingMoreIndicator,
- Widget separatorBuilder(
- BuildContext context,
- int index
Creates a MoInfiniteScrollSliver.
Implementation
const MoInfiniteScrollSliver({
super.key,
// ── Required ────────────────────────────────────────────────────────────
required this.fetcher,
required this.itemBuilder,
// ── Pagination ──────────────────────────────────────────────────────────
/// Number of items to request per page. Passed directly to [fetcher].
/// Defaults to 20.
this.limit = 20,
/// How many items from the end should trigger a pre-fetch.
/// Defaults to 3.
this.prefetchOffset = 3,
// ── External controller ─────────────────────────────────────────────────
/// Optional external controller. Expose this to allow the parent widget
/// (e.g. a [RefreshIndicator]) to call [MoInfiniteScrollController.refresh].
this.controller,
// ── Placeholders ────────────────────────────────────────────────────────
/// Widget shown while the very first page is loading.
/// Defaults to [DefaultLoadingPlaceholder].
this.loadingPlaceholder,
/// Widget shown when the list is empty after a successful fetch.
/// Defaults to [DefaultEmptyPlaceholder].
this.emptyPlaceholder,
/// Widget shown when a fetch throws an error.
/// Defaults to [DefaultErrorPlaceholder].
this.errorPlaceholder,
/// Widget shown at the bottom of the list while loading more pages.
/// Defaults to a centred [CircularProgressIndicator].
this.loadingMoreIndicator,
/// Optional separator builder, mirroring [SliverList] usage.
this.separatorBuilder,
});