vedartm / paginate_firestore

A flutter package to simplify pagination with firestore data 🗃
https://pub.dev/packages/paginate_firestore
MIT License
113 stars 136 forks source link

Preloading firebase storage assests(images and videos) #78

Closed waletoyo1 closed 2 years ago

waletoyo1 commented 3 years ago

Hi, how can this package be used to preload firebase storage assests like images and videos before building the widget? and displaying a skeleton text while loading. I wanted using it with this package: https://pub.dev/packages/skeleton_text

vedartm commented 3 years ago

It can be achieved with CachedNetworkImage. You can add a shimmer while the image is being loaded by setting placeholder in the widget. It depends on how you are implementing each item inside the itemBuilder.

waletoyo1 commented 3 years ago

Thanks, I was able to achieve using this method: CachedNetworkImage( imageUrl: 'imageUrl', imageBuilder: (context, imageProvider) => Container( decoration: BoxDecoration( image: DecorationImage( image: imageProvider, fit: BoxFit.cover, ), ), ), placeholder: (context, url) => CircularProgressIndicator(), errorWidget: (context, url, error) => Icon(Icons.error), ),

But how do ensure the image has looaded before showing the text?

vedartm commented 3 years ago

The placeholder accepts any Widget. You can put your text widget inside that as well and shimmer it.