diff --git a/lib/model/source/album.dart b/lib/model/source/album.dart index c9256ed4f..0dce9f30f 100644 --- a/lib/model/source/album.dart +++ b/lib/model/source/album.dart @@ -29,15 +29,25 @@ mixin AlbumMixin on SourceBase { } String getUniqueAlbumName(String album) { - final volumeRoot = androidFileUtils.getStorageVolume(album)?.path ?? ''; - final otherAlbums = _folderPaths.where((item) => item != album && item.startsWith(volumeRoot)); + final otherAlbums = _folderPaths.where((item) => item != album); final parts = album.split(separator); var partCount = 0; String testName; do { testName = separator + parts.skip(parts.length - ++partCount).join(separator); } while (otherAlbums.any((item) => item.endsWith(testName))); - return parts.skip(parts.length - partCount).join(separator); + final uniqueName = parts.skip(parts.length - partCount).join(separator); + + final volume = androidFileUtils.getStorageVolume(album); + final volumeRoot = volume?.path ?? ''; + final albumRelativePath = album.substring(volumeRoot.length); + if (uniqueName.length < albumRelativePath.length || volume == null) { + return uniqueName; + } else if (volume.isPrimary) { + return albumRelativePath; + } else { + return '$albumRelativePath (${volume.description})'; + } } Map getAlbumEntries() { diff --git a/lib/widgets/search/expandable_filter_row.dart b/lib/widgets/search/expandable_filter_row.dart index db02cadeb..5702fc9fb 100644 --- a/lib/widgets/search/expandable_filter_row.dart +++ b/lib/widgets/search/expandable_filter_row.dart @@ -105,7 +105,7 @@ class ExpandableFilterRow extends StatelessWidget { Widget _buildFilterChip(CollectionFilter filter) { return AvesFilterChip( - key: Key(filter.key), + key: ValueKey(filter), filter: filter, heroType: heroTypeBuilder?.call(filter) ?? HeroType.onTap, onTap: onTap,