use pull to refresh with ScrollablePositionedList flutter

Viewed 86

I want to use both together, Thanks in advance.
Flutter version 2.8.1.
pull_to_refresh: ^2.0.0

FYI: I'm also using CupertinoPageScaffold

return RefreshIndicator(
              onRefresh: widget.onRefresh!,
              child: ScrollablePositionedList.builder(
                shrinkWrap: true,
                initialScrollIndex: _initialIndex,
                itemCount: appStore.postsStore.isPostLoading
                    ? widget.postDetails.length + 1
                    : widget.postDetails.length,
                physics: AlwaysScrollableScrollPhysics(),
                itemPositionsListener: _itemPositionsListener,
                itemScrollController: _itemScrollController,
                itemBuilder: (context, index) {
                  if (index == widget.postDetails.length) {
                    return Padding(
                      padding: const EdgeInsets.only(
                        top: 10.0,
                        bottom: 20,
                      ),
                      child: LoadingWidget(),
                    );
                  }
                  return UIPost(
                      postDetails: widget.postDetails[index],
                      feedVideoManager: feedVideoManager,
                      navigateOnDelete: () {
                        Get.back();
                        Navigator.pop(context);
                      });
                },
              ),
            );
0 Answers
Related