Home > Net >  Flutter: placing CircularProgressIndicator() widget while using 'firebase_image' package
Flutter: placing CircularProgressIndicator() widget while using 'firebase_image' package

Time:06-18

I am using firebase_image package and trying to use the CircularProgressIndicator() widget while the image is loading up.

I've been trying like FadeInImages with transparent_time package to do it. However, since this is the not the link. It was not possible to place it.

Image(
              image: FirebaseImage(
                  'gs://chichichi.appspot.com/someimage.jpg'),
              // Works with standard parameters, e.g.
              fit: BoxFit.fitWidth,
              width: Get.width,
            ),

The best apporach I have is to have the CircularProgressIndi widget to be stacked down to the FirebaseImage() widget. I do not think this will be the appropriate solution.

Is there any way that I can place the CircularProgressIndicator() in this situation? Or, do I just have to use the standard package to download the image from Firebase?

CodePudding user response:

Use loadingBuilder, something like this:

Image(
...
  loadingBuilder: (_, child, loadingProgress) {
    if (loadingProgress == null) return child;
    return const Center(child: CircularProgressIndicator());
  } 
)
  • Related