fixed unique name for albums with the same name on different volumes
This commit is contained in:
parent
cd2811be02
commit
9ca5f7b492
2 changed files with 14 additions and 4 deletions
|
@ -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<String, ImageEntry> getAlbumEntries() {
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue