Skip to content

Commit 29c2b8a

Browse files
authored
🚸 Improves the default sort conditions (#662)
1 parent 2d51c42 commit 29c2b8a

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ that can be found in the LICENSE file. -->
99
1010
## Unreleased
1111

12-
**None.**
12+
### Improvements
13+
14+
- Improves the default sort conditions.
1315

1416
## 9.4.0
1517

lib/src/provider/asset_picker_provider.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// in the LICENSE file.
44

55
import 'dart:async';
6+
import 'dart:io';
67
import 'dart:math' as math;
78
import 'dart:typed_data';
89

@@ -333,14 +334,10 @@ class DefaultAssetPickerProvider
333334
bool onlyAll = false,
334335
bool keepPreviousCount = false,
335336
}) async {
336-
final PMFilter options;
337+
final PMFilter? options;
337338
final fog = filterOptions;
338-
if (fog == null) {
339-
options = AdvancedCustomFilter(
340-
orderBy: [OrderByItem.desc(CustomColumns.base.createDate)],
341-
);
342-
} else if (fog is FilterOptionGroup) {
343-
final newOptions = FilterOptionGroup(
339+
if (fog is FilterOptionGroup) {
340+
options = FilterOptionGroup(
344341
imageOption: const FilterOption(
345342
sizeConstraint: SizeConstraint(ignoreSize: true),
346343
),
@@ -352,9 +349,11 @@ class DefaultAssetPickerProvider
352349
containsPathModified: sortPathsByModifiedDate,
353350
createTimeCond: DateTimeCond.def().copyWith(ignore: true),
354351
updateTimeCond: DateTimeCond.def().copyWith(ignore: true),
352+
)..merge(fog);
353+
} else if (fog == null && Platform.isAndroid) {
354+
options = AdvancedCustomFilter(
355+
orderBy: [OrderByItem.desc(CustomColumns.android.dateTaken)],
355356
);
356-
newOptions.merge(fog);
357-
options = newOptions;
358357
} else {
359358
options = fog;
360359
}

0 commit comments

Comments
 (0)