SmartPagination<T>.listViewWithCubit constructor
SmartPagination<T>.listViewWithCubit ({
- Key? key,
- required SmartPaginationCubit<
T> cubit, - required Widget itemBuilder(
- BuildContext context,
- List<
T> documents, - int index
- double? heightOfInitialLoadingAndEmptyWidget,
- Widget onError(
- Exception exception
- void onReachedEnd(
- SmartPaginationLoaded<
T> loader
- SmartPaginationLoaded<
- void onLoaded(
- SmartPaginationLoaded<
T> loader
- SmartPaginationLoaded<
- Widget emptyWidget = const EmptyDisplay(),
- Widget loadingWidget = const InitialLoader(),
- Widget bottomLoader = const BottomLoader(),
- bool shrinkWrap = false,
- bool reverse = false,
- Axis scrollDirection = Axis.vertical,
- EdgeInsetsGeometry padding = const EdgeInsetsGeometry.all(0),
- ScrollPhysics? physics,
- ScrollController? scrollController,
- bool allowImplicitScrolling = false,
- ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
- Widget? header,
- SmartPaginationLoaded<
T> beforeBuild(- SmartPaginationLoaded<
T> state
- SmartPaginationLoaded<
- ListBuilder<
T> ? listBuilder, - double? cacheExtent,
- Widget? separator,
- double spacing = 4,
- Widget firstPageLoadingBuilder(
- BuildContext context
- Widget firstPageErrorBuilder(
- BuildContext context,
- Exception error,
- VoidCallback retry
- Widget firstPageEmptyBuilder(
- BuildContext context
- Widget loadMoreLoadingBuilder(
- BuildContext context
- Widget loadMoreErrorBuilder(
- BuildContext context,
- Exception error,
- VoidCallback retry
- Widget loadMoreNoMoreItemsBuilder(
- BuildContext context
- int invisibleItemsThreshold = 3,
- SmartPaginationRefreshedChangeListener? refreshListener,
- List<
SmartPaginationFilterChangeListener< ? filterListeners,T> >
Creates a pagination widget as a ListView layout with an external Cubit
Implementation
SmartPagination.listViewWithCubit({
super.key,
required this.cubit,
required this.itemBuilder,
this.heightOfInitialLoadingAndEmptyWidget,
this.onError,
this.onReachedEnd,
this.onLoaded,
this.emptyWidget = const EmptyDisplay(),
this.loadingWidget = const InitialLoader(),
this.bottomLoader = const BottomLoader(),
this.shrinkWrap = false,
this.reverse = false,
this.scrollDirection = Axis.vertical,
this.padding = const EdgeInsetsGeometry.all(0),
this.physics,
this.scrollController,
this.allowImplicitScrolling = false,
this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
this.header,
this.footer,
this.beforeBuild,
this.listBuilder,
this.cacheExtent,
Widget? separator,
double spacing = 4,
// State Separation Builders
this.firstPageLoadingBuilder,
this.firstPageErrorBuilder,
this.firstPageEmptyBuilder,
this.loadMoreLoadingBuilder,
this.loadMoreErrorBuilder,
this.loadMoreNoMoreItemsBuilder,
// Performance Options
this.invisibleItemsThreshold = 3,
SmartPaginationRefreshedChangeListener? refreshListener,
List<SmartPaginationFilterChangeListener<T>>? filterListeners,
}) : itemBuilderType = PaginateBuilderType.listView,
gridDelegate = const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
),
separator =
separator ??
(scrollDirection == Axis.horizontal
? SizedBox(width: spacing)
: SizedBox(height: spacing)),
staggeredAxisDirection = null,
pageController = null,
onPageChanged = null,
customViewBuilder = null,
onReorder = null,
internalCubit = false,
listeners =
refreshListener != null || filterListeners?.isNotEmpty == true
? [if (refreshListener != null) refreshListener, ...?filterListeners]
: null;