Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
fe84761
♻️ Abstract `assetSemanticsBuilder` for `AssetPickerViewerBuilderDele…
AlexV525 Oct 9, 2024
f65cf3a
♻️ Move `selectorProvider` from base delegate to the default delegate
AlexV525 Oct 9, 2024
9c5e14f
♻️ Mark delegates and providers as generic
AlexV525 Oct 9, 2024
4a13665
♻️ Correct delegate type reference with `AssetPicker`
AlexV525 Oct 9, 2024
c5c3a18
🚀 Expose item builders entry
AlexV525 Oct 9, 2024
4001e90
🐛 Fix `AssetPickerViewerState` type inference in the viewer builder d…
AlexV525 Oct 10, 2024
4e0740d
🔥 Remove redundant `TickerProvider` of viewer builder delegate `initS…
AlexV525 Oct 10, 2024
c74740e
⚡️ Serve T and P in the viewer
AlexV525 Oct 10, 2024
6cc49c8
🚀 Pass asset through widgets
AlexV525 Oct 10, 2024
a37ef5e
Merge branch 'refs/heads/main' into feat/generic-delegates
AlexV525 Nov 21, 2024
882e631
⚡️ Use modified date on Android
AlexV525 Dec 19, 2024
1ad46c6
Merge branch 'refs/heads/main' into feat/generic-delegates
AlexV525 Aug 8, 2025
cde84bd
🚀 Sync generic fields
AlexV525 Aug 8, 2025
a08f05c
🔥 Remove unnecessary code from examples
AlexV525 Aug 8, 2025
ecfd35a
🚚 Rename generic types
AlexV525 Aug 8, 2025
54b7f07
⚡️ Improve types
AlexV525 Aug 11, 2025
d25705c
📝 Add migration guide
AlexV525 Aug 11, 2025
19d2236
📝 CHANGELOG
AlexV525 Aug 12, 2025
cd33499
♻️ Make delegate respect generic types as much as possible (#639)
AlexV525 Aug 12, 2025
eb97fb4
✨ Support Multiple Special Items (#635)
yujune Nov 15, 2025
a3e7cdf
Add `enableLivePhoto` flag to control Live-Photo functionality (#727)
Copilot Nov 22, 2025
e6e0b35
⚡️ Improve imports
AlexV525 Nov 22, 2025
cd4412f
Merge branch 'main' into feat/v10
AlexV525 Nov 22, 2025
5c257bb
⬇️ Fix `package:meta`
AlexV525 Nov 22, 2025
57c2335
🔧 Update example config
AlexV525 Nov 22, 2025
b776fd4
💚 Log git diff before dry-run
AlexV525 Nov 22, 2025
cc582ec
🔥 Remove `example/macos/Flutter/GeneratedPluginRegistrant.swift`
AlexV525 Nov 22, 2025
5c324b2
🚀 Roll Android build system
AlexV525 Nov 22, 2025
855cc5c
🔥 Remove SPM configs
AlexV525 Nov 22, 2025
1e79dd2
👷 Try to compatible with versions
AlexV525 Nov 22, 2025
31c13a5
⬆️ Bump minimum Flutter version to 3.27
AlexV525 Nov 22, 2025
41839bd
🔥 Remove deprecated methods
AlexV525 Nov 22, 2025
f1536c3
🔖 10.0.0
AlexV525 Nov 22, 2025
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
6 changes: 4 additions & 2 deletions .github/workflows/runnable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- main

env:
MINIMUM_FLUTTER_VERSION: '3.22.3'
MINIMUM_FLUTTER_VERSION: '3.27.4'

jobs:
analyze:
Expand Down Expand Up @@ -48,7 +48,9 @@ jobs:
run: flutter test
- name: Publish dry-run
if: matrix.flutter-version != 'min'
run: dart pub publish --dry-run
run: |
git --no-pager diff
dart pub publish --dry-run
- name: Generate docs
if: matrix.flutter-version != 'min'
run: |
Expand Down
35 changes: 34 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,40 @@ that can be found in the LICENSE file. -->

## Unreleased

*None.*
*None*.

## 10.0.0

**Breaking changes**

- Migrate to Flutter 3.27 and drop support for previous Flutter versions.
- Make delegate respect generic types as much as possible.
This is a breaking change for users who use custom delegates and providers.
See the migration guide for more details.
- Remove deprecated methods.

**New features**

- Support multiple append/prepend specials items.

## 9.8.0

> [!NOTE]
> Be aware of potential minor theme changes since the base theme has taken place in the picker's theme.

**Improvements**

- Improve themes by inheriting the base theme rather than standalone constructors.

**Fixes**

- Enabling using the package on Flutter 3.35.

## 9.7.0

**Improvements**

- Allows specifying the fallback text delegate through `assetPickerTextDelegateFromLocale`.

## 9.8.0

Expand Down
18 changes: 9 additions & 9 deletions README-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ Language: [English](README.md) | 中文
该插件仅保证能与 **stable 渠道的 Flutter SDK** 配合使用。
我们不会为其他渠道的 Flutter SDK 做实时支持。

| | 3.7 | 3.10 | 3.13 | 3.16 | 3.22 |
|--------|:---:|:----:|:----:|:----:|:----:|
| 9.5.0+ | ❌ | ❌ | ❌ | ❌ | ✅ |
| 8.9.0+ | ❌ | ❌ | ❌ | ✅ | |
| 8.7.0+ | ❌ | ❌ | ✅ | ❌ | ❌ |
| 8.5.0+ | ❌ | ✅ | ❌ | ❌ | ❌ |
| 8.4.0+ | ✅ | ❌ | ❌ | ❌ | ❌ |
| | 3.10 | 3.13 | 3.16 | 3.22 | 3.27 |
|---------|:----:|:----:|:----:|:----:|:----:|
| 10.0.0+ | ❌ | ❌ | ❌ | ❌ | ✅ |
| 9.5.0+ | ❌ | ❌ | ❌ | ✅ | |
| 8.9.0+ | ❌ | ❌ | ✅ | ❌ | ❌ |
| 8.7.0+ | ❌ | ✅ | ❌ | ❌ | ❌ |
| 8.5.0+ | ✅ | ❌ | ❌ | ❌ | ❌ |

如果在 `flutter pub get` 时遇到了 `resolve conflict` 失败问题,
请使用 `dependency_overrides` 解决。
Expand Down Expand Up @@ -294,8 +294,7 @@ final List<AssetEntity>? result = await AssetPicker.pickAssets(
| themeColor | `Color?` | 选择器的主题色 | `Color(0xff00bc56)` |
| pickerTheme | `ThemeData?` | 选择器的主题提供,包括查看器 | `null` |
| textDelegate | `AssetPickerTextDelegate?` | 选择器的文本代理构建,用于自定义文本 | `AssetPickerTextDelegate()` |
| specialItemPosition | `SpecialItemPosition` | 允许用户在选择器中添加一个自定义item,并指定位置。 | `SpecialPosition.none` |
| specialItemBuilder | `SpecialItemBuilder?` | 自定义item的构造方法 | `null` |
| specialItems | `List<SpecialItem>` | 自定义item列表 | `const <SpecialItem>[]` |
| loadingIndicatorBuilder | `IndicatorBuilder?` | 加载器的实现 | `null` |
| selectPredicate | `AssetSelectPredicate` | 判断资源可否被选择 | `null` |
| shouldRevertGrid | `bool?` | 判断资源网格是否需要倒序排列 | `null` |
Expand All @@ -305,6 +304,7 @@ final List<AssetEntity>? result = await AssetPicker.pickAssets(
| assetsChangeRefreshPredicate | `AssetsChangeRefreshPredicate<AssetPathEntity>?` | 判断资源变化是否根据 call 和当前选中的路径进行更新 | `null` |
| shouldAutoplayPreview | `bool` | 预览是否应自动播放 | `false` |
| dragToSelect | `bool` | 是否开启拖拽选择 | `true` |
| enableLivePhoto | `bool` | 是否启用实况图片的功能 | `true` |

- 当 `maxAssets` 等于 `1`(即单选模式),搭配
`SpecialPickerType.noPreview` 使用会在用户点选资源换时立刻选中并返回。
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ See the [Migration Guide][] to learn how to migrate between breaking changes.
The package only guarantees to be working on **the stable version of Flutter**.
We won't update it in real-time to align with other channels of Flutter.

| | 3.7 | 3.10 | 3.13 | 3.16 | 3.22 |
|--------|:---:|:----:|:----:|:----:|:----:|
| 9.5.0+ | ❌ | ❌ | ❌ | ❌ | ✅ |
| 8.9.0+ | ❌ | ❌ | ❌ | ✅ | |
| 8.7.0+ | ❌ | ❌ | ✅ | ❌ | ❌ |
| 8.5.0+ | ❌ | ✅ | ❌ | ❌ | ❌ |
| 8.4.0+ | ✅ | ❌ | ❌ | ❌ | ❌ |
| | 3.10 | 3.13 | 3.16 | 3.22 | 3.27 |
|---------|:----:|:----:|:----:|:----:|:----:|
| 10.0.0+ | ❌ | ❌ | ❌ | ❌ | ✅ |
| 9.5.0+ | ❌ | ❌ | ❌ | ✅ | |
| 8.9.0+ | ❌ | ❌ | ✅ | ❌ | ❌ |
| 8.7.0+ | ❌ | ✅ | ❌ | ❌ | ❌ |
| 8.5.0+ | ✅ | ❌ | ❌ | ❌ | ❌ |

If you got a `resolve conflict` error when running `flutter pub get`,
please use `dependency_overrides` to fix it.
Expand Down Expand Up @@ -303,8 +303,7 @@ Fields in `AssetPickerConfig`:
| themeColor | `Color?` | Main theme color for the picker. | `Color(0xff00bc56)` |
| pickerTheme | `ThemeData?` | Theme data provider for the picker and the viewer. | `null` |
| textDelegate | `AssetPickerTextDelegate?` | Text delegate for the picker, for customize the texts. | `AssetPickerTextDelegate()` |
| specialItemPosition | `SpecialItemPosition` | Allow users set a special item in the picker with several positions. | `SpecialItemPosition.none` |
| specialItemBuilder | `SpecialItemBuilder?` | The widget builder for the special item. | `null` |
| specialItems | `List<SpecialItem>` | List of special items. | `const <SpecialItem>[]` |
| loadingIndicatorBuilder | `IndicatorBuilder?` | Indicates the loading status for the builder. | `null` |
| selectPredicate | `AssetSelectPredicate` | Predicate whether an asset can be selected or unselected. | `null` |
| shouldRevertGrid | `bool?` | Whether the assets grid should revert. | `null` |
Expand All @@ -314,6 +313,7 @@ Fields in `AssetPickerConfig`:
| 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` |
| dragToSelect | `bool` | Whether assets selection can be done with drag gestures. | `true` |
| enableLivePhoto | `bool` | Whether to enable Live-Photo functionality in the picker. | `true` |

- When `maxAssets` equals to `1` (a.k.a. single picking mode),
use `SpecialPickerType.noPreview` will immediately select asset
Expand Down
2 changes: 2 additions & 0 deletions example/android/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
gradle-wrapper.jar
/.gradle
/.kotlin
/app/.cxx
/captures/
/gradlew
/gradlew.bat
Expand Down
88 changes: 0 additions & 88 deletions example/android/app/build.gradle

This file was deleted.

97 changes: 97 additions & 0 deletions example/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
plugins {
id("com.android.application")
id("kotlin-android")
id("kotlin-kapt")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}

fun Any.safeGetVersionProperty(name: String): Any? {
val klass = this::class.java
runCatching {
return klass.getMethod(name).invoke(this)
}
runCatching {
val getterName = "get" + name.capitalize()
return klass.getMethod(getterName).invoke(this)
}
runCatching {
return klass.getField(name).get(this)
}
return null
}

val packageName = "com.fluttercandies.wechatAssetsPickerExample"

android {
namespace = packageName
compileSdk = flutter.compileSdkVersion
ndkVersion = "27.0.12077973"

defaultConfig {
applicationId = packageName
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.safeGetVersionProperty("versionCode") as Int?
versionName = flutter.safeGetVersionProperty("versionName") as String?
}

compileOptions {
// Sets Java compatibility to Java 17
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

sourceSets {
getByName("main") {
java.srcDirs("src/main/kotlin")
}
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}

packaging {
dex {
useLegacyPackaging = true
}
jniLibs {
useLegacyPackaging = true
}
}

signingConfigs {
create("forAll") {
storeFile = file("${rootDir.absolutePath}/key.jks")
storePassword = "picker"
keyAlias = "picker"
keyPassword = "picker"
enableV1Signing = true
enableV2Signing = true
enableV3Signing = true
enableV4Signing = true
}
}

buildTypes {
getByName("debug") {
signingConfig = signingConfigs.getByName("forAll")
}
getByName("profile") {
signingConfig = signingConfigs.getByName("forAll")
}
getByName("release") {
signingConfig = signingConfigs.getByName("forAll")
}
}
}

flutter {
source = "../.."
}

dependencies {
implementation("com.github.bumptech.glide:glide:4.15.0")
kapt("com.github.bumptech.glide:compiler:4.15.0")
}
18 changes: 0 additions & 18 deletions example/android/build.gradle

This file was deleted.

24 changes: 24 additions & 0 deletions example/android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
allprojects {
repositories {
google()
mavenCentral()
}
}

val newBuildDir: Directory =
rootProject.layout.buildDirectory
.dir("../../build")
.get()
rootProject.layout.buildDirectory.value(newBuildDir)

subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}

tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
Loading