mirror of
https://github.com/immich-app/immich.git
synced 2026-04-24 18:19:51 -04:00
fix(mobile): asset viewer stuck on spinner after rotation
This commit is contained in:
parent
312bb91a4f
commit
28b19220cb
@ -56,10 +56,13 @@ class _AssetPageState extends ConsumerState<AssetPage> {
|
||||
_DragIntent _dragIntent = _DragIntent.none;
|
||||
Drag? _drag;
|
||||
|
||||
BaseAsset? _asset;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_eventSubscription = EventStream.shared.listen(_onEvent);
|
||||
_asset = ref.read(timelineServiceProvider).getAssetSafe(widget.index);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (!mounted || !_scrollController.hasClients) return;
|
||||
_scrollController.snapPosition.snapOffset = _snapOffset;
|
||||
@ -69,6 +72,14 @@ class _AssetPageState extends ConsumerState<AssetPage> {
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(AssetPage oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.index != widget.index) {
|
||||
_asset = ref.read(timelineServiceProvider).getAssetSafe(widget.index);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
@ -357,7 +368,7 @@ class _AssetPageState extends ConsumerState<AssetPage> {
|
||||
final stackIndex = ref.watch(assetViewerProvider.select((s) => s.stackIndex));
|
||||
final isPlayingMotionVideo = ref.watch(isPlayingMotionVideoProvider);
|
||||
|
||||
final asset = ref.read(timelineServiceProvider).getAssetSafe(widget.index);
|
||||
final asset = _asset;
|
||||
if (asset == null) {
|
||||
return const Center(child: ImmichLoadingIndicator());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user