Search code examples
flutterdartflutter-animationflutter-image

Change Image.asset opacity using opacity parameter in Image widget


I have a simple image that I want to put semi transparent. I have seen some methods to do it, but none of them was talking about the parameter opacity of the own Image.asset that accepts a widget of type Animation. Is it possible to change the opacity permanently with this parameter?

Image.asset(
  "assets/images/triangles_small.png",
  height: 380,
),

enter image description here


Solution

  • Actually, the question point using opcaity on Image.asset. You can use AlwaysStoppedAnimation

    Image.asset(
      "image/link",
      opacity: const AlwaysStoppedAnimation(.5),
    

    To have animation, you can pass animation here.