mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
fix: no hero animation after tab change (#20285)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
d0576697c3
commit
e85655d34c
4 changed files with 23 additions and 6 deletions
|
|
@ -34,11 +34,13 @@ import 'package:platform/platform.dart';
|
|||
class AssetViewerPage extends StatelessWidget {
|
||||
final int initialIndex;
|
||||
final TimelineService timelineService;
|
||||
final int? heroOffset;
|
||||
|
||||
const AssetViewerPage({
|
||||
super.key,
|
||||
required this.initialIndex,
|
||||
required this.timelineService,
|
||||
this.heroOffset,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -47,7 +49,7 @@ class AssetViewerPage extends StatelessWidget {
|
|||
// since the Timeline and AssetViewer are on different routes / Widget subtrees.
|
||||
return ProviderScope(
|
||||
overrides: [timelineServiceProvider.overrideWithValue(timelineService)],
|
||||
child: AssetViewer(initialIndex: initialIndex),
|
||||
child: AssetViewer(initialIndex: initialIndex, heroOffset: heroOffset),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -55,11 +57,13 @@ class AssetViewerPage extends StatelessWidget {
|
|||
class AssetViewer extends ConsumerStatefulWidget {
|
||||
final int initialIndex;
|
||||
final Platform? platform;
|
||||
final int? heroOffset;
|
||||
|
||||
const AssetViewer({
|
||||
super.key,
|
||||
required this.initialIndex,
|
||||
this.platform,
|
||||
this.heroOffset,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -108,7 +112,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
|||
_onAssetChanged(widget.initialIndex);
|
||||
});
|
||||
reloadSubscription = EventStream.shared.listen(_onEvent);
|
||||
heroOffset = TabsRouterScope.of(context)?.controller.activeIndex ?? 0;
|
||||
heroOffset = widget.heroOffset ?? TabsRouterScope.of(context)?.controller.activeIndex ?? 0;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue