Component - Hero animations
A Hero animation in Flutter creates a smooth transition effect for a widget when navigating between two screens. It visually connects the same widget on both screens, making the app feel more natural and engaging.
A Hero animation in Flutter creates a smooth transition effect for a widget when navigating between two screens. It visually connects the same widget on both screens, making the app feel more natural and engaging.
MaterialApp
└── Scaffold
├── ListView
│ └── Hero (tag: 'hero-image')
│ └── Image
└── Navigator (pushes DetailScreen)
└── Scaffold
└── Hero (tag: 'hero-image')
└── Image (larger)Hero widget in Flutter?tag and child.Screen A:
Hero(tag: 'logo', child: Image.asset('logo.png'))
Screen B:
Hero(tag: 'logo', child: Image.asset('logo_large.png'))Hero(tag: 'avatar', child: Container(color: Colors.blue)) // On next screen Hero(tag: 'avatar', child: Container(color: Colors.red))
Pass the test and this pattern moves unknown