mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 01:06:21 +01:00
Fix album browser not respecting cover provider
This commit is contained in:
parent
06c797a736
commit
b1d37f7b73
3 changed files with 9 additions and 8 deletions
|
@ -163,7 +163,7 @@ class _AlbumBrowserState extends State<AlbumBrowser>
|
|||
setState(() {
|
||||
_album = album;
|
||||
_transformItems();
|
||||
initCover(widget.account, _backingFiles);
|
||||
initCover(widget.account, album);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -321,7 +321,7 @@ class _AlbumBrowserState extends State<AlbumBrowser>
|
|||
setState(() {
|
||||
_album = newAlbum;
|
||||
_transformItems();
|
||||
initCover(widget.account, _backingFiles);
|
||||
initCover(widget.account, newAlbum);
|
||||
});
|
||||
}).catchError((e, stacktrace) {
|
||||
_log.shout("[_onSelectionRemovePressed] Failed while updating album", e,
|
||||
|
|
|
@ -23,13 +23,14 @@ mixin AlbumBrowserMixin<T extends StatefulWidget>
|
|||
}
|
||||
|
||||
@protected
|
||||
void initCover(Account account, List<File> backingFiles) {
|
||||
void initCover(Account account, Album album) {
|
||||
try {
|
||||
final coverFile =
|
||||
backingFiles.firstWhere((element) => element.hasPreview ?? false);
|
||||
_coverPreviewUrl = api_util.getFilePreviewUrl(account, coverFile,
|
||||
final coverFile = album.coverProvider.getCover(album);
|
||||
_coverPreviewUrl = api_util.getFilePreviewUrl(account, coverFile!,
|
||||
width: 1024, height: 600);
|
||||
} catch (_) {}
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
|
|
|
@ -150,7 +150,7 @@ class _DynamicAlbumBrowserState extends State<DynamicAlbumBrowser>
|
|||
setState(() {
|
||||
_album = widget.album;
|
||||
_transformItems(items);
|
||||
initCover(widget.account, _backingFiles);
|
||||
initCover(widget.account, widget.album);
|
||||
_updateAlbumPostPopulate(items);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue