Flutter_cached_network_image: I set the CircularProgressIndicator's size by a wrapped SizedBox in CachedNetworkImage's placeholder.But it didn't work.

Created on 23 Aug 2019  路  2Comments  路  Source: Baseflow/flutter_cached_network_image

I want change the CircularProgressIndicator size and I used a SizedBox wrapped it.
But if I not used SizedBox in CachedNetworkImage's placeholder,it worked.
CachedNetworkImage(
fit: BoxFit.fill,
imageUrl: 'imageUrl',
placeholder: (context, url) =>
SizedBox(
width: 10.0,
height: 10.0,
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation(Colors.green),
),
)
)
寰俊鎴浘_20190823145154

Most helpful comment

Wrap SizedBox with Center widget

CachedNetworkImage(
  imageUrl: 'ImageUrl',
  fit: BoxFit.cover,
  placeholder: (context, url) => Center(
    child: SizedBox(
      width: 40.0,
      height: 40.0,
      child: new CircularProgressIndicator(),
    ),
  ),
  errorWidget: (context, url, error) => new Icon(Icons.error),
)

All 2 comments

Wrap SizedBox with Center widget

CachedNetworkImage(
  imageUrl: 'ImageUrl',
  fit: BoxFit.cover,
  placeholder: (context, url) => Center(
    child: SizedBox(
      width: 40.0,
      height: 40.0,
      child: new CircularProgressIndicator(),
    ),
  ),
  errorWidget: (context, url, error) => new Icon(Icons.error),
)

Wrap SizedBox with Center widget

CachedNetworkImage(
  imageUrl: 'ImageUrl',
  fit: BoxFit.cover,
  placeholder: (context, url) => Center(
    child: SizedBox(
      width: 40.0,
      height: 40.0,
      child: new CircularProgressIndicator(),
    ),
  ),
  errorWidget: (context, url, error) => new Icon(Icons.error),
)

Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flutteradv picture flutteradv  路  6Comments

anass-naoushi picture anass-naoushi  路  5Comments

creativecreatorormaybenot picture creativecreatorormaybenot  路  4Comments

gunhansancar picture gunhansancar  路  3Comments

tolotrasamuel picture tolotrasamuel  路  6Comments