2种方式 ,推荐使用第2种
- FadeInImage.assetNetwork
new FadeInImage.assetNetwork(
placeholder: 'images/logo.png',
image: imageUrl,
width: 120,
fit: BoxFit.fitWidth,
)
2.CachedNetworkImage
new CachedNetworkImage(
imageUrl:
url,
placeholder: (context, url) => new Image.asset(
"image/news_big_default.png",
width: MediaQuery.of(context).size.width - 30,
height: (MediaQuery.of(context).size.width - 30) *9 /16),
errorWidget: (context, url, error) =>
new Image.asset("image/news_big_default.png"),
)
网友评论