Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to change image opacity within Image() widget – flutter

So am trying to change image opacity using the opacity property i found in Image() widget, this is a short code to be clear :

Padding(
            padding: EdgeInsets.all(10.0),
            child: Center(
              child: ClipRRect(
                borderRadius: BorderRadius.circular(15),
                child: Image(
                  image: NetworkImage(challengeImage),
                  fit: BoxFit.cover,
                  height: 150,
                  width: 350,
                  opacity: //not sure how to use
                ),
              ),
            ),
          ),

the image is a network image i retrieved from Firestore and am not sure what is the value i should put if its not double in order to apply opacity on the image. i thought to create a stack and insert asset image as a layer above my image and use the filter property but i would really like to know how the opacity can work with my code above, Thank you.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use AlwaysStoppedAnimation or create an Animation<double>

Image(
  image: NetworkImage(""),
  opacity: AlwaysStoppedAnimation(.1),
),
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading