when you need to get images from Internet you can do it with this solution which caches the images and reties if it fails getting them
so when I am getting an image I do something like this:
Widget getImage(String urlImage) {
return TransitionToImage(
image: AdvancedNetworkImage(
urlImage,
loadedCallback: () {
//print('It works!');
},
loadFailedCallback: () {
//print('Oh, no!');
},
),
loadingWidgetBuilder: (_, double progress, __) => Align(
alignment: Alignment
.center, // Align however you like (i.e .centerRight, centerLeft)
child: CircularProgressIndicator(),
),
fit: BoxFit.cover,
placeholder: const Icon(Icons.refresh),
enableRefresh: true,
);
}
Comments
Post a Comment