Baseflow / flutter_cached_network_image

Download, cache and show images in a flutter app
https://baseflow.com
2.41k stars 641 forks source link

Fullscreen placeholder #143

Open ghost opened 5 years ago

ghost commented 5 years ago

Hello, First of all, thanks for creating this awesome library! I am using CachedNetworkImage for viewing images on a pageview

 CachedNetworkImage(
                imageUrl: image.url,
                placeholder: (context, url) => new SizedBox(
                      width: 64.0,
                      height: 64.0,
                      child: new LinearProgressIndicator(),
                    ),
                errorWidget: (context, url, error) => new Icon(Icons.error),
              ),

The problem is even though I've specified width and height of placeholder container, it seems to be ignoring those parameters. My circular progress indicator covers entire screen of application. Is this a bug or am I doing something wrong?

Thanks.

MauriPastorini commented 5 years ago

Same problem here, did you resolve?

renefloor commented 5 years ago

@MauriPastorini and @rohand32 you can wrap it in a Center if you want to Center the Placeholder

isaque-martins commented 1 year ago

Isso funcionou para mim CachedNetworkImage(width: 120, height: 120, imageUrl: customer.logoUrl, imageBuilder: (context, imageProvider) => Container( decoration: BoxDecoration( image: DecorationImage( image: imageProvider, fit: BoxFit.contain, ), ), ), placeholder: (context, url) => const Padding( padding: EdgeInsets.all(40), child: CircularProgressIndicator(), ), errorWidget: (context, url, error) => const Icon(Icons.error), )