Skip to content

Commit 4751952

Browse files
authored
🐛 Fix not updated empty flag (#353)
1 parent 2936299 commit 4751952

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

CHANGELOG.md

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

55
# Changelog
66

7+
## 8.0.1
8+
9+
### Fixes
10+
11+
- Fix not updated empty flag in `DefaultAssetPickerProvider`. (#353)
12+
713
## 8.0.0
814

915
To know more about breaking changes, see [Migration Guide][].

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.0.0+21
3+
version: 8.0.1+22
44
publish_to: none
55

66
environment:

lib/src/provider/asset_picker_provider.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -449,17 +449,18 @@ class DefaultAssetPickerProvider
449449
/// Get assets list from current path entity.
450450
/// 从当前已选路径获取资源列表
451451
Future<void> getAssetsFromCurrentPath() async {
452-
if (_currentPath != null && _paths.isNotEmpty) {
453-
final PathWrapper<AssetPathEntity> wrapper = _currentPath!;
454-
final int assetCount =
455-
wrapper.assetCount ?? await wrapper.path.assetCountAsync;
456-
totalAssetsCount = assetCount;
457-
if (wrapper.assetCount == null) {
458-
currentPath = _currentPath!.copyWith(assetCount: assetCount);
459-
}
460-
await getAssetsFromPath(0, currentPath!.path);
461-
} else {
452+
if (_currentPath == null || _paths.isEmpty) {
462453
isAssetsEmpty = true;
454+
return;
455+
}
456+
final PathWrapper<AssetPathEntity> wrapper = _currentPath!;
457+
final int assetCount =
458+
wrapper.assetCount ?? await wrapper.path.assetCountAsync;
459+
totalAssetsCount = assetCount;
460+
isAssetsEmpty = assetCount == 0;
461+
if (wrapper.assetCount == null) {
462+
currentPath = _currentPath!.copyWith(assetCount: assetCount);
463463
}
464+
await getAssetsFromPath(0, currentPath!.path);
464465
}
465466
}

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
22
description: An audio/video/image picker in pure Dart which is the same with WeChat, support multi picking.
3-
version: 8.0.0
3+
version: 8.0.1
44
homepage: https://github.com/fluttercandies/flutter_wechat_assets_picker
55

66
environment:

0 commit comments

Comments
 (0)