FirestorePagination constructor
const
FirestorePagination({
- required Query<
Object?> query, - required Widget itemBuilder(
- BuildContext,
- List<
DocumentSnapshot< ,Object?> > - int
- Key? key,
- Widget separatorBuilder()?,
- int limit = 10,
- ViewType viewType = ViewType.list,
- bool isLive = false,
- SliverGridDelegate gridDelegate = const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
- WrapOptions wrapOptions = const WrapOptions(),
- PageOptions pageOptions = const PageOptions(),
- Widget onEmpty = const EmptyScreen(),
- Widget bottomLoader = const BottomLoader(),
- Widget initialLoader = const InitialLoader(),
- Axis scrollDirection = Axis.vertical,
- bool reverse = false,
- bool shrinkWrap = false,
- ScrollPhysics? physics,
- EdgeInsetsGeometry? padding,
- ScrollController? controller,
- PageController? pageController,
Creates a StreamBuilder widget that automatically loads more data when the user scrolls to the bottom.
Optimized for FirebaseFirestore
with fields like createdAt
and
timestamp
to sort the data.
Supports live updates and realtime updates to loaded data.
Data can be represented in a ListView, GridView or scollable Wrap.
Implementation
const FirestorePagination({
required this.query,
required this.itemBuilder,
super.key,
this.separatorBuilder,
this.limit = 10,
this.viewType = ViewType.list,
this.isLive = false,
this.gridDelegate = const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
),
this.wrapOptions = const WrapOptions(),
this.pageOptions = const PageOptions(),
this.onEmpty = const EmptyScreen(),
this.bottomLoader = const BottomLoader(),
this.initialLoader = const InitialLoader(),
this.scrollDirection = Axis.vertical,
this.reverse = false,
this.shrinkWrap = false,
this.physics,
this.padding,
this.controller,
this.pageController,
});