Home > Enterprise >  how to show CircularProgressIndicator while loading Image.file in flutter
how to show CircularProgressIndicator while loading Image.file in flutter

Time:10-04

This is how we show CircularProgressIndicator while loading image from the network (URL). Wonder how we can do something similar if the image File is local

CachedNetworkImage(
   placeholder: (context, url) => CircularProgressIndicator(),
   imageUrl:'https://www.yourdomain.com/xyz.png',
)

CodePudding user response:

This should do the trick :

return Container(
      child: FutureBuilder(
        future: Future.delayed(Duration(seconds: 3)),
        builder: (c, s) => s.connectionState == ConnectionState.done
            ? Image.asset("assets/aem.png")
            : CircularProgressIndicator(),
      ),
    );
  • Related