Skip to content

Commit 58b0468

Browse files
authored
🚀 Expand FilterOptionGroup to PMFilter (#436)
1 parent 19fc6f2 commit 58b0468

File tree

8 files changed

+20
-18
lines changed

8 files changed

+20
-18
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ that can be found in the LICENSE file. -->
44

55
# Changelog
66

7-
## 8.4.2+1
7+
## 8.4.3
8+
9+
### New features
10+
11+
- Add Vietnamese language text delegate. (#424).
812

913
### Improvements
1014

11-
- Support semantics with Vietnamese text delegates. (#424).
15+
- Expand `FilterOptionGroup` to `PMFilter`. (#436)
1216

1317
## 8.4.2
1418

README-ZH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ final List<AssetEntity>? result = await AssetPicker.pickAssets(
272272
| keepScrollOffset | `bool` | 选择器是否可以从同样的位置开始选择 | `null` |
273273
| sortPathDelegate | `SortPathDelegate<AssetPathEntity>?` | 资源路径的排序实现,可自定义路径排序方法 | `CommonSortPathDelegate` |
274274
| sortPathsByModifiedDate | `bool` | 是否结合 `FilterOptionGroup.containsPathModified` 进行路径排序 | `false` |
275-
| filterOptions | `FilterOptionGroup?` | 允许用户自定义资源过滤条件 | `null` |
275+
| filterOptions | `PMFilter?` | 允许用户自定义资源过滤条件 | `null` |
276276
| gridCount | `int` | 选择器网格数量 | 4 |
277277
| themeColor | `Color?` | 选择器的主题色 | `Color(0xff00bc56)` |
278278
| pickerTheme | `ThemeData?` | 选择器的主题提供,包括查看器 | `null` |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Fields in `AssetPickerConfig`:
282282
| keepScrollOffset | `bool` | Whether the picker should save the scroll offset between pushes and pops. | `null` |
283283
| sortPathDelegate | `SortPathDelegate<AssetPathEntity>?` | Path entities sort delegate for the picker, sort paths as you want. | `CommonSortPathDelegate` |
284284
| sortPathsByModifiedDate | `bool` | Whether to allow sort delegates to sort paths with `FilterOptionGroup.containsPathModified`. | `false` |
285-
| filterOptions | `FilterOptionGroup?` | Allow users to customize assets filter options. | `null` |
285+
| filterOptions | `PMFilter?` | Allow users to customize assets filter options. | `null` |
286286
| gridCount | `int` | Grid count in picker. | 4 |
287287
| themeColor | `Color?` | Main theme color for the picker. | `Color(0xff00bc56)` |
288288
| pickerTheme | `ThemeData?` | Theme data provider for the picker and the viewer. | `null` |

example/lib/constants/picker_method.dart

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,13 @@ class PickMethod {
235235
maxAssets: maxAssetsCount,
236236
selectedAssets: assets,
237237
requestType: RequestType.video,
238-
filterOptions: FilterOptionGroup()
239-
..setOption(
240-
AssetType.video,
241-
const FilterOption(
242-
durationConstraint: DurationConstraint(
243-
max: Duration(minutes: 1),
244-
),
238+
filterOptions: FilterOptionGroup(
239+
videoOption: const FilterOption(
240+
durationConstraint: DurationConstraint(
241+
max: Duration(minutes: 1),
245242
),
246243
),
244+
),
247245
),
248246
);
249247
},

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: wechat_assets_picker_demo
22
description: The demo project for the wechat_assets_picker package.
3-
version: 8.4.2+36
3+
version: 8.4.3+37
44
publish_to: none
55

66
environment:

lib/src/constants/config.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class AssetPickerConfig {
143143
///
144144
/// Will be merged into the base configuration.
145145
/// 将会与基础条件进行合并。
146-
final FilterOptionGroup? filterOptions;
146+
final PMFilter? filterOptions;
147147

148148
/// Assets count for the picker.
149149
/// 资源网格数

lib/src/provider/asset_picker_provider.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class DefaultAssetPickerProvider
277277
///
278278
/// Will be merged into the base configuration.
279279
/// 将会与基础条件进行合并。
280-
final FilterOptionGroup? filterOptions;
280+
final PMFilter? filterOptions;
281281

282282
@override
283283
set currentPath(PathWrapper<AssetPathEntity>? value) {
@@ -316,8 +316,8 @@ class DefaultAssetPickerProvider
316316
);
317317

318318
// Merge user's filter option into base options if it's not null.
319-
if (filterOptions != null) {
320-
options.merge(filterOptions!);
319+
if (filterOptions is FilterOptionGroup) {
320+
options.merge(filterOptions as FilterOptionGroup);
321321
}
322322

323323
final List<AssetPathEntity> list = await PhotoManager.getAssetPathList(

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: wechat_assets_picker
2-
version: 8.4.2+1
2+
version: 8.4.3
33
description: |
44
An image picker (also with videos and audio)
55
for Flutter projects based on WeChat's UI,
@@ -17,7 +17,7 @@ dependencies:
1717
sdk: flutter
1818

1919
extended_image: ^7.0.0
20-
photo_manager: ^2.4.0
20+
photo_manager: ^2.6.0
2121
provider: ^6.0.2
2222
video_player: ^2.4.0
2323

0 commit comments

Comments
 (0)