Reputation: 177
Hello I have multiple images.
I want change the opacity of the image with the imageUrl.
My goal is that when user click on a image, it change his opacity.
My question is how to change the opacity while keeping the image ?
My CachedNetworkImage :
CachedNetworkImage(
imageUrl : _getImageUrl(),
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
fit: BoxFit.cover,
placeholder: (context, url) => const Center(child: CircularProgressIndicator()),
errorWidget: (context, exception, stacktrace)
{
return const Icon(Icons.warning);
},
)
Upvotes: 3
Views: 1836
Reputation: 11
You can use like this.
Image(
image: CachedNetworkImageProvider("image-url"),
opacity: const AlwaysStoppedAnimation(0.6),
);
Upvotes: 1
Reputation: 63649
You can wrap CachedNetworkImage
with Opacity
widget and provide opacity:x
based on your need.
double _opacity =.3;
......
Opacity(
opacity: _opacity.
child:CachedNetworkImage(...)
More about Opacity
.
Upvotes: 3