一.加载本地图片


如图所示:
1.打开pubspec.yaml在最后加入assets:- image/goods_image.png(这里根据你自己的项目图片目录以及图片名字来配)
- 在image中引用本地资源图片
new Image.asset(
'images/goods_image.png', width: 100.0, height: 100.0,fit:BoxFit.contain ,)
二.加载网络图片
new Image.network('https://gss0.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/38dbb6fd5266d0163c8e0abe902bd40734fa3594.jpg'),
三.加载本地文件图片
new Image.file(new File("/Users/gs/Downloads/1.jpeg")),
网友评论