Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change opacity of an Icon

I am trying to change the opacity of an icon, when it is present in the code in this format:

child: Icon(Icons.camera_alt),

I want to do it in the same way you can do it with a color:

color: Colors.green.withOpacity(0.25),

Is there a way to do this?

like image 734
Mo711 Avatar asked Jan 17 '26 20:01

Mo711


2 Answers

is there anything wrong with this approach?

    Icon(
      Icons.camera_alt,
      color: Colors.green.withOpacity(0.25),
    )
like image 52
LonelyWolf Avatar answered Jan 21 '26 07:01

LonelyWolf


There is an Opacity widget you can use

Example

 Opacity(
            opacity: 0.25,
            child: Icon(
              Icons.ac_unit
            ),
          )
like image 32
Josteve Avatar answered Jan 21 '26 07:01

Josteve