File tree Expand file tree Collapse file tree 3 files changed +26
-17
lines changed Expand file tree Collapse file tree 3 files changed +26
-17
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,17 @@ class CommonSortPathDelegate extends SortPathDelegate {
29
29
30
30
@override
31
31
void sort (List <AssetPathEntity > list) {
32
+ if (list.any ((AssetPathEntity e) => e.lastModified != null )) {
33
+ list.sort ((AssetPathEntity path1, AssetPathEntity path2) {
34
+ if (path1.lastModified == null || path2.lastModified == null ) {
35
+ return 0 ;
36
+ }
37
+ if (path2.lastModified! .isAfter (path1.lastModified! )) {
38
+ return 1 ;
39
+ }
40
+ return - 1 ;
41
+ });
42
+ }
32
43
list.sort ((AssetPathEntity path1, AssetPathEntity path2) {
33
44
if (path1.isAll) {
34
45
return - 1 ;
@@ -48,7 +59,7 @@ class CommonSortPathDelegate extends SortPathDelegate {
48
59
if (_isScreenShot (path2)) {
49
60
return 1 ;
50
61
}
51
- return otherSort (path1, path2) ;
62
+ return 0 ;
52
63
});
53
64
}
54
65
@@ -57,11 +68,10 @@ class CommonSortPathDelegate extends SortPathDelegate {
57
68
}
58
69
59
70
bool _isCamera (AssetPathEntity entity) {
60
- return entity.name. toUpperCase () == 'camera' . toUpperCase () ;
71
+ return entity.name == 'Camera' ;
61
72
}
62
73
63
74
bool _isScreenShot (AssetPathEntity entity) {
64
- return entity.name.toUpperCase () == 'screenshots' .toUpperCase () ||
65
- entity.name.toUpperCase () == 'screenshot' .toUpperCase ();
75
+ return entity.name == 'Screenshots' || entity.name == 'Screenshot' ;
66
76
}
67
77
}
Original file line number Diff line number Diff line change @@ -268,18 +268,17 @@ class DefaultAssetPickerProvider
268
268
Future <void > getAssetPathList () async {
269
269
// Initial base options.
270
270
// Enable need title for audios and image to get proper display.
271
- final FilterOptionGroup options = FilterOptionGroup ()
272
- ..setOption (
273
- AssetType .audio,
274
- const FilterOption (needTitle: true ),
275
- )
276
- ..setOption (
277
- AssetType .image,
278
- const FilterOption (
279
- needTitle: true ,
280
- sizeConstraint: SizeConstraint (ignoreSize: true ),
281
- ),
282
- );
271
+ final FilterOptionGroup options = FilterOptionGroup (
272
+ imageOption: const FilterOption (
273
+ needTitle: true ,
274
+ sizeConstraint: SizeConstraint (ignoreSize: true ),
275
+ ),
276
+ audioOption: const FilterOption (
277
+ needTitle: true ,
278
+ sizeConstraint: SizeConstraint (ignoreSize: true ),
279
+ ),
280
+ containsPathModified: true ,
281
+ );
283
282
284
283
// Merge user's filter option into base options if it's not null.
285
284
if (filterOptions != null ) {
Original file line number Diff line number Diff line change @@ -12,6 +12,6 @@ dependencies:
12
12
sdk : flutter
13
13
14
14
extended_image : ^4.0.0
15
- photo_manager : ^1.0.6
15
+ photo_manager : ^1.1.0
16
16
provider : ^5.0.0
17
17
video_player : ^2.1.0
You can’t perform that action at this time.
0 commit comments