这是我的代码:-
PageView.builder(
scrollDirection: Axis.vertical,
key: PageStorageKey('player_home'),
itemBuilder: (context, position) {
return VideoPlayerSurfaceNew(
key: PageStorageKey('page-$position'),
currentWave: state.userFeedDbList[position],
videoPlayerController: videoPlayerController,
videoPlayerControllerCallBack:
videoPlayerControllerCallBack,
);
},
itemCount: state.userFeedDbList.length,
controller: _myPageViewController,
onPageChanged: (page) {
},
),
这是我的控制器
_myPageListener() {
if (_myPageViewController.offset >=
_myPageViewController.position.maxScrollExtent &&
!_myPageViewController.position.outOfRange) {
_userFeedBloc.dispatch(LoadUserFeedNextPage());
_userFeedDbBloc.dispatch(LoadUserFeedDb());
}
}
在我向上或向下滑动时多次调用此itembuilder。