Browse Source

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

Update pick state when gallery refresh
C 5 years ago
parent
commit
94088f0c7b
No account linked to committer's email address
5 changed files with 50 additions and 26 deletions
  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 View File

1
 # CHANGELOG
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
 **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.
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
 - Video duration badge time problem.
19
 - Video duration badge time problem.
14
 - Images sort by create time.
20
 - Images sort by create time.
15
 
21
 
16
-## [0.2.0]
22
+## 0.2.0
17
 
23
 
18
 **break change**
24
 **break change**
19
 support pick only image or video
25
 support pick only image or video
20
 
26
 
21
-## [0.1.11]
27
+## 0.1.11
22
 
28
 
23
 fix pubspec version
29
 fix pubspec version
24
 
30
 
25
-## [0.1.10] fix bug
31
+## 0.1.10 fix bug
26
 
32
 
27
 fix a error widget bug.
33
 fix a error widget bug.
28
 
34
 
29
-## [0.1.9]
35
+## 0.1.9
30
 
36
 
31
 fix all assets i18n provider
37
 fix all assets i18n provider
32
 
38
 
33
-## [0.1.8]
39
+## 0.1.8
34
 
40
 
35
 Fixed crash bug when the number of photos or videos was zero.
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
 add a badge delegate for asset
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
 sort asset by date
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
 fix thumb bug.
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
 fix all path hasVideo property bug
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
 add loadingDelegate
65
 add loadingDelegate
60
 
66
 
61
-## [0.1.0] support video
67
+## 0.1.0 support video
62
 
68
 
63
 API incompatibility
69
 API incompatibility
64
 
70
 
65
 ImageXXX rename AssetXXX
71
 ImageXXX rename AssetXXX
66
 
72
 
67
-## [0.0.8] fix bug
73
+## 0.0.8 fix bug
68
 
74
 
69
 DefaultCheckBoxBuilderDelegate params checkColor not valid bug
75
 DefaultCheckBoxBuilderDelegate params checkColor not valid bug
70
 
76
 
71
-## [0.0.7] fix bug
77
+## 0.0.7 fix bug
72
 
78
 
73
 fix dividerColor not valid bug
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
 users can use CheckBoxDelegate to custom preview right bottom widget
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
 add the sort delegate to help user sort gallery
87
 add the sort delegate to help user sort gallery
82
 
88
 
84
 
90
 
85
 add a loading refresh indicator in the gallery
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
 fix request other permission will crash bug
95
 fix request other permission will crash bug
90
 
96
 
91
 depo photo_manager 0.0.3
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
 add a params for pick image , thumb size
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
 preview sure button bug
105
 preview sure button bug
100
 preview bottom safeArea
106
 preview bottom safeArea
101
 
107
 
102
-## [0.0.1] first version
108
+## 0.0.1 first version
103
 
109
 
104
 image picker
110
 image picker

+ 16
- 0
lib/src/provider/selected_provider.dart View File

1
+import 'dart:async';
2
+
1
 import 'package:photo_manager/photo_manager.dart';
3
 import 'package:photo_manager/photo_manager.dart';
2
 
4
 
3
 abstract class SelectedProvider {
5
 abstract class SelectedProvider {
41
   }
43
   }
42
 
44
 
43
   void sure();
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 View File

361
   void _onGalleryChange(AssetPathEntity assetPathEntity) {
361
   void _onGalleryChange(AssetPathEntity assetPathEntity) {
362
     _currentPath = assetPathEntity;
362
     _currentPath = assetPathEntity;
363
 
363
 
364
-    _currentPath.assetList.then((v) {
364
+    _currentPath.assetList.then((v)async {
365
       _sortAssetList(v);
365
       _sortAssetList(v);
366
       list.clear();
366
       list.clear();
367
       list.addAll(v);
367
       list.addAll(v);
368
       scrollController.jumpTo(0.0);
368
       scrollController.jumpTo(0.0);
369
+      await checkPickImageEntity();
369
       setState(() {});
370
       setState(() {});
370
     });
371
     });
371
   }
372
   }
499
     // Not deleted
500
     // Not deleted
500
     _onGalleryChange(this.currentPath);
501
     _onGalleryChange(this.currentPath);
501
   }
502
   }
503
+
502
 }
504
 }

+ 1
- 1
pubspec.lock View File

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

+ 2
- 2
pubspec.yaml View File

1
 name: photo
1
 name: photo
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.
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
 author: caijinglong<cjl_spy@163.com>
4
 author: caijinglong<cjl_spy@163.com>
5
 homepage: https://github.com/CaiJingLong/flutter_photo
5
 homepage: https://github.com/CaiJingLong/flutter_photo
6
 
6
 
11
   flutter:
11
   flutter:
12
     sdk: flutter
12
     sdk: flutter
13
 
13
 
14
-  photo_manager: ^0.3.0
14
+  photo_manager: ^0.3.1
15
   # photo_manager:
15
   # photo_manager:
16
   #   git:
16
   #   git:
17
   #     url: https://github.com/CaiJingLong/flutter_photo_manager.git
17
   #     url: https://github.com/CaiJingLong/flutter_photo_manager.git