Fix albums not sorted correctly

This commit is contained in:
Ming Ming 2021-04-18 19:01:49 +08:00
parent 1ab320fe76
commit bc6c247a78

View file

@ -362,14 +362,14 @@ class _HomeAlbumsState extends State<HomeAlbums> {
final sortedAlbums = albums.map((e) {
// find the latest file in this album
try {
final lastItem = e.items
.whereType<AlbumFileItem>()
.map((e) => e.file)
.where((element) => file_util.isSupportedFormat(element))
.sorted(compareFileDateTimeDescending)
.first;
return Tuple2(
e.items
.whereType<AlbumFileItem>()
.map((e) => e.file)
.where((element) => file_util.isSupportedFormat(element))
.sorted(compareFileDateTimeDescending)
.first
.lastModified,
lastItem.metadata?.exif?.dateTimeOriginal ?? lastItem.lastModified,
e);
} catch (_) {
return Tuple2(e.lastUpdated, e);