【发布时间】:2018-12-19 10:50:03
【问题描述】:
我在 BoxDecoration 中有 Image,当我从 CachedNetworkImageProvider 获取图像时,它可以工作,但是当我从 Assetimage 获取图像时,图像不会被裁剪到盒子大小。两个图像源都显示在 ListTile 中。 来自 AssetImage 的代码:
return Container(
width: widget.width,
height: widget.heigth,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color:widget.colour, width:3),
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage(url)
)....
来自 CachedNetworkImageProvider 的代码:
return Container(
width: widget.width,
height: widget.heigth,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(color:widget.colour, width:3),
image: DecorationImage(
fit: BoxFit.cover,
image: CachedNetworkImageProvider(widget.location.imageURLs[widget.index])...
【问题讨论】:
-
我无法重现。可能
image.width/image.height有问题