buildRefreshList method

Widget buildRefreshList({
  1. Key? key,
  2. required Widget child,
  3. RefreshController? controller,
  4. Widget? refreshHeader,
  5. Widget? refreshFooter,
  6. bool enableRefresh = true,
  7. bool enableLoadMore = true,
  8. bool enableTwoLevel = false,
  9. OnTwoLevel? onTwoLevel,
  10. DragStartBehavior? dragStartBehavior,
  11. bool? primary,
  12. double? cacheExtent,
  13. int? semanticChildCount,
  14. bool? reverse,
  15. ScrollPhysics? physics = const BouncingScrollPhysics(),
  16. Axis scrollDirection = Axis.vertical,
  17. ScrollController? scrollController,
  18. List<Widget> headers = const [],
  19. List<Widget> footers = const [],
  20. EmptyConfig? emptyConfig,
})

Implementation

Widget buildRefreshList({
  Key? key,
  required Widget child,
  RefreshController? controller,
  Widget? refreshHeader,
  Widget? refreshFooter,
  bool enableRefresh = true,
  bool enableLoadMore = true,
  bool enableTwoLevel = false,
  OnTwoLevel? onTwoLevel,
  DragStartBehavior? dragStartBehavior,
  bool? primary,
  double? cacheExtent,
  int? semanticChildCount,
  bool? reverse,
  ScrollPhysics? physics = const BouncingScrollPhysics(),
  Axis scrollDirection = Axis.vertical,
  ScrollController? scrollController,
  List<Widget> headers = const [],
  List<Widget> footers = const [],
  EmptyConfig? emptyConfig,
}) {
  this._headers = headers;
  this._footers = footers;
  if (controller != null) {
    _refreshController = controller;
  }
  mEmptyConfig = emptyConfig ?? RefreshConfiguration.of(context)?.emptyConfig;
  mEmptyConfig?.onPress = () {
    refresh();
  };

  return SmartRefresher(
    key: key,
    controller: _refreshController,
    header: refreshHeader,
    footer: refreshFooter,
    enablePullDown: enableRefresh,
    enablePullUp: enableLoadMore && items.isNotEmpty,
    enableTwoLevel: enableTwoLevel,
    onTwoLevel: onTwoLevel,
    dragStartBehavior: dragStartBehavior,
    primary: primary,
    cacheExtent: cacheExtent,
    semanticChildCount: semanticChildCount,
    reverse: reverse,
    physics: physics,
    scrollDirection: scrollDirection,
    scrollController: scrollController,
    onRefresh: refresh,
    onLoading: () => loadMore(_page + 1),
    child: itemCount < 1 && !inLoading ? buildEmptyView(mEmptyConfig) : child,
  );
}