Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with ListView.builder #15

Closed
kamami opened this issue Apr 29, 2019 · 3 comments
Closed

Not working with ListView.builder #15

kamami opened this issue Apr 29, 2019 · 3 comments
Labels
question Further information is requested

Comments

@kamami
Copy link

kamami commented Apr 29, 2019

I am trying to implement LiquidPullToRefresh as follows:

 LiquidPullToRefresh(
        onRefresh: _refresh,	                         // refresh callback
        child: postImagesWidget(),		// scroll view
      )

But I get following error in the console:

'FutureBuilderDocumentSnapshot>>' is not a subtype of type 'ScrollView'

The "normal" RefreshIndicator is working fine with the same code.

Here is my postImagesWidget:

             Widget postImagesWidget() {
             return FutureBuilder(
             future: _future,
             builder: ((context, AsyncSnapshot<List<DocumentSnapshot>> snapshot) {
             if (snapshot.hasData) {
             if (snapshot.connectionState == ConnectionState.done) {

            return ListView.builder(
              //shrinkWrap: true,
                itemCount: snapshot.data.length,
                itemBuilder: ((context, index) =>

                      SinglePost(
                      list: snapshot.data,
                      index: index,
                      followingUser: followingUser,
                        currentUser: currentUser,

                    )));
          } else {
            return Center(
              child: CircularProgressIndicator(),
            );
          }
        } else {
          return Center(
            child: CircularProgressIndicator(),
          );
        }
      }),
    );
    }
@Taormina
Copy link
Contributor

Taormina commented May 4, 2019

postImagesWidget() is a FutureBuilder, but LiquidPullToRefresh's child: needs to be a ScrollView. Maybe have the FutureBuilder return a LiquidPullToRefresh that directly wraps your ListViewBuilder when you have data and returns the CircularProgressIndicator otherwise?

@kamami
Copy link
Author

kamami commented May 5, 2019

@Taormina works perfectly fine!

@aagarwal1012 aagarwal1012 added the question Further information is requested label Jul 20, 2019
@aagarwal1012
Copy link
Owner

Thanks, @Taormina for solving this issue.
Now, I am closing this issue. Feel free to reopen if any problems arise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants