Flutter Widgets Example - Opacity Widget

Opacity Widgets

With Flutter, removing a widget completely is easy. You just rebuild without it!

But what if you need that widget to disappear but still take a space? So the rest of your layout stays where it is, the way iOS is hidden then, Android's invisible work. Try an Opacity widget.

Just wrap your widget with Opacity, and set the value to zero and you are all set.

You can also use Opacity for blending one child of a stack onto another. And if you want to animate a changing Opacity, there's an AnimatedOpacity widget too. Just give an Opacity and a duration, and when you rebuild, it animates the change automatically.

Next Post »