maybeSetupRefresh method
Widget
maybeSetupRefresh(
- BlocxInfiniteListState state, {
- required Widget child,
})
Implementation
Widget maybeSetupRefresh(BlocxInfiniteListState state, {required Widget child}) {
if (!widget.isRefreshable) return child;
return NotificationListener<UserScrollNotification>(
onNotification: onScroll,
child: Listener(
onPointerDown: (d) => bloc.add(BlocxInfiniteListEventVerticalDragStarted(globalY: d.position.dy)),
onPointerUp: (d) => bloc.add(BlocxInfiniteListEventVerticalDragEnded()),
onPointerMove: maySwipe
? (d) => bloc.add(BlocxInfiniteListEventVerticalDragUpdated(globalY: d.position.dy))
: null,
onPointerCancel:
maySwipe ? (_) => bloc.add(BlocxInfiniteListEventVerticalDragUpdated(globalY: null)) : null,
child: child,
),
);
}