Below are the quick steps to do this:
1. From the project explorer, right click and add folder
2. Copy paste the images into this folder
3. In the yaml file, add references to these assets.
If the below was the folder structure
Project root level
images
image.png
In the yaml file it will look like the below
assets:
- images/image.png
Now in the code, below can be done to load this image:
Class MyTestImageWidget extends StatelessWidget {
var assetsImage = new AssetImage('assets/explore.png');
Var image = new Image(image:assetImage,width:40.0,height:40.0)
Return new Container(child:image);
}
References:
https://www.youtube.com/watch?v=rh15r_8tdRA
No comments:
Post a Comment