Flutter CachedNetworkImageにdecorationをしたい場合
CachedNetworkImage
にdecorationをしたい場合
DecoratedBox(
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage(img),///例えばここをCachedNetworkImageにしたくてもできない
),
shape: BoxShape.rectangle,
),
child: Container(
margin: const EdgeInsets.only(top: 30.0),
decoration: const BoxDecoration(
),
),
)
CachedNetworkImage(
imageUrl: img,
fit: BoxFit.cover,
///これが使える
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(image: imageProvider, fit: BoxFit.cover),
),
child: Container(
decoration: const BoxDecoration(
///略
),
),
),
)