Share your feedback on animation!

Hey Flutter devs!

We want to learn more about how you are using Flutter’s animation APIs. What packages are you using? Are there any techniques you’ve found useful? What are the pain points?

Share your experience and feedback here!

9 Likes

Recently I’ve really gotten into spring-based Animations á-la SwiftUI and have published two packages to make them easier to use: [springster(springster | Flutter package) and heroine(heroine | Flutter package)

I would love to see those make it into the framework, since they offer loads of benefits (e.g. smooth redirect, defaults always look good), but they would probably need a larger rethinking of the animation system. Feel free to reach out if I can help bring simulated animations to Flutter!

For curve-based animations, I love using implicitly animated widgets, such as TweenAnimationBuilder, although I think its API is a little unwieldy for most use-cases. In personal projects I mostly use flutter_hooks for its easier management of AnimationController lifecycles.

I also have custom hooks that I wrote for animations in another package of mine [rivership], so that I can just do useTweenedValue(value, curve, duration) and if that value changes, the widget rebuilds with the animation.

I generally don’t use packages that come with pre-built animations, as the UI I build is often very custom and I want full control over all the timings and styles :slight_smile:

4 Likes

I’ve tried the flutter_physics today and was quite pleasantly surprised. It has variety of different and opinionated physics modes and curves, but is quite powerful at the same time. A simple animated widget becomes much more organic thanks to that.

screenshot_20250127_093817


Maybe few more thoughts from me.

A technique that I’m often using is to create my custom animation controller by passing the vsync to a ChangeNotifier. This way I can orchestrate my animations manually, do any calculations I need by hand and just notify the builder about new frames. You can see example of that in my old codepens (e.g. TrexGame class here or Boids simulation).

5 Likes

Personally I love the SwiftUI’s withAnimation + new spring API because of its ease of use & sensible defaults and would love to see something similar in Flutter.

struct ContentView: View {
    @State private var scale = 1.0

    var body: some View {
        Button("Press here") {
            scale += 1
        }
        .scaleEffect(scale)
        .animation(.spring(duration: 1, bounce: 0.75), value: scale)
    }
}

It provides great developer ergonomics by implicitly handling interruptions & spring velocity for you. Having the duration be an approximate settling from a user’s perspective and not the total duration until 100% settled also makes it way more intuitive than previously.

Haven’t tried springster by @i.madethese.works but it looks great at first glance!

2 Likes

Honestly, flutter_physics is just the better version of springster.

I implemented the latter in half a day and I’m happy with how it turned out, but flutter_physics is much more fully-fledged and basically what I intended for springster to become in its final form

4 Likes

Holy cow—so much admiration for the openness and humility.

I’m really looking forward to playing around with flutter_physics :slight_smile:

I‘m still planning to continue developing springster until the framework potentially catches up. I have some ideas for it that flutter_physics does differently.

Until then, have fun with flutter_physics. I definitely admire the fast implementation of the package, although I‘ve now noticed that it was created after the author saw my posts about springster on twitter, which certainly makes me a bit sad that he didn’t choose to contribute but started his own implementation instead :person_shrugging: