By WalkingTree   May 18, 2020

FadeTransition - A Flutter Widget

Flutter comes with a powerful set of animation widgets to add motion and special effects to your flutter app. But what if you want something really simple? Maybe something as simple as fading a widget. The Flutter SDK offers the FadeTransition widget for you. 

What is FadeTransition?

FadeTransition lets you fade a widget in and out by animating its opacity. Therefore, you just have to provide the opacity parameter with animation and a child widget on which the animation has to be performed. But where does the animation come from? You first have to create an AminationController to set the duration and then create the animation giving the start and end opacity values. Finally, you can start the animation by calling the forward() method on the controller.

How does the FadeTransition code look like?

  • Creating a FadeTransition

  • But where does the animation come from? By creating an AnimationController and giving a duration:

  • And then creating an animation giving the start and end opacity values

  • Finally, starting the animation by calling forward() method on controller

If you haven’t seen the Flutter’s Widget of the Week video yet, check it out down below

Flutter Blogs

Theming in Flutter

Theming is styling an application so that its look and feel matches your personal design aesthetic or that…

Translate »