SwipeRefresh.builder constructor
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,
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,
);
}