Home > Enterprise >  I am working on my app since a few days now and staggered gridview widget refused to work
I am working on my app since a few days now and staggered gridview widget refused to work

Time:07-26

For a while now i've been working on an app that needs me to make use of staggered gridview library but the library doesnt seem to be working

     StaggeredGridView.countBuilder(
          shrinkWrap: true,
          physics: const ScrollPhysics(),
          crossAxisSpacing: 16,
          itemCount: bookList.length,
          mainAxisSpacing: 16,
          crossAxisCount: 4,
          itemBuilder: (_, index) =>BookItem(bookList[index])
          staggeredTileBuilder: (_) const StaggeredTile.fit(2)),

These are the error messages i get even after running flutter clear and flutter pub get

CodePudding user response:

I believe the error is in this line try changing the underscore to context and add a comma at the end

itemBuilder: (context, index) =>BookItem(bookList[index]),
          

CodePudding user response:

Have you updated the plugin perhaps? The StaggeredGridView has been removed/refactored since 0.6.1 I think...

There are other options now. Have a look at the documentation for what would be the best fit for you now.

  • Related