fix(mobile): Fixes hero animation on main timeline (#1924)

* fixed hero animation for local assets

* fixes backwards hero animation out of gallery image
This commit is contained in:
martyfuhry 2023-03-03 17:49:40 -05:00 committed by GitHub
parent a5f49b065c
commit dac4020f27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 7 deletions

View file

@ -259,7 +259,6 @@ class _PhotoViewGalleryState extends State<PhotoViewGallery> {
controller: pageOption.controller,
scaleStateController: pageOption.scaleStateController,
customSize: widget.customSize,
heroAttributes: pageOption.heroAttributes,
scaleStateChangedCallback: scaleStateChangedCallback,
enableRotation: widget.enableRotation,
initialScale: pageOption.initialScale,
@ -289,7 +288,6 @@ class _PhotoViewGalleryState extends State<PhotoViewGallery> {
scaleStateController: pageOption.scaleStateController,
customSize: widget.customSize,
gaplessPlayback: widget.gaplessPlayback,
heroAttributes: pageOption.heroAttributes,
scaleStateChangedCallback: scaleStateChangedCallback,
enableRotation: widget.enableRotation,
initialScale: pageOption.initialScale,
@ -310,6 +308,19 @@ class _PhotoViewGalleryState extends State<PhotoViewGallery> {
errorBuilder: pageOption.errorBuilder,
);
if (pageOption.heroAttributes != null) {
return Hero(
tag: pageOption.heroAttributes!.tag,
createRectTween: pageOption.heroAttributes!.createRectTween,
flightShuttleBuilder: pageOption.heroAttributes!.flightShuttleBuilder,
placeholderBuilder: pageOption.heroAttributes!.placeholderBuilder,
transitionOnUserGestures: pageOption.heroAttributes!.transitionOnUserGestures,
child: ClipRect(
child: photoView,
),
);
}
return ClipRect(
child: photoView,
);