Syntactic sugar for your Flutter animations with Supercharged

Felix Blaschke
1 min readApr 13, 2020

--

Supercharged is an extension function package for Flutter. It adds some cool functions you might know from other languages to the Flutter world.

With it’s recent update 1.3.0 it added some tweening shortcuts. Let’s have a look at the following scenario:

Our Flutter app should animate the size of a box, like this:

An orange box changing it’s size of the time.

We can now simply add a tween by writing:

final _sizeTween = 100.0.tweenTo(200.0);

That also works with integers and colors:

final _colorTween = Colors.red.tweenTo(Colors.blue);

Let’s stay with the size tween example. For our animation we now need to specify the duration. With supercharged we can just write:

final _duration = 1500.milliseconds;

Both extension functions might improve your coding flow when handling animations. If you are missing a certain tweening function, feel free to file an issue.

Let’s show a complete example:

As a little helper I used the ControlledAnimation from the simple_animations package.

Now we are good to go with our moving box.

You can get supercharged at pub.dev and use it your own projects. It’s fully tested and production ready.

Our animated box from the example.

If you liked my article please leave some clapps clapps or comments.

Until next time
— Felix —

--

--

Responses (1)