Skip to content
pubscout

hero_animation

1.1.4, released 3 years ago by kirn.tech

Animates a child between positions in the same route

WASM-ready
$ flutter pub add hero_animation
Source repository

What it does

HeroAnimation moves its child from one layout position to another within the same Route. It works in scrollable lists and supports repositioning between tree nodes.

AI-written summary of version 1.1.4, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Need a hero-like animation within a single route
  • Repositioning items in a list or grid
  • Animating widgets on tap or state change

Skip it when

  • Cross‑route hero animations are required
  • Complex physics‑based motion beyond simple repositioning

Strengths

  • Simple API, no extra dependencies
  • Works in scrollable widgets
  • Supports both same‑node and different‑node repositioning

Weaknesses

  • Limited to same route only
  • No support for cross‑route transitions
  • Requires key or tag management

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
```dart
HeroAnimationScene(
  duration: const Duration(milliseconds: 500),
  curve: Curves.easeIn,
  child: GestureDetector(
    onTap: () { setState(() { alignment = Alignment.centerRight; }); },
    child: Align(
      alignment: alignment,
      child: HeroAnimation.child(
        tag: 'tag_0',
        child: const Text('SOME TEXT'),
      ),
    ),
  ),
);
```

Alternatives

Packages that do the same job and could replace hero_animation.

  • hero_here

    Hero animations on the same page without a Navigator or routes.

  • animated_to

    Animates its child widget to a new position automatically when its position changes requiring no calculation.

  • local_hero

    A widget which implicitly launches a hero animation when its position changes within the same route.

  • entry

    Animate widgets into a visible state with opacity, scale, position, and angle.