diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f84c0cc..c893664d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,9 @@ that can be found in the LICENSE file. --> ## Unreleased -**None.** +### Improvements + +- Improves the default sort conditions. ## 9.4.0 diff --git a/lib/src/provider/asset_picker_provider.dart b/lib/src/provider/asset_picker_provider.dart index 4938fe15..16ec896e 100644 --- a/lib/src/provider/asset_picker_provider.dart +++ b/lib/src/provider/asset_picker_provider.dart @@ -3,6 +3,7 @@ // in the LICENSE file. import 'dart:async'; +import 'dart:io'; import 'dart:math' as math; import 'dart:typed_data'; @@ -333,14 +334,10 @@ class DefaultAssetPickerProvider bool onlyAll = false, bool keepPreviousCount = false, }) async { - final PMFilter options; + final PMFilter? options; final fog = filterOptions; - if (fog == null) { - options = AdvancedCustomFilter( - orderBy: [OrderByItem.desc(CustomColumns.base.createDate)], - ); - } else if (fog is FilterOptionGroup) { - final newOptions = FilterOptionGroup( + if (fog is FilterOptionGroup) { + options = FilterOptionGroup( imageOption: const FilterOption( sizeConstraint: SizeConstraint(ignoreSize: true), ), @@ -352,9 +349,11 @@ class DefaultAssetPickerProvider containsPathModified: sortPathsByModifiedDate, createTimeCond: DateTimeCond.def().copyWith(ignore: true), updateTimeCond: DateTimeCond.def().copyWith(ignore: true), + )..merge(fog); + } else if (fog == null && Platform.isAndroid) { + options = AdvancedCustomFilter( + orderBy: [OrderByItem.desc(CustomColumns.android.dateTaken)], ); - newOptions.merge(fog); - options = newOptions; } else { options = fog; }