Flutter animation example
Flutter Hero Animation: Product List to Detail Transition
Flutter's Hero widget moves one element between routes. This example goes a step further: the product image follows a curved path instead of a straight line, the detail page is revealed by a circle that grows from the tapped item, and the price and button rise in afterwards. Back reverses it.
- 4.5 KB file
- 4 live inputs
- Flutter runtime
How this hero product transition works
- The image's position follows a quadratic curve, which looks more natural than a straight Hero path.
- The detail page is clipped by a circle centred on the tapped row; its radius eases to cover the screen.
- Events "open" and "close" fire on each direction.
Add it to your Flutter app
Install exodeui_flutter, download the file below, and paste this. The code updates as you customize. Other runtimes are in the other tabs.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:exodeui_flutter/exodeui_flutter.dart';
// Add assets/flutter-hero-animation.exode to pubspec.yaml (download it below).
class FlutterHeroAnimation extends StatefulWidget {
const FlutterHeroAnimation({super.key});
@override
State<FlutterHeroAnimation> createState() => _FlutterHeroAnimationState();
}
class _FlutterHeroAnimationState extends State<FlutterHeroAnimation> {
final _canvas = GlobalKey<ExodeUICanvasState>();
late final Future<String> _json = rootBundle.loadString('assets/flutter-hero-animation.exode');
@override
Widget build(BuildContext context) {
return FutureBuilder<String>(
future: _json,
builder: (context, snap) => snap.hasData
? ExodeUICanvas(
key: _canvas,
artboardJson: snap.data!,
fit: 'Layout',
onReady: () { },
onTrigger: (name, _) {
// fires: 'open', 'close'
},
)
: const SizedBox.shrink(),
);
}
}Inputs
| Input | Type | Default | Range |
|---|---|---|---|
duration | Number | 0.6 | 0.2 – 1.5 |
accent | Text | #22c55e | hex colour |
ink | Text | #0f172a | hex colour |
bg | Text | #f1f5f9 | hex colour |
Events: openclose
More Flutter animations
Bouncing Bars LoaderFive bars bouncing in a travelling wave with squash and stretch, plus rotating status messages.Speed Dial FABA floating action button that rotates to close while three labelled actions spring out in sequence.3D Drawer MenuA side menu revealed by the page swinging back in 3D; open by tapping or dragging from the edge.Wavy TypewriterA typewriter whose letters drop in with a bounce; words type, hold, delete and cycle.Parallax Scroll ListA scrolling list of cards whose images shift at a slower rate, with momentum and edge bounce.Onboarding PagerThree swipeable intro pages with morphing illustrations, a stretching dot indicator and a finishing button.
The same idea in other frameworks: React shared element transition · JavaScript curtain wipe transition · Vue slide and fade route transition