Image
Image in Flutter
The Image() widget in Flutter is used to display images in the app. It can be used to display images from local storage or from the network. Here's an example:
Image(
image: AssetImage('assets/images/example.png'),
);
This code displays an image named example.png from the local storage, which is stored in the assets/images/ directory of the app.
Parameters
Here are some common parameters that can be used with the Image() widget in Flutter:
image: Specifies the image to display. This can be either aFileImage,NetworkImage, orAssetImage.
fit: Specifies how to fit the image into the widget's bounds. Common values includeBoxFit.cover,BoxFit.fill, andBoxFit.fitWidth.
width/height: Specifies the width and height of the image. If only one is specified, the other will be calculated automatically while maintaining the aspect ratio.
color: Applies a color filter to the image.
alignment: Specifies how to align the image within the widget's bounds. Common values includeAlignment.center,Alignment.topLeft, andAlignment.bottomRight.