RxPaginatedBuilder<B extends RxBlocTypeBase, T>.withRefreshIndicator constructor

RxPaginatedBuilder<B extends RxBlocTypeBase, T>.withRefreshIndicator({
  1. required Stream<PaginatedList<T>> state(
    1. B
    ),
  2. required Widget buildSuccess(
    1. BuildContext,
    2. PaginatedList<T>,
    3. B
    ),
  3. required Widget buildError(
    1. BuildContext,
    2. PaginatedList<T>,
    3. B
    ),
  4. required Widget buildLoading(
    1. BuildContext,
    2. PaginatedList<T>?,
    3. B
    ),
  5. required Future<void> onRefresh(
    1. B
    ),
  6. required void onBottomScrolled(
    1. B
    ),
  7. dynamic onScrolled(
    1. bool
    )?,
  8. B? bloc,
  9. double scrollThreshold = 100,
  10. bool enableOnBottomScrolledCallback = true,
})

RxPaginatedBuilder constructor with refresh indicator. An addition to the default constructor is the requirement for the onRefresh callback which will be executed once the refreshed using the pull-down to refresh feature.

Implementation

factory RxPaginatedBuilder.withRefreshIndicator({
  required Stream<PaginatedList<T>> Function(B) state,
  required Widget Function(BuildContext, PaginatedList<T>, B) buildSuccess,
  required Widget Function(BuildContext, PaginatedList<T>, B) buildError,
  required Widget Function(BuildContext, PaginatedList<T>?, B) buildLoading,
  required Future<void> Function(B) onRefresh,
  required void Function(B) onBottomScrolled,
  Function(bool)? onScrolled,
  B? bloc,
  double scrollThreshold = 100,
  bool enableOnBottomScrolledCallback = true,
}) =>
    RxPaginatedBuilder(
      bloc: bloc,
      state: state,
      buildSuccess: buildSuccess,
      buildLoading: buildLoading,
      buildError: buildError,
      onBottomScrolled: onBottomScrolled,
      onScrolled: onScrolled,
      scrollThreshold: scrollThreshold,
      enableOnBottomScrolledCallback: enableOnBottomScrolledCallback,
      wrapperBuilder: (_, b, c) => RefreshIndicator(
        child: c,
        onRefresh: () async => await onRefresh(b),
      ),
    );