mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 01:06:21 +01:00
Improve sorting non-file items
This commit is contained in:
parent
1a5fc2bbe2
commit
a07fb0d9a4
1 changed files with 9 additions and 2 deletions
|
@ -134,10 +134,17 @@ class AlbumTimeSortProvider extends AlbumReversibleSortProvider {
|
|||
prevFileTime = e.file.bestDateTime;
|
||||
}
|
||||
// for non file items, use the sibling file's time
|
||||
return Tuple2(
|
||||
prevFileTime ?? DateTime.fromMillisecondsSinceEpoch(0), e);
|
||||
return Tuple2(prevFileTime, e);
|
||||
})
|
||||
.stableSorted((x, y) {
|
||||
if (x.item1 == null && y.item1 == null) {
|
||||
return 0;
|
||||
}
|
||||
else if (x.item1 == null) {
|
||||
return -1;
|
||||
} else if (y.item1 == null) {
|
||||
return 1;
|
||||
}
|
||||
if (isAscending) {
|
||||
return x.item1.compareTo(y.item1);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue