SwipeRefresh.builder constructor

SwipeRefresh.builder({
  1. required IndexedWidgetBuilder itemBuilder,
  2. required int itemCount,
  3. required Stream<SwipeRefreshState> stateStream,
  4. required VoidCallback onRefresh,
  5. Key? key,
  6. SwipeRefreshState? initState,
  7. Color? indicatorColor,
  8. Color? backgroundColor,
  9. double? refreshTriggerPullDistance,
  10. double? refreshIndicatorExtent,
  11. RefreshControlIndicatorBuilder? indicatorBuilder,
  12. ScrollController? scrollController,
  13. EdgeInsets? padding,
  14. bool shrinkWrap = false,
  15. ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior,
  16. ScrollPhysics? physics,
  17. PlatformWrapper? platform,
  18. double? cacheExtent,
})

Create refresh indicator with adaptive to platform style. Uses SliverChildBuilderDelegate in childrenDelegate to avoid creating more children than are visible through the Viewport.

Implementation

factory SwipeRefresh.builder({
  required IndexedWidgetBuilder itemBuilder,
  required int itemCount,
  required Stream<SwipeRefreshState> stateStream,
  required VoidCallback onRefresh,
  Key? key,
  SwipeRefreshState? initState,
  Color? indicatorColor,
  Color? backgroundColor,
  double? refreshTriggerPullDistance,
  double? refreshIndicatorExtent,
  RefreshControlIndicatorBuilder? indicatorBuilder,
  ScrollController? scrollController,
  EdgeInsets? padding,
  bool shrinkWrap = false,
  ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior,
  ScrollPhysics? physics,
  PlatformWrapper? platform,
  double? cacheExtent,
}) {
  return SwipeRefresh(
    SwipeRefreshStyle.adaptive,
    key: key,
    stateStream: stateStream,
    initState: initState,
    onRefresh: onRefresh,
    indicatorColor: indicatorColor,
    backgroundColor: backgroundColor,
    refreshTriggerPullDistance: refreshTriggerPullDistance,
    refreshIndicatorExtent: refreshIndicatorExtent,
    indicatorBuilder: indicatorBuilder,
    scrollController: scrollController,
    padding: padding,
    shrinkWrap: shrinkWrap,
    keyboardDismissBehavior: keyboardDismissBehavior,
    physics: physics,
    childrenDelegate: SliverChildBuilderDelegate(
      itemBuilder,
      childCount: itemCount,
    ),
    platform: platform,
    cacheExtent: cacheExtent,
  );
}