Back to results for “Navigation”
Flutter › Hero Animations & Page Transitions

What is a Hero animation in Flutter, and how does it create that genuinely popular smooth visual effect of a specific widget appearing to fly smoothly from one screen directly across to a corresponding matching widget on an entirely different screen?

Beginner

Answer

A Hero animation creates a genuinely smooth, visually appealing transition effect where a specific shared widget, such as a product thumbnail image, appears to fly smoothly and continuously from its own exact position on one screen directly across to its own new corresponding position on an entirely different destination screen, and implementing it simply requires wrapping the exact same specific widget with a Hero widget on both the originating screen and the destination screen, using exactly the same matching identical tag value on both, letting Flutter automatically handle the entire underlying complex flight animation completely for you.
// On the list screen
Hero(tag: 'product-123', child: Image.network(imageUrl))

// On the detail screen
Hero(tag: 'product-123', child: Image.network(imageUrl))
Real-world example A shopping app wraps each individual product thumbnail image with a Hero widget using that specific product's own genuinely unique identifier as its tag, creating a genuinely smooth, visually appealing flight animation as a user taps a specific thumbnail to properly navigate directly to that exact same product's own detail screen.

Common follow-ups: What genuinely happens if two entirely separate Hero widgets on the exact same screen accidentally share that exact same identical tag value?;Does a Hero widget genuinely need to wrap the exact same identical specific widget type on both the originating and destination screens?