Fade Widgets in Flutter

--

Give your widgets a Faded Effect.

Let’s say we want to fade a widget called WidgetToBeFaded().

We need to wrap it inside ShaderMask() widget. Return LinearGradient().createShader(bounds) inside shaderCallback function;

In Linear Gradient use Black and a Transparent color. Set the blend mode of shader mask to BlendMode.dstIn.

We’re done!! Now the transparency of widget is determined by the Linear Gradient’s transparent color.

I hope this helps. Thanks for reading.

Follow me GitHub, LinkedIn, Twitter.

--

--

Manthan Khandale
Manthan Khandale

Responses (2)