Cool Flutter packages: flutter_physics
A package that made me excited about animations again :)
Last week I discovered a pretty fun little animations package built by @sangddn that lets you replace classic Flutter animation controller with one that follows spring-based simulations: flutter_physics.
The concept of simulation is present in Flutter, but I’ve always found it a bit tricky to implement. I tried it few times, but eventually would switch to either custom calculations or basic curves.
Normally when building this kind of pseudo-3d movement you wouldn’t use typical tweens and curves, as they lack inertia. With flutter_physics you can follow the same approach as with any animation, but just replace the controller with PhysicsController
or TweenAnimationBuilder
with PhysicsBuilder
. In the example above the card starts to move more naturally and just feels better to the eye and finger.
One area where I feel the physics-based animation would be beneficial is bottom sheet movement. I think most of the implementations, including the Flutter bottom sheets, don’t feel as nice as some of the provided by iOS. I’d love to change it and will experimented with using flutter_physics for sheets animations.
Here’s the behavior with ordinary Flutter AnimationController
:
And here after just replacing the controller with PhysicsController
(via adapter - click to see the source code):
If you want to try something refreshing, play with the flutter_physics and maybe share some feedback about how you approach animations with John Ryan here on the Flutter Forum.