The Image widget

Image displays an image from different sources and formats. From the docs, the supported image formats are JPEG, PNG, GIF, animated GIF, WebP, animated WebP, BMP, and WBMP:

Image(
image: AssetImage(
"assets/dart_logo.jpg"
),
)

The Image property from the widget specifies ImageProvider. The image to be shown can come from different sources. The Image class contains different constructors for different ways of  loading images: 

Image.asset(
'assets/dart_logo.jpg',
)
   Image.network(
'https://picsum.photos/250?image=9',
)
   Image.file(
File(file_path)
)
   Image.memory(
Uint8List(image_bytes)
)

Besides the Image property, there are some other commonly used properties:  

  • height/width: To specify the size constraints of an image
  • repeat: To repeat the image to cover the available space
  • alignment: To align the image in a specific position within its bounds
  • fit: To specify how the image should be inscribed into the available space
To see all the available Image widget properties, please go to the official image widget docs page: https://docs.flutter.io/flutter/widgets/Image-class.html.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.239.123