CollectionView<T>.pullable constructor

const CollectionView<T>.pullable({
  1. Key? key,
  2. required CollectionItemBuilder<T> builder,
  3. required dynamic data(
    1. int iteration
    ),
  4. dynamic onRefresh()?,
  5. dynamic beforeRefresh()?,
  6. dynamic afterRefresh(
    1. dynamic data
    )?,
  7. String? headerStyle,
  8. Widget? footerLoadingIcon,
  9. dynamic transform(
    1. List<T> data
    )?,
  10. Widget? empty,
  11. LoadingStyle? loadingStyle,
  12. String? stateName,
  13. Axis? scrollDirection,
  14. bool? reverse,
  15. ScrollController? controller,
  16. bool? primary,
  17. ScrollPhysics? physics,
  18. bool? shrinkWrap,
  19. EdgeInsets? padding,
  20. double? itemExtent,
  21. Widget? prototypeItem,
  22. ChildIndexGetter? findChildIndexCallback,
  23. bool addAutomaticKeepAlives = true,
  24. bool addRepaintBoundaries = true,
  25. bool addSemanticIndexes = true,
  26. double? cacheExtent,
  27. int? semanticChildCount,
  28. DragStartBehavior? dragStartBehavior,
  29. ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior,
  30. String? restorationId,
  31. Clip? clipBehavior,
  32. Widget? header,
  33. dynamic sort(
    1. List<T> items
    )?,
  34. double? spacing,
})

Creates a pullable list view with pull-to-refresh and pagination support.

Example:

CollectionView<User>.pullable(
  data: (iteration) async => api.getUsers(page: iteration),
  builder: (context, item) => UserTile(user: item.data),
  onRefresh: () => print('Refreshed!'),
  headerStyle: 'WaterDropHeader',
)

Implementation

const CollectionView.pullable({
  super.key,
  required this.builder,
  required Function(int iteration) data,
  this.onRefresh,
  this.beforeRefresh,
  this.afterRefresh,
  this.headerStyle,
  this.footerLoadingIcon,
  this.transform,
  this.empty,
  this.loadingStyle,
  this.stateName,
  this.scrollDirection,
  this.reverse,
  this.controller,
  this.primary,
  this.physics,
  this.shrinkWrap,
  this.padding,
  this.itemExtent,
  this.prototypeItem,
  this.findChildIndexCallback,
  this.addAutomaticKeepAlives = true,
  this.addRepaintBoundaries = true,
  this.addSemanticIndexes = true,
  this.cacheExtent,
  this.semanticChildCount,
  this.dragStartBehavior,
  this.keyboardDismissBehavior,
  this.restorationId,
  this.clipBehavior,
  this.header,
  this.sort,
  this.spacing,
}) : kind = CollectionViewKind.builder,
     separatorBuilder = null,
     crossAxisCount = null,
     mainAxisSpacing = null,
     crossAxisSpacing = null,
     isPullable = true,
     paginatedData = data,
     this.data = null;