fix stack handling

This commit is contained in:
mertalev
2024-11-16 18:05:22 -05:00
parent 3b9a3d4037
commit d1c7ed5464
4 changed files with 123 additions and 100 deletions
@@ -52,9 +52,10 @@ class BottomGalleryBar extends ConsumerWidget {
}
final isOwner = asset.ownerId == ref.watch(currentUserProvider)?.isarId;
final showControls = ref.watch(showControlsProvider);
final stackId = asset.stackId;
final stackItems = showStack && asset.stackCount > 0
? ref.watch(assetStackStateProvider(asset))
final stackItems = showStack && stackId != null
? ref.watch(assetStackStateProvider(stackId))
: <Asset>[];
bool isStackPrimaryAsset = asset.stackPrimaryAssetId == null;
final navStack = AutoRouter.of(context).stackData;
@@ -66,9 +67,9 @@ class BottomGalleryBar extends ConsumerWidget {
final isInAlbum = ref.watch(currentAlbumProvider)?.isRemote ?? false;
void removeAssetFromStack() {
if (stackIndex > 0 && showStack) {
if (stackIndex > 0 && showStack && stackId != null) {
ref
.read(assetStackStateProvider(asset).notifier)
.read(assetStackStateProvider(stackId).notifier)
.removeChild(stackIndex - 1);
}
}
@@ -137,7 +138,7 @@ class BottomGalleryBar extends ConsumerWidget {
await ref
.read(stackServiceProvider)
.deleteStack(asset.stackId!, [asset, ...stackItems]);
.deleteStack(asset.stackId!, stackItems);
}
void showStackActionItems() {