There will be times that a colored icon won't be enough for the UI that you are building in Flutter. How about if we put a gradient color on the icon instead?
The problem is that there is no gradient method on the Icon widget. So we need to use a ShaderMask widget and wrap around the Icon. Here's an example implementation and called it GradientIconWidget:
In order to use this, all you need to do is to pass the icon and gradient that you would like to apply:
You can also use this with SVG and transparent images as well. I hope this helps you on your next project!