Skip to content

Commit

Permalink
Merge branch 'main' into l863
Browse files Browse the repository at this point in the history
* main:
  🔖 9.2.1 (fluttercandies#616)
  ⚡️ Improve changes when limited on iOS (fluttercandies#615)
  🚸 Use `LocallyAvailableBuilder` in the grid to provide better user awareness (fluttercandies#614)
  📝 Add one frequently asked question
  🥅 More exception info
  🔖 9.2.0
  • Loading branch information
tourdt committed Aug 20, 2024
2 parents a45ee81 + f15336e commit f3f07a0
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 62 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,20 @@ that can be found in the LICENSE file. -->
## Unreleased

*None.*

## 9.2.1

- Improve changes when limited on iOS.
- Use `LocallyAvailableBuilder` in the grid to provide better user awareness.

## 9.2.0

### New features

- Introduce `AssetsChangeCallback` and `AssetsChangeRefreshPredicate`
to help users act according to assets changes.
- Add `shouldAutoplayPreview` in the config.

### Fixes

Expand Down
24 changes: 22 additions & 2 deletions README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ Language: [English](README.md) | 中文
* [使用 `dio`](#使用-dio)
* [自定义选择器](#自定义选择器)
* [常见问题 ❔](#常见问题-)
* [Execution failed for task ':photo_manager:compileDebugKotlin'](#execution-failed-for-task-photomanagercompiledebugkotlin)
* [修改默认相册名称(将 `Recent` 改为其他)](#修改默认相册名称将-recent-改为其他)
* [Execution failed for task ':photo_manager:compileDebugKotlin'](#execution-failed-for-task-photo_managercompiledebugkotlin)
* [`File``Uint8List` 创建 `AssetEntity` 的方法](#从-file-或-uint8list-创建-assetentity-的方法)
* [控制台提示 'Failed to find GeneratedAppGlideModule'](#控制台提示-failed-to-find-generatedappglidemodule)
* [致谢](#致谢)
Expand Down Expand Up @@ -303,7 +304,7 @@ final List<AssetEntity>? result = await AssetPicker.pickAssets(
| pathNameBuilder | `PathNameBuilder<AssetPathEntity>?` | 基于路径(相册)构建自定义名称的方法 | `null` |
| assetsChangeCallback | `AssetsChangeCallback<AssetPathEntity>?` | 当系统通知资源变化时将调用的回调 | `null` |
| assetsChangeRefreshPredicate | `AssetsChangeRefreshPredicate<AssetPathEntity>?` | 判断资源变化是否根据 call 和当前选中的路径进行更新 | `null` |
| shouldAutoplayPreview | `bool` | 预览是否应自动播放 | `false` |
| shouldAutoplayPreview | `bool` | 预览是否应自动播放 | `false` |

-`maxAssets` 等于 `1`(即单选模式),搭配
`SpecialPickerType.noPreview` 使用会在用户点选资源换时立刻选中并返回。
Expand Down Expand Up @@ -453,6 +454,25 @@ Future<dio.MultipartFile> multipartFileFromAssetEntity(AssetEntity entity) async

## 常见问题 ❔

### 修改默认相册名称(将 `Recent` 改为其他)

在 Android 上 `Recent` 是总相册的默认名称,
总相册是一个实际不存在的概念,它只是原始媒体数据的记录集合。

想要在 Android 上解决这个问题,你可以像这样使用 `pathNameBuilder`
```dart
AssetPickerConfig(
pathNameBuilder: (AssetPathEntity path) => switch (path) {
final p when p.isAll => '最近',
// 你也可以将类似的逻辑应用在其他常见的相册上。
_ => path.name,
},
)
```

其他相册或者其他平台 (iOS/macOS) 上的相册会根据系统语言和配置支持的语言来进行展示。
`pathNameBuilder` 可以用于任何的相册。

### Execution failed for task ':photo_manager:compileDebugKotlin'

查看 [photo_manager#561][] 了解详细的解决方法。
Expand Down
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ submit issues to our issue tracker first.
* [With `dio`](#with-dio)
* [Custom pickers](#custom-pickers)
* [Frequently asked question ❔](#frequently-asked-question-)
* [Execution failed for task ':photo_manager:compileDebugKotlin'](#execution-failed-for-task-photomanagercompiledebugkotlin)
* [Changing the default album name (`Recent` to others)](#changing-the-default-album-name-recent-to-others)
* [Execution failed for task ':photo_manager:compileDebugKotlin'](#execution-failed-for-task-photo_managercompiledebugkotlin)
* [Create `AssetEntity` from `File` or `Uint8List` (rawData)](#create-assetentity-from-file-or-uint8list-rawdata)
* [Glide warning 'Failed to find GeneratedAppGlideModule'](#glide-warning-failed-to-find-generatedappglidemodule)
* [Contributors ✨](#contributors-)
Expand Down Expand Up @@ -312,7 +313,7 @@ Fields in `AssetPickerConfig`:
| pathNameBuilder | `PathNameBuilder<AssetPathEntity>?` | Build customized path (album) name with the given path entity. | `null` |
| assetsChangeCallback | `AssetsChangeCallback<AssetPathEntity>?` | The callback that will be called when the system notifies assets changes. | `null` |
| assetsChangeRefreshPredicate | `AssetsChangeRefreshPredicate<AssetPathEntity>?` | Whether assets changing should call refresh with the given call and the current selected path. | `null` |
| shouldAutoPlayPreview | `bool` | Whether the preview should auto play. | `false` |
| shouldAutoPlayPreview | `bool` | Whether the preview should auto play. | `false` |

- When `maxAssets` equals to `1` (a.k.a. single picking mode),
use `SpecialPickerType.noPreview` will immediately select asset
Expand Down Expand Up @@ -468,6 +469,26 @@ See [Contribute custom implementations][] for more details.

## Frequently asked question ❔

### Changing the default album name (`Recent` to others)

`Recent` is the fix album name for the ALL assets on Android
since the all assets' album is not an actual album, it only represents all media data records.
To solve that on Android, use `pathNameBuilder`, for example:
```dart
AssetPickerConfig(
pathNameBuilder: (AssetPathEntity path) => switch (path) {
final p when p.isAll => '最近',
// You can apply similar conditions to other common paths.
_ => path.name,
},
)
```
Other albums or albums on other platforms (iOS/macOS) will follow
the configured system localization and supported localizations.
`pathNameBuilder` is available for all albums.
### Execution failed for task ':photo_manager:compileDebugKotlin'
See [photo_manager#561][] for more details.
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: wechat_assets_picker_demo
description: The demo project for the wechat_assets_picker package.
version: 9.1.0+55
version: 9.2.1+57
publish_to: none

environment:
Expand Down
Loading

0 comments on commit f3f07a0

Please sign in to comment.