Skip to content

Commit 84c6c36

Browse files
authored
🚀 Expose sortPathsByModifiedDate (#343)
1 parent b0a89b5 commit 84c6c36

File tree

7 files changed

+75
-59
lines changed

7 files changed

+75
-59
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ that can be found in the LICENSE file. -->
1010

1111
- Add `initializeDelayDuration` for `DefaultAssetPickerProvider`. (#341)
1212
- Add `sortPathsByModifiedDate`. (#342)
13+
- Expose `sortPathsByModifiedDate`. (#343)
1314

1415
## 8.0.0-dev.1
1516

README-ZH.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -195,30 +195,31 @@ final List<AssetEntity>? result = await AssetPicker.pickAssets(
195195

196196
`AssetPickerConfig` 的成员说明:
197197

198-
| 参数名 | 类型 | 描述 | 默认值 |
199-
|-----------------------------------|--------------------------------------|-----------------------------|-----------------------------|
200-
| selectedAssets | `List<AssetEntity>?` | 已选的资源。确保不重复选择。 | `null` |
201-
| maxAssets | `int` | 最多选择的图片数量 | 9 |
202-
| pageSize | `int` | 分页加载时每页加载的资源数量。**必须为网格数的倍数。 | 80 |
203-
| gridThumbnailSize | `ThumbnailSize` | 预览网格的缩略图大小 | `ThumbnailSize.square(200)` |
204-
| pathThumbnailSize | `ThumbnailSize` | 路径选择器的缩略图大小 | `ThumbnailSize.square(80)` |
205-
| previewThumbnailSize | `ThumbnailSize?` | 预览时图片的缩略图大小 | `null` |
206-
| requestType | `RequestType` | 选择器选择资源的类型 | `RequestType.common` |
207-
| specialPickerType | `SpecialPickerType?` | 提供一些特殊的选择器类型以整合非常规的选择行为 | `null` |
208-
| keepScrollOffset | `bool` | 选择器是否可以从同样的位置开始选择 | `null` |
209-
| sortPathDelegate | `SortPathDelegate<AssetPathEntity>?` | 资源路径的排序实现,可自定义路径排序方法 | `CommonSortPathDelegate` |
210-
| filterOptions | `FilterOptionGroup?` | 允许用户自定义资源过滤条件 | `null` |
211-
| gridCount | `int` | 选择器网格数量 | 4 |
212-
| themeColor | `Color?` | 选择器的主题色 | `Color(0xff00bc56)` |
213-
| pickerTheme | `ThemeData?` | 选择器的主题提供,包括查看器 | `null` |
214-
| textDelegate | `AssetPickerTextDelegate?` | 选择器的文本代理构建,用于自定义文本 | `AssetPickerTextDelegate()` |
215-
| specialItemPosition | `SpecialItemPosition` | 允许用户在选择器中添加一个自定义item,并指定位置。 | `SpecialPosition.none` |
216-
| specialItemBuilder | `SpecialItemBuilder?` | 自定义item的构造方法 | `null` |
217-
| loadingIndicatorBuilder | `IndicatorBuilder?` | 加载器的实现 | `null` |
218-
| selectPredicate | `AssetSelectPredicate` | 判断资源可否被选择 | `null` |
219-
| shouldRevertGrid | `bool?` | 判断资源网格是否需要倒序排列 | `null` |
220-
| limitedPermissionOverlayPredicate | `LimitedPermissionOverlayPredicate?` | 判断有限的权限情况下是否展示提示页面 | `null` |
221-
| pathNameBuilder | `PathNameBuilder<AssetPathEntity>?` | 构建自定义路径名称 | `null` |
198+
| 参数名 | 类型 | 描述 | 默认值 |
199+
|-----------------------------------|--------------------------------------|------------------------------------------------------|-----------------------------|
200+
| selectedAssets | `List<AssetEntity>?` | 已选的资源。确保不重复选择。 | `null` |
201+
| maxAssets | `int` | 最多选择的图片数量 | 9 |
202+
| pageSize | `int` | 分页加载时每页加载的资源数量。**必须为网格数的倍数。 | 80 |
203+
| gridThumbnailSize | `ThumbnailSize` | 预览网格的缩略图大小 | `ThumbnailSize.square(200)` |
204+
| pathThumbnailSize | `ThumbnailSize` | 路径选择器的缩略图大小 | `ThumbnailSize.square(80)` |
205+
| previewThumbnailSize | `ThumbnailSize?` | 预览时图片的缩略图大小 | `null` |
206+
| requestType | `RequestType` | 选择器选择资源的类型 | `RequestType.common` |
207+
| specialPickerType | `SpecialPickerType?` | 提供一些特殊的选择器类型以整合非常规的选择行为 | `null` |
208+
| keepScrollOffset | `bool` | 选择器是否可以从同样的位置开始选择 | `null` |
209+
| sortPathDelegate | `SortPathDelegate<AssetPathEntity>?` | 资源路径的排序实现,可自定义路径排序方法 | `CommonSortPathDelegate` |
210+
| sortPathsByModifiedDate | `bool` | 是否结合 `FilterOptionGroup.containsPathModified` 进行路径排序 | `false` |
211+
| filterOptions | `FilterOptionGroup?` | 允许用户自定义资源过滤条件 | `null` |
212+
| gridCount | `int` | 选择器网格数量 | 4 |
213+
| themeColor | `Color?` | 选择器的主题色 | `Color(0xff00bc56)` |
214+
| pickerTheme | `ThemeData?` | 选择器的主题提供,包括查看器 | `null` |
215+
| textDelegate | `AssetPickerTextDelegate?` | 选择器的文本代理构建,用于自定义文本 | `AssetPickerTextDelegate()` |
216+
| specialItemPosition | `SpecialItemPosition` | 允许用户在选择器中添加一个自定义item,并指定位置。 | `SpecialPosition.none` |
217+
| specialItemBuilder | `SpecialItemBuilder?` | 自定义item的构造方法 | `null` |
218+
| loadingIndicatorBuilder | `IndicatorBuilder?` | 加载器的实现 | `null` |
219+
| selectPredicate | `AssetSelectPredicate` | 判断资源可否被选择 | `null` |
220+
| shouldRevertGrid | `bool?` | 判断资源网格是否需要倒序排列 | `null` |
221+
| limitedPermissionOverlayPredicate | `LimitedPermissionOverlayPredicate?` | 判断有限的权限情况下是否展示提示页面 | `null` |
222+
| pathNameBuilder | `PathNameBuilder<AssetPathEntity>?` | 构建自定义路径名称 | `null` |
222223

223224
### 更详细的使用方法
224225

README.md

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -196,30 +196,31 @@ final List<AssetEntity>? result = await AssetPicker.pickAssets(
196196

197197
Fields in `AssetPickerConfig`:
198198

199-
| Name | Type | Description | Default |
200-
|-----------------------------------|--------------------------------------|---------------------------------------------------------------------------|-----------------------------|
201-
| selectedAssets | `List<AssetEntity>?` | Selected assets. Prevent duplicate selection. | `null` |
202-
| maxAssets | `int` | Maximum asset that the picker can pick. | 9 |
203-
| pageSize | `int?` | Number of assets per page. **Must be a multiple of `gridCount`**. | 80 |
204-
| gridThumbnailSize | `ThumbnailSize` | Thumbnail size for the grid's item. | `ThumbnailSize.square(200)` |
205-
| pathThumbnailSize | `ThumbnailSize` | Thumbnail size for the path selector. | `ThumbnailSize.square(80)` |
206-
| previewThumbnailSize | `ThumbnailSize?` | Preview thumbnail size in the viewer. | `null` |
207-
| requestType | `RequestType` | Request type for picker. | `RequestType.common` |
208-
| specialPickerType | `SpecialPickerType?` | Provides the option to integrate a custom picker type. | `null` |
209-
| keepScrollOffset | `bool` | Whether the picker should save the scroll offset between pushes and pops. | `null` |
210-
| sortPathDelegate | `SortPathDelegate<AssetPathEntity>?` | Path entities sort delegate for the picker, sort paths as you want. | `CommonSortPathDelegate` |
211-
| filterOptions | `FilterOptionGroup?` | Allow users to customize assets filter options. | `null` |
212-
| gridCount | `int` | Grid count in picker. | 4 |
213-
| themeColor | `Color?` | Main theme color for the picker. | `Color(0xff00bc56)` |
214-
| pickerTheme | `ThemeData?` | Theme data provider for the picker and the viewer. | `null` |
215-
| textDelegate | `AssetPickerTextDelegate?` | Text delegate for the picker, for customize the texts. | `AssetPickerTextDelegate()` |
216-
| specialItemPosition | `SpecialItemPosition` | Allow users set a special item in the picker with several positions. | `SpecialItemPosition.none` |
217-
| specialItemBuilder | `SpecialItemBuilder?` | The widget builder for the special item. | `null` |
218-
| loadingIndicatorBuilder | `IndicatorBuilder?` | Indicates the loading status for the builder. | `null` |
219-
| selectPredicate | `AssetSelectPredicate` | Predicate whether an asset can be selected or unselected. | `null` |
220-
| shouldRevertGrid | `bool?` | Whether the assets grid should revert. | `null` |
221-
| limitedPermissionOverlayPredicate | `LimitedPermissionOverlayPredicate?` | Predicate whether the limited permission overlay should be displayed. | `null` |
222-
| pathNameBuilder | `PathNameBuilder<AssetPathEntity>?` | Build customized path name. | `null` |
199+
| Name | Type | Description | Default |
200+
|-----------------------------------|--------------------------------------|----------------------------------------------------------------------------------------------|-----------------------------|
201+
| selectedAssets | `List<AssetEntity>?` | Selected assets. Prevent duplicate selection. | `null` |
202+
| maxAssets | `int` | Maximum asset that the picker can pick. | 9 |
203+
| pageSize | `int?` | Number of assets per page. **Must be a multiple of `gridCount`**. | 80 |
204+
| gridThumbnailSize | `ThumbnailSize` | Thumbnail size for the grid's item. | `ThumbnailSize.square(200)` |
205+
| pathThumbnailSize | `ThumbnailSize` | Thumbnail size for the path selector. | `ThumbnailSize.square(80)` |
206+
| previewThumbnailSize | `ThumbnailSize?` | Preview thumbnail size in the viewer. | `null` |
207+
| requestType | `RequestType` | Request type for picker. | `RequestType.common` |
208+
| specialPickerType | `SpecialPickerType?` | Provides the option to integrate a custom picker type. | `null` |
209+
| keepScrollOffset | `bool` | Whether the picker should save the scroll offset between pushes and pops. | `null` |
210+
| sortPathDelegate | `SortPathDelegate<AssetPathEntity>?` | Path entities sort delegate for the picker, sort paths as you want. | `CommonSortPathDelegate` |
211+
| sortPathsByModifiedDate | `bool` | Whether to allow sort delegates to sort paths with `FilterOptionGroup.containsPathModified`. | `false` |
212+
| filterOptions | `FilterOptionGroup?` | Allow users to customize assets filter options. | `null` |
213+
| gridCount | `int` | Grid count in picker. | 4 |
214+
| themeColor | `Color?` | Main theme color for the picker. | `Color(0xff00bc56)` |
215+
| pickerTheme | `ThemeData?` | Theme data provider for the picker and the viewer. | `null` |
216+
| textDelegate | `AssetPickerTextDelegate?` | Text delegate for the picker, for customize the texts. | `AssetPickerTextDelegate()` |
217+
| specialItemPosition | `SpecialItemPosition` | Allow users set a special item in the picker with several positions. | `SpecialItemPosition.none` |
218+
| specialItemBuilder | `SpecialItemBuilder?` | The widget builder for the special item. | `null` |
219+
| loadingIndicatorBuilder | `IndicatorBuilder?` | Indicates the loading status for the builder. | `null` |
220+
| selectPredicate | `AssetSelectPredicate` | Predicate whether an asset can be selected or unselected. | `null` |
221+
| shouldRevertGrid | `bool?` | Whether the assets grid should revert. | `null` |
222+
| limitedPermissionOverlayPredicate | `LimitedPermissionOverlayPredicate?` | Predicate whether the limited permission overlay should be displayed. | `null` |
223+
| pathNameBuilder | `PathNameBuilder<AssetPathEntity>?` | Build customized path name. | `null` |
223224

224225
### Detailed usage
225226

guides/migration_guide.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ This document gathered all breaking changes and migrations requirement between m
1717

1818
### Summary
1919

20-
_If you didn't extend `AssetPickerProvider`, `AssetPickerBuilderDelegate` or `SortPathDelegate`, you can stop reading._
21-
22-
`AssetPathEntity.assetCountAsync` was introduced in
23-
[fluttercandies/flutter_photo_manager#784](https://github.com/fluttercandies/flutter_photo_manager/pull/784)
24-
to improve the loading performance during paths obtain. By migrating the asynchronous getter, we need to introduce
25-
a new concept `PathWrapper` to hold metadata together, but initialize fields separately.
20+
- `AssetPathEntity.assetCountAsync` was introduced in
21+
[fluttercandies/flutter_photo_manager#784](https://github.com/fluttercandies/flutter_photo_manager/pull/784)
22+
to improve the loading performance during paths obtain.
23+
By migrating the asynchronous getter, we need to introduce a new concept `PathWrapper` to hold metadata together,
24+
but initialize fields separately.
25+
- `containsPathModified` is now `false` by default (previously `true`), and can be changed accordingly.
2626

2727
### Details
2828

0 commit comments

Comments
 (0)