Tuesday, December 31, 2019

Flutter Display images from internet



Images.networks {} gives ability to load the image from internet 

Also, the GIF format is supported out of the box.

Class MyApp extends StatelessWidget {

@override
Widget build (BuildContext context){
var title = 'Web Images';
return MaterialApp (title:title, home:Scafold(appbar:AppBar{title:Text(title);},body:Image.Network{}));
}
}

App can also fade in images with the below code

FadeInImage.memoryNetwork(
Placeholder:kTramsparentImage,
Image:''
)

This technique can be used for displaying loading bar as well.

For e.g.

FadeInImage.memoryNetwork(
Placeholder:'assets/loading.gif'),


References:
https://flutter.io/cookbook/images/network-image/

No comments:

Post a Comment