Practice English Speaking&Listening with: FadeTransition (Flutter Widget of the Week)

Normal
(0)
Difficulty: 0

♪ (opening music) ♪

Flutter has a powerful animations engine

for adding motion and effects to your Flutter app.

But sometimes, you just need to do something simple--

like fading in a widget.

And Flutter has you covered.

Flutter has a bunch of transitions ready to drop into your Flutter app.

Let's take a look at FadeTransition.

FadeTransition lets you fade a widget in and out.

It takes a child and an animation.

But where does the animation come from?

Well, first, we create an AnimationController

to set the duration,

and then we create an animation-- giving the start and end opacity values

and animating via the controller.

Finally, we start the animation by calling forward on the controller.

It's a good idea to wrap a FadeTransition in the StatefulWidget,

so you can manage its state and clean up once it's done.

For more info on Fade and other transitions,

head on over to flutter.io

♪ (music) ♪

The Description of FadeTransition (Flutter Widget of the Week)