Flutter · One codebase, native feel

How do you build animations that stay smooth?

MediumanimationsanimationcontrollertransitionsUpdated Oct 2026
Quiz this track

Short answer

Use implicit animations for simple property changes and AnimationController with explicit curves for coordinated motion. Animate composited properties and always dispose controllers.

Implicit animations such as AnimatedContainer and AnimatedOpacity handle a target value change without a controller. Explicit animations give control over timing, repetition and multiple properties. Both are driven by a ticker tied to the frame pipeline.

dart
class FadeBox extends StatefulWidget {
  const FadeBox({super.key});

  @override
  State<FadeBox> createState() => _FadeBoxState();
}

class _FadeBoxState extends State<FadeBox>
    with SingleTickerProviderStateMixin {
  late final AnimationController _controller;
  late final Animation<double> _opacity;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
      vsync: this,
      duration: const Duration(milliseconds: 300),
    );
    _opacity = CurvedAnimation(
      parent: _controller,
      curve: Curves.easeOut,
    );
    _controller.forward();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return FadeTransition(opacity: _opacity, child: const FlutterLogo());
  }
}
  • Prefer FadeTransition, SlideTransition and ScaleTransition for composited effects
  • AnimatedBuilder rebuilds only its builder, not the whole screen
  • One ticker per controller; use TickerProviderStateMixin when animating several
  • Use Hero for shared-element transitions between routes
  • Respect reduced-motion settings and keep durations short for frequent actions

Performance notes

Opacity and transform animations can run on the compositor, while layout-changing animations force relayout every frame. A controller that rebuilds a large subtree wastes UI-thread time. Test animations in profile mode, because debug mode is much slower and not representative.

An AnimationController must be disposed. A forgotten controller keeps ticking, wastes frames and leaks its listener. Never create controllers inside build.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1What is the difference between implicit and explicit animations?
  2. 2Why does animating width cause more work than animating a transform?
  3. 3When do you need TickerProviderStateMixin instead of SingleTickerProviderStateMixin?
  4. 4How would you support reduced motion?

Say it in the interview

I use implicit animations when a single property changes and explicit AnimationController when several properties or timings need coordination. I prefer opacity and transform transitions because they can be composited, and I avoid animating layout every frame. Controllers live in State, are disposed, and drive only the smallest builder possible. I always judge smoothness in profile mode.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Flutter mock interview and get scored feedback on depth, clarity and confidence.