hnvn / flutter_shimmer

A package provides an easy way to add shimmer effect in Flutter project
BSD 3-Clause "New" or "Revised" License
1.77k stars 200 forks source link

Does not work with SliverList #26

Open nivla360 opened 4 years ago

nivla360 commented 4 years ago

Was trying it with SliverList but this the error I get: A RenderViewport expected a child of type RenderSliver but received a child of type _ShimmerFilter. A RenderViewport expected a child of type RenderSliver but received a child of type RenderErrorBox.

VictorUvarov commented 4 years ago

RenderBoxes can't be used as slivers. I'm not sure if a new widget would have to be created for this package or it can be wrapped in some kind of sliver like SliverToBoxAdapter.

gabrielCuringa commented 3 years ago

This worked for me:

SliverToBoxAdapter(
      child: Shimmer.fromColors(
        baseColor: Colors.grey[300],
        highlightColor: Colors.grey[200],
        child: ListView.builder(
          itemCount: itemCount,
          physics: NeverScrollableScrollPhysics(),
          shrinkWrap: true,
          itemBuilder: (_, __) {
            return ...;
          },
        ),
      ),
    );