fix: button condition rendering (#23400)

This commit is contained in:
Alex 2025-10-31 08:42:01 -05:00 committed by GitHub
parent 5c7d5539ea
commit c69786b039
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 5 deletions

View File

@ -141,14 +141,28 @@ class _AssetDetailBottomSheet extends ConsumerWidget {
} }
Widget _buildAppearsInList(WidgetRef ref, BuildContext context) { Widget _buildAppearsInList(WidgetRef ref, BuildContext context) {
final isRemote = ref.watch(currentAssetNotifier)?.hasRemote ?? false; final aseet = ref.watch(currentAssetNotifier);
if (!isRemote) { if (aseet == null) {
return const SizedBox.shrink();
}
if (!aseet.hasRemote) {
return const SizedBox.shrink();
}
String? remoteAssetId;
if (aseet is RemoteAsset) {
remoteAssetId = aseet.id;
} else if (aseet is LocalAsset) {
remoteAssetId = aseet.remoteAssetId;
}
if (remoteAssetId == null) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
final remoteAsset = ref.watch(currentAssetNotifier) as RemoteAsset;
final userId = ref.watch(currentUserProvider)?.id; final userId = ref.watch(currentUserProvider)?.id;
final assetAlbums = ref.watch(albumsContainingAssetProvider(remoteAsset.id)); final assetAlbums = ref.watch(albumsContainingAssetProvider(remoteAssetId));
return assetAlbums.when( return assetAlbums.when(
data: (albums) { data: (albums) {

View File

@ -127,7 +127,7 @@ enum ActionButtonType {
context.currentAlbum!.isShared, context.currentAlbum!.isShared,
ActionButtonType.similarPhotos => ActionButtonType.similarPhotos =>
!context.isInLockedView && // !context.isInLockedView && //
context.asset.hasRemote, context.asset is RemoteAsset,
}; };
} }