Closed benPesso closed 2 years ago
Cool! Would you like to propose a new sample that supports Hero graphics in a PR along with some updates to the docs?
Yeah sure. Just need to iron out some kinks with Hero animation jitter first. 😶
closing this due to lack of customer input. feel free to reopen it if you have a minimal repro.
According to this article, if you're not using Navigator 1.0,
Hero
s will essentially not work, as they rely on aHeroController
provided byNavigator
to conduct their transitions.Took me a good while to figure out why Hero animations were not working with
GoRouter
, until I accidently stumbled on this little gem of an article - which I doubt many others are familiar with - and managed to get it working.By wrapping with a
```dart MaterialApp( home: HeroControllerScope( controller: HeroController(), child: Router( routerDelegate: _router.routerDelegate, routeInformationParser: _router.routeInformationParser, ), ), ... ); ```HeroControllerScope
widget:Or...
by adding a
```dart _router = GoRouter( observers: [HeroController()], ... ); ```HeroController
observer:Ideally, GoRouter should include a
HeroController
observer by default (with option to override, for tween behavior modification). At the very least, the GoRouter > Transitions section should probably mention something about Hero animations and how to get them working with GoRouter.