소스 검색

Merge pull request #35 from CaiJingLong/fix-refresh-pick

Update pick state when gallery refresh
C 5 년 전
부모
커밋
94088f0c7b
No account linked to committer's email address
5개의 변경된 파일50개의 추가작업 그리고 26개의 파일을 삭제
  1. 28
    22
      CHANGELOG.md
  2. 16
    0
      lib/src/provider/selected_provider.dart
  3. 3
    1
      lib/src/ui/page/photo_main_page.dart
  4. 1
    1
      pubspec.lock
  5. 2
    2
      pubspec.yaml

+ 28
- 22
CHANGELOG.md 파일 보기

@@ -1,6 +1,12 @@
1 1
 # CHANGELOG
2 2
 
3
-## [0.3.0] add params photoList
3
+## 0.3.1
4
+
5
+`photo_manager` to `0.3.1`
6
+
7
+If the selected image is deleted by other applications, the selected status in the selector will be updated correctly.
8
+
9
+## 0.3.0 add params photoList
4 10
 
5 11
 **Breaking change**. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.
6 12
 
@@ -13,70 +19,70 @@ fix:
13 19
 - Video duration badge time problem.
14 20
 - Images sort by create time.
15 21
 
16
-## [0.2.0]
22
+## 0.2.0
17 23
 
18 24
 **break change**
19 25
 support pick only image or video
20 26
 
21
-## [0.1.11]
27
+## 0.1.11
22 28
 
23 29
 fix pubspec version
24 30
 
25
-## [0.1.10] fix bug
31
+## 0.1.10 fix bug
26 32
 
27 33
 fix a error widget bug.
28 34
 
29
-## [0.1.9]
35
+## 0.1.9
30 36
 
31 37
 fix all assets i18n provider
32 38
 
33
-## [0.1.8]
39
+## 0.1.8
34 40
 
35 41
 Fixed crash bug when the number of photos or videos was zero.
36 42
 
37
-## [0.1.7]
43
+## 0.1.7
38 44
 
39 45
 add a badge delegate for asset
40 46
 
41
-## [0.1.6] rollback photo_manager version
47
+## 0.1.6 rollback photo_manager version
42 48
 
43 49
 sort asset by date
44 50
 
45
-## [0.1.5] rollback photo_manager version
51
+## 0.1.5 rollback photo_manager version
46 52
 
47
-## [0.1.4] fix thumb is null bug
53
+## 0.1.4 fix thumb is null bug
48 54
 
49 55
 fix thumb bug.
50 56
 
51
-## [0.1.3] support ios icloud asset
57
+## 0.1.3 support ios icloud asset
52 58
 
53
-## [0.1.2] fix bug
59
+## 0.1.2 fix bug
54 60
 
55 61
 fix all path hasVideo property bug
56 62
 
57
-## [0.1.1] fix bug and add params
63
+## 0.1.1 fix bug and add params
58 64
 
59 65
 add loadingDelegate
60 66
 
61
-## [0.1.0] support video
67
+## 0.1.0 support video
62 68
 
63 69
 API incompatibility
64 70
 
65 71
 ImageXXX rename AssetXXX
66 72
 
67
-## [0.0.8] fix bug
73
+## 0.0.8 fix bug
68 74
 
69 75
 DefaultCheckBoxBuilderDelegate params checkColor not valid bug
70 76
 
71
-## [0.0.7] fix bug
77
+## 0.0.7 fix bug
72 78
 
73 79
 fix dividerColor not valid bug
74 80
 
75
-## [0.0.6] add checkbox delegate
81
+## 0.0.6 add checkbox delegate
76 82
 
77 83
 users can use CheckBoxDelegate to custom preview right bottom widget
78 84
 
79
-## [0.0.5] add a params
85
+## 0.0.5 add a params
80 86
 
81 87
 add the sort delegate to help user sort gallery
82 88
 
@@ -84,21 +90,21 @@ Optimized LruCache
84 90
 
85 91
 add a loading refresh indicator in the gallery
86 92
 
87
-## [0.0.4] fix #1
93
+## 0.0.4 fix #1
88 94
 
89 95
 fix request other permission will crash bug
90 96
 
91 97
 depo photo_manager 0.0.3
92 98
 
93
-## [0.0.3] add the thumb size to option
99
+## 0.0.3 add the thumb size to option
94 100
 
95 101
 add a params for pick image , thumb size
96 102
 
97
-## [0.0.2] fix bug
103
+## 0.0.2 fix bug
98 104
 
99 105
 preview sure button bug
100 106
 preview bottom safeArea
101 107
 
102
-## [0.0.1] first version
108
+## 0.0.1 first version
103 109
 
104 110
 image picker

+ 16
- 0
lib/src/provider/selected_provider.dart 파일 보기

@@ -1,3 +1,5 @@
1
+import 'dart:async';
2
+
1 3
 import 'package:photo_manager/photo_manager.dart';
2 4
 
3 5
 abstract class SelectedProvider {
@@ -41,4 +43,18 @@ abstract class SelectedProvider {
41 43
   }
42 44
 
43 45
   void sure();
46
+
47
+  Future checkPickImageEntity() async {
48
+    List<AssetEntity> notExistsList = [];
49
+    for (var entity in selectedList) {
50
+      var exists = await entity.exists;
51
+      if (!exists) {
52
+        notExistsList.add(entity);
53
+      }
54
+    }
55
+
56
+    selectedList.removeWhere((e) {
57
+      return notExistsList.contains(e);
58
+    });
59
+  }
44 60
 }

+ 3
- 1
lib/src/ui/page/photo_main_page.dart 파일 보기

@@ -361,11 +361,12 @@ class _PhotoMainPageState extends State<PhotoMainPage>
361 361
   void _onGalleryChange(AssetPathEntity assetPathEntity) {
362 362
     _currentPath = assetPathEntity;
363 363
 
364
-    _currentPath.assetList.then((v) {
364
+    _currentPath.assetList.then((v)async {
365 365
       _sortAssetList(v);
366 366
       list.clear();
367 367
       list.addAll(v);
368 368
       scrollController.jumpTo(0.0);
369
+      await checkPickImageEntity();
369 370
       setState(() {});
370 371
     });
371 372
   }
@@ -499,4 +500,5 @@ class _PhotoMainPageState extends State<PhotoMainPage>
499 500
     // Not deleted
500 501
     _onGalleryChange(this.currentPath);
501 502
   }
503
+
502 504
 }

+ 1
- 1
pubspec.lock 파일 보기

@@ -73,7 +73,7 @@ packages:
73 73
       name: photo_manager
74 74
       url: "https://pub.flutter-io.cn"
75 75
     source: hosted
76
-    version: "0.3.0"
76
+    version: "0.3.1"
77 77
   quiver:
78 78
     dependency: transitive
79 79
     description:

+ 2
- 2
pubspec.yaml 파일 보기

@@ -1,6 +1,6 @@
1 1
 name: photo
2 2
 description: image picker, multi picker support video / icloud asset ,use flutter as ui, if you want to build custom ui,you just use photo_manager.
3
-version: 0.3.0
3
+version: 0.3.1
4 4
 author: caijinglong<cjl_spy@163.com>
5 5
 homepage: https://github.com/CaiJingLong/flutter_photo
6 6
 
@@ -11,7 +11,7 @@ dependencies:
11 11
   flutter:
12 12
     sdk: flutter
13 13
 
14
-  photo_manager: ^0.3.0
14
+  photo_manager: ^0.3.1
15 15
   # photo_manager:
16 16
   #   git:
17 17
   #     url: https://github.com/CaiJingLong/flutter_photo_manager.git