Skip to content

🚸 Improves the default sort conditions #662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ that can be found in the LICENSE file. -->

## Unreleased

**None.**
### Improvements

- Improves the default sort conditions.

## 9.4.0

Expand Down
17 changes: 8 additions & 9 deletions lib/src/provider/asset_picker_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// in the LICENSE file.

import 'dart:async';
import 'dart:io';
import 'dart:math' as math;
import 'dart:typed_data';

Expand Down Expand Up @@ -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),
),
Expand All @@ -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;
}
Expand Down
Loading