Browse Source

Merge pull request #95 from CaiJingLong/picked-asset-list-

Update picked asset list.
Caijinglong 4 years ago
parent
commit
d88e1754dd
No account linked to committer's email address

+ 5
- 0
CHANGELOG.md View File

1
 # CHANGELOG
1
 # CHANGELOG
2
 
2
 
3
+## 0.4.7
4
+
5
+- Rollback photo_manager.
6
+- Add `pickedAssetList` for `pickAsset`.
7
+
3
 ## 0.4.5+1
8
 ## 0.4.5+1
4
 
9
 
5
 Fix:
10
 Fix:

+ 18
- 0
example/ios/Flutter/Flutter.podspec View File

1
+#
2
+# NOTE: This podspec is NOT to be published. It is only used as a local source!
3
+#
4
+
5
+Pod::Spec.new do |s|
6
+  s.name             = 'Flutter'
7
+  s.version          = '1.0.0'
8
+  s.summary          = 'High-performance, high-fidelity mobile apps.'
9
+  s.description      = <<-DESC
10
+Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
11
+                       DESC
12
+  s.homepage         = 'https://flutter.io'
13
+  s.license          = { :type => 'MIT' }
14
+  s.author           = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
15
+  s.source           = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
16
+  s.ios.deployment_target = '8.0'
17
+  s.vendored_frameworks = 'Flutter.framework'
18
+end

+ 17
- 13
example/ios/Runner.xcodeproj/project.pbxproj View File

48
 		9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
48
 		9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
49
 		9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
49
 		9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
50
 		9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
50
 		9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
51
-		97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
51
+		97C146EE1CF9000F007C117D /* photo_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = photo_example.app; sourceTree = BUILT_PRODUCTS_DIR; };
52
 		97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
52
 		97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
53
 		97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
53
 		97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
54
 		97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
54
 		97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
55
 		97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
55
 		97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
56
 		97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
56
 		97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
57
+		9DAC079CBB3999833A0EAF83 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
57
 		B01AC60EFE8E04B0E4D3E1C1 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
58
 		B01AC60EFE8E04B0E4D3E1C1 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
59
+		CCE4CADAA52D72A2FD3450C5 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
58
 /* End PBXFileReference section */
60
 /* End PBXFileReference section */
59
 
61
 
60
 /* Begin PBXFrameworksBuildPhase section */
62
 /* Begin PBXFrameworksBuildPhase section */
74
 		5CA87AA23185EF26B0BDF0EC /* Pods */ = {
76
 		5CA87AA23185EF26B0BDF0EC /* Pods */ = {
75
 			isa = PBXGroup;
77
 			isa = PBXGroup;
76
 			children = (
78
 			children = (
79
+				CCE4CADAA52D72A2FD3450C5 /* Pods-Runner.debug.xcconfig */,
80
+				9DAC079CBB3999833A0EAF83 /* Pods-Runner.release.xcconfig */,
77
 			);
81
 			);
78
 			name = Pods;
82
 			name = Pods;
79
 			sourceTree = "<group>";
83
 			sourceTree = "<group>";
105
 		97C146EF1CF9000F007C117D /* Products */ = {
109
 		97C146EF1CF9000F007C117D /* Products */ = {
106
 			isa = PBXGroup;
110
 			isa = PBXGroup;
107
 			children = (
111
 			children = (
108
-				97C146EE1CF9000F007C117D /* Runner.app */,
112
+				97C146EE1CF9000F007C117D /* photo_example.app */,
109
 			);
113
 			);
110
 			name = Products;
114
 			name = Products;
111
 			sourceTree = "<group>";
115
 			sourceTree = "<group>";
164
 			);
168
 			);
165
 			name = Runner;
169
 			name = Runner;
166
 			productName = Runner;
170
 			productName = Runner;
167
-			productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
171
+			productReference = 97C146EE1CF9000F007C117D /* photo_example.app */;
168
 			productType = "com.apple.product-type.application";
172
 			productType = "com.apple.product-type.application";
169
 		};
173
 		};
170
 /* End PBXNativeTarget section */
174
 /* End PBXNativeTarget section */
178
 				TargetAttributes = {
182
 				TargetAttributes = {
179
 					97C146ED1CF9000F007C117D = {
183
 					97C146ED1CF9000F007C117D = {
180
 						CreatedOnToolsVersion = 7.3.1;
184
 						CreatedOnToolsVersion = 7.3.1;
185
+						DevelopmentTeam = 344756CAN4;
181
 					};
186
 					};
182
 				};
187
 				};
183
 			};
188
 			};
186
 			developmentRegion = English;
191
 			developmentRegion = English;
187
 			hasScannedForEncodings = 0;
192
 			hasScannedForEncodings = 0;
188
 			knownRegions = (
193
 			knownRegions = (
194
+				English,
189
 				en,
195
 				en,
190
 				Base,
196
 				Base,
191
 			);
197
 			);
220
 			buildActionMask = 2147483647;
226
 			buildActionMask = 2147483647;
221
 			files = (
227
 			files = (
222
 			);
228
 			);
223
-			inputFileListPaths = (
224
-			);
225
 			inputPaths = (
229
 			inputPaths = (
226
-				"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
230
+				"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
227
 				"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
231
 				"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
228
 			);
232
 			);
229
 			name = "[CP] Embed Pods Frameworks";
233
 			name = "[CP] Embed Pods Frameworks";
230
-			outputFileListPaths = (
231
-			);
232
 			outputPaths = (
234
 			outputPaths = (
233
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
235
 				"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
234
 			);
236
 			);
235
 			runOnlyForDeploymentPostprocessing = 0;
237
 			runOnlyForDeploymentPostprocessing = 0;
236
 			shellPath = /bin/sh;
238
 			shellPath = /bin/sh;
237
-			shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
239
+			shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
238
 			showEnvVarsInLog = 0;
240
 			showEnvVarsInLog = 0;
239
 		};
241
 		};
240
 		3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
242
 		3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
430
 			buildSettings = {
432
 			buildSettings = {
431
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
433
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
432
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
434
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
435
+				DEVELOPMENT_TEAM = 344756CAN4;
433
 				ENABLE_BITCODE = NO;
436
 				ENABLE_BITCODE = NO;
434
 				FRAMEWORK_SEARCH_PATHS = (
437
 				FRAMEWORK_SEARCH_PATHS = (
435
 					"$(inherited)",
438
 					"$(inherited)",
441
 					"$(inherited)",
444
 					"$(inherited)",
442
 					"$(PROJECT_DIR)/Flutter",
445
 					"$(PROJECT_DIR)/Flutter",
443
 				);
446
 				);
444
-				PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
445
-				PRODUCT_NAME = "$(TARGET_NAME)";
447
+				PRODUCT_BUNDLE_IDENTIFIER = top.kikt.photo.manager;
448
+				PRODUCT_NAME = photo_example;
446
 				VERSIONING_SYSTEM = "apple-generic";
449
 				VERSIONING_SYSTEM = "apple-generic";
447
 			};
450
 			};
448
 			name = Debug;
451
 			name = Debug;
453
 			buildSettings = {
456
 			buildSettings = {
454
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
457
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
455
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
458
 				CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
459
+				DEVELOPMENT_TEAM = 344756CAN4;
456
 				ENABLE_BITCODE = NO;
460
 				ENABLE_BITCODE = NO;
457
 				FRAMEWORK_SEARCH_PATHS = (
461
 				FRAMEWORK_SEARCH_PATHS = (
458
 					"$(inherited)",
462
 					"$(inherited)",
464
 					"$(inherited)",
468
 					"$(inherited)",
465
 					"$(PROJECT_DIR)/Flutter",
469
 					"$(PROJECT_DIR)/Flutter",
466
 				);
470
 				);
467
-				PRODUCT_BUNDLE_IDENTIFIER = com.example.example;
468
-				PRODUCT_NAME = "$(TARGET_NAME)";
471
+				PRODUCT_BUNDLE_IDENTIFIER = top.kikt.photo.manager;
472
+				PRODUCT_NAME = photo_example;
469
 				VERSIONING_SYSTEM = "apple-generic";
473
 				VERSIONING_SYSTEM = "apple-generic";
470
 			};
474
 			};
471
 			name = Release;
475
 			name = Release;

+ 2
- 4
example/ios/Runner/Info.plist View File

22
 	<string>$(FLUTTER_BUILD_NUMBER)</string>
22
 	<string>$(FLUTTER_BUILD_NUMBER)</string>
23
 	<key>LSRequiresIPhoneOS</key>
23
 	<key>LSRequiresIPhoneOS</key>
24
 	<true/>
24
 	<true/>
25
+	<key>NSPhotoLibraryUsageDescription</key>
26
+	<string>App需要您的同意,才能访问相册</string>
25
 	<key>UILaunchStoryboardName</key>
27
 	<key>UILaunchStoryboardName</key>
26
 	<string>LaunchScreen</string>
28
 	<string>LaunchScreen</string>
27
 	<key>UIMainStoryboardFile</key>
29
 	<key>UIMainStoryboardFile</key>
28
 	<string>Main</string>
30
 	<string>Main</string>
29
-
30
-	<key>NSPhotoLibraryUsageDescription</key>
31
-    <string>App需要您的同意,才能访问相册</string>
32
-
33
 	<key>UISupportedInterfaceOrientations</key>
31
 	<key>UISupportedInterfaceOrientations</key>
34
 	<array>
32
 	<array>
35
 		<string>UIInterfaceOrientationPortrait</string>
33
 		<string>UIInterfaceOrientationPortrait</string>

+ 23
- 0
example/lib/icon_text_button.dart View File

1
+import 'package:flutter/material.dart';
2
+
3
+class IconTextButton extends StatelessWidget {
4
+  final IconData icon;
5
+  final String text;
6
+  final Function onTap;
7
+
8
+  const IconTextButton({Key key, this.icon, this.text, this.onTap})
9
+      : super(key: key);
10
+
11
+  @override
12
+  Widget build(BuildContext context) {
13
+    return InkWell(
14
+      onTap: onTap,
15
+      child: Container(
16
+        child: ListTile(
17
+          leading: Icon(icon ?? Icons.device_unknown),
18
+          title: Text(text ?? ""),
19
+        ),
20
+      ),
21
+    );
22
+  }
23
+}

+ 26
- 31
example/lib/main.dart View File

5
 import 'package:photo_manager/photo_manager.dart';
5
 import 'package:photo_manager/photo_manager.dart';
6
 
6
 
7
 import './preview.dart';
7
 import './preview.dart';
8
+import 'icon_text_button.dart';
9
+import 'picked_example.dart';
8
 
10
 
9
 void main() => runApp(MyApp());
11
 void main() => runApp(MyApp());
10
 
12
 
16
       child: MaterialApp(
18
       child: MaterialApp(
17
         title: 'Pick Image Demo',
19
         title: 'Pick Image Demo',
18
         theme: ThemeData(
20
         theme: ThemeData(
19
-          primarySwatch: Colors.blue,
21
+          primarySwatch: Colors.lime,
20
         ),
22
         ),
21
         home: MyHomePage(title: 'Pick Image Demo'),
23
         home: MyHomePage(title: 'Pick Image Demo'),
22
       ),
24
       ),
80
           child: Column(
82
           child: Column(
81
             children: <Widget>[
83
             children: <Widget>[
82
               IconTextButton(
84
               IconTextButton(
83
-                  icon: Icons.photo,
84
-                  text: "photo",
85
-                  onTap: () => _pickAsset(PickType.onlyImage)),
85
+                icon: Icons.photo,
86
+                text: "photo",
87
+                onTap: () => _pickAsset(PickType.onlyImage),
88
+              ),
89
+              IconTextButton(
90
+                icon: Icons.videocam,
91
+                text: "video",
92
+                onTap: () => _pickAsset(PickType.onlyVideo),
93
+              ),
86
               IconTextButton(
94
               IconTextButton(
87
-                  icon: Icons.videocam,
88
-                  text: "video",
89
-                  onTap: () => _pickAsset(PickType.onlyVideo)),
95
+                icon: Icons.album,
96
+                text: "all",
97
+                onTap: () => _pickAsset(PickType.all),
98
+              ),
90
               IconTextButton(
99
               IconTextButton(
91
-                  icon: Icons.album,
92
-                  text: "all",
93
-                  onTap: () => _pickAsset(PickType.all)),
94
-              Text(
95
-                '$currentSelected',
96
-                textAlign: TextAlign.center,
100
+                icon: CupertinoIcons.reply_all,
101
+                text: "Picked asset example.",
102
+                onTap: () => routePage(PickedExample()),
97
               ),
103
               ),
98
             ],
104
             ],
99
           ),
105
           ),
182
     }
188
     }
183
     setState(() {});
189
     setState(() {});
184
   }
190
   }
185
-}
186
-
187
-class IconTextButton extends StatelessWidget {
188
-  final IconData icon;
189
-  final String text;
190
-  final Function onTap;
191
 
191
 
192
-  const IconTextButton({Key key, this.icon, this.text, this.onTap})
193
-      : super(key: key);
194
-
195
-  @override
196
-  Widget build(BuildContext context) {
197
-    return InkWell(
198
-      onTap: onTap,
199
-      child: Container(
200
-        child: ListTile(
201
-          leading: Icon(icon ?? Icons.device_unknown),
202
-          title: Text(text ?? ""),
203
-        ),
192
+  void routePage(Widget widget) {
193
+    Navigator.push(
194
+      context,
195
+      MaterialPageRoute(
196
+        builder: (BuildContext context) {
197
+          return widget;
198
+        },
204
       ),
199
       ),
205
     );
200
     );
206
   }
201
   }

+ 48
- 0
example/lib/picked_example.dart View File

1
+import 'package:flutter/cupertino.dart';
2
+import 'package:flutter/material.dart';
3
+import 'package:photo/photo.dart';
4
+
5
+import 'icon_text_button.dart';
6
+import 'package:photo_manager/photo_manager.dart';
7
+
8
+class PickedExample extends StatefulWidget {
9
+  @override
10
+  _PickedExampleState createState() => _PickedExampleState();
11
+}
12
+
13
+class _PickedExampleState extends State<PickedExample> {
14
+  List<AssetEntity> picked = [];
15
+
16
+  @override
17
+  Widget build(BuildContext context) {
18
+    return Scaffold(
19
+      appBar: AppBar(
20
+        title: Text("Cross Picked asset"),
21
+      ),
22
+      body: Column(
23
+        children: <Widget>[
24
+          IconTextButton(
25
+            icon: Icons.assignment,
26
+            text: "Pick asset",
27
+            onTap: _pickAsset,
28
+          ),
29
+          ListTile(
30
+            title: Text("picked asset count = ${picked.length}"),
31
+          ),
32
+        ],
33
+      ),
34
+    );
35
+  }
36
+
37
+  void _pickAsset() async {
38
+    final result = await PhotoPicker.pickAsset(
39
+      context: context,
40
+      pickedAssetList: picked,
41
+    );
42
+    if (result != null && result.isNotEmpty) {
43
+      picked.clear();
44
+      picked.addAll(result);
45
+      setState(() {});
46
+    }
47
+  }
48
+}

+ 16
- 1
lib/photo.dart View File

46
   ///
46
   ///
47
   ///   [photoPathList] 一旦设置 则 [pickType]参数无效
47
   ///   [photoPathList] 一旦设置 则 [pickType]参数无效
48
   ///
48
   ///
49
+  ///   [pickedAssetList] 已选择的asset
50
+  ///
49
   /// 关于参数可以查看readme文档介绍
51
   /// 关于参数可以查看readme文档介绍
50
   ///
52
   ///
51
   /// if user not grand permission, then return null and show a dialog to help user open setting.
53
   /// if user not grand permission, then return null and show a dialog to help user open setting.
59
   ///
61
   ///
60
   ///   when [photoPathList] is not null , [pickType] invalid
62
   ///   when [photoPathList] is not null , [pickType] invalid
61
   ///
63
   ///
64
+  ///   [pickedAssetList]: The results of the last selection can be passed in for easy secondary selection.
65
+  ///
62
   /// params see readme.md
66
   /// params see readme.md
63
   static Future<List<AssetEntity>> pickAsset({
67
   static Future<List<AssetEntity>> pickAsset({
64
     @required BuildContext context,
68
     @required BuildContext context,
78
     PickType pickType = PickType.all,
82
     PickType pickType = PickType.all,
79
     BadgeDelegate badgeDelegate = const DefaultBadgeDelegate(),
83
     BadgeDelegate badgeDelegate = const DefaultBadgeDelegate(),
80
     List<AssetPathEntity> photoPathList,
84
     List<AssetPathEntity> photoPathList,
85
+    List<AssetEntity> pickedAssetList,
81
   }) {
86
   }) {
82
     assert(provider != null, "provider must be not null");
87
     assert(provider != null, "provider must be not null");
83
     assert(context != null, "context must be not null");
88
     assert(context != null, "context must be not null");
115
       options,
120
       options,
116
       provider,
121
       provider,
117
       photoPathList,
122
       photoPathList,
123
+      pickedAssetList,
118
     );
124
     );
119
   }
125
   }
120
 
126
 
123
     Options options,
129
     Options options,
124
     I18nProvider provider,
130
     I18nProvider provider,
125
     List<AssetPathEntity> photoList,
131
     List<AssetPathEntity> photoList,
132
+    List<AssetEntity> pickedAssetList,
126
   ) async {
133
   ) async {
127
     var requestPermission = await PhotoManager.requestPermission();
134
     var requestPermission = await PhotoManager.requestPermission();
128
     if (requestPermission != true) {
135
     if (requestPermission != true) {
138
       return null;
145
       return null;
139
     }
146
     }
140
 
147
 
141
-    return _openGalleryContentPage(context, options, provider, photoList);
148
+    return _openGalleryContentPage(
149
+      context,
150
+      options,
151
+      provider,
152
+      photoList,
153
+      pickedAssetList,
154
+    );
142
   }
155
   }
143
 
156
 
144
   Future<List<AssetEntity>> _openGalleryContentPage(
157
   Future<List<AssetEntity>> _openGalleryContentPage(
146
     Options options,
159
     Options options,
147
     I18nProvider provider,
160
     I18nProvider provider,
148
     List<AssetPathEntity> photoList,
161
     List<AssetPathEntity> photoList,
162
+    List<AssetEntity> pickedAssetList,
149
   ) async {
163
   ) async {
150
     return Navigator.of(context, rootNavigator: true).push(
164
     return Navigator.of(context, rootNavigator: true).push(
151
       MaterialPageRoute(
165
       MaterialPageRoute(
153
           options: options,
167
           options: options,
154
           provider: provider,
168
           provider: provider,
155
           photoList: photoList,
169
           photoList: photoList,
170
+          pickedAssetList: pickedAssetList,
156
         ),
171
         ),
157
       ),
172
       ),
158
     );
173
     );

+ 3
- 1
lib/src/provider/config_provider.dart View File

2
 import 'package:photo/src/entity/options.dart';
2
 import 'package:photo/src/entity/options.dart';
3
 import 'package:photo/src/provider/asset_provider.dart';
3
 import 'package:photo/src/provider/asset_provider.dart';
4
 import 'package:photo/src/provider/i18n_provider.dart';
4
 import 'package:photo/src/provider/i18n_provider.dart';
5
+import 'package:photo_manager/photo_manager.dart';
5
 
6
 
6
 class PhotoPickerProvider extends InheritedWidget {
7
 class PhotoPickerProvider extends InheritedWidget {
7
   final Options options;
8
   final Options options;
8
   final I18nProvider provider;
9
   final I18nProvider provider;
9
   final AssetProvider assetProvider = AssetProvider();
10
   final AssetProvider assetProvider = AssetProvider();
10
-
11
+  final List<AssetEntity> pickedAssetList;
11
   PhotoPickerProvider({
12
   PhotoPickerProvider({
12
     @required this.options,
13
     @required this.options,
13
     @required this.provider,
14
     @required this.provider,
14
     @required Widget child,
15
     @required Widget child,
16
+    this.pickedAssetList,
15
     Key key,
17
     Key key,
16
   }) : super(key: key, child: child);
18
   }) : super(key: key, child: child);
17
 
19
 

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

57
       return notExistsList.contains(e);
57
       return notExistsList.contains(e);
58
     });
58
     });
59
   }
59
   }
60
+
61
+  addPickedAsset(List<AssetEntity> list) {
62
+    for (final entity in list) {
63
+      addSelectEntity(entity);
64
+    }
65
+  }
60
 }
66
 }

+ 1
- 0
lib/src/ui/page/photo_main_page.dart View File

92
   void didChangeDependencies() {
92
   void didChangeDependencies() {
93
     super.didChangeDependencies();
93
     super.didChangeDependencies();
94
     if (!_isInit) {
94
     if (!_isInit) {
95
+      addPickedAsset(PhotoPickerProvider.of(context).pickedAssetList.toList());
95
       _refreshList();
96
       _refreshList();
96
     }
97
     }
97
   }
98
   }

+ 6
- 1
lib/src/ui/photo_app.dart View File

11
   final Options options;
11
   final Options options;
12
   final I18nProvider provider;
12
   final I18nProvider provider;
13
   final List<AssetPathEntity> photoList;
13
   final List<AssetPathEntity> photoList;
14
+  final List<AssetEntity> pickedAssetList;
14
   const PhotoApp({
15
   const PhotoApp({
15
     Key key,
16
     Key key,
16
     this.options,
17
     this.options,
17
     this.provider,
18
     this.provider,
18
     this.photoList,
19
     this.photoList,
20
+    this.pickedAssetList,
19
   }) : super(key: key);
21
   }) : super(key: key);
20
 
22
 
21
   @override
23
   @override
22
   Widget build(BuildContext context) {
24
   Widget build(BuildContext context) {
23
-    return PhotoPickerProvider(
25
+    final pickerProvider = PhotoPickerProvider(
24
       provider: provider,
26
       provider: provider,
25
       options: options,
27
       options: options,
28
+      pickedAssetList: pickedAssetList,
26
       child: PhotoMainPage(
29
       child: PhotoMainPage(
27
         onClose: (List<AssetEntity> value) {
30
         onClose: (List<AssetEntity> value) {
28
           Navigator.pop(context, value);
31
           Navigator.pop(context, value);
31
         photoList: photoList,
34
         photoList: photoList,
32
       ),
35
       ),
33
     );
36
     );
37
+
38
+    return pickerProvider;
34
   }
39
   }
35
 }
40
 }

+ 26
- 26
pubspec.lock View File

5
     dependency: transitive
5
     dependency: transitive
6
     description:
6
     description:
7
       name: archive
7
       name: archive
8
-      url: "https://pub.flutter-io.cn"
8
+      url: "https://pub.dartlang.org"
9
     source: hosted
9
     source: hosted
10
     version: "2.0.11"
10
     version: "2.0.11"
11
   args:
11
   args:
12
     dependency: transitive
12
     dependency: transitive
13
     description:
13
     description:
14
       name: args
14
       name: args
15
-      url: "https://pub.flutter-io.cn"
15
+      url: "https://pub.dartlang.org"
16
     source: hosted
16
     source: hosted
17
     version: "1.5.2"
17
     version: "1.5.2"
18
   async:
18
   async:
19
     dependency: transitive
19
     dependency: transitive
20
     description:
20
     description:
21
       name: async
21
       name: async
22
-      url: "https://pub.flutter-io.cn"
22
+      url: "https://pub.dartlang.org"
23
     source: hosted
23
     source: hosted
24
     version: "2.4.0"
24
     version: "2.4.0"
25
   boolean_selector:
25
   boolean_selector:
26
     dependency: transitive
26
     dependency: transitive
27
     description:
27
     description:
28
       name: boolean_selector
28
       name: boolean_selector
29
-      url: "https://pub.flutter-io.cn"
29
+      url: "https://pub.dartlang.org"
30
     source: hosted
30
     source: hosted
31
     version: "1.0.5"
31
     version: "1.0.5"
32
   charcode:
32
   charcode:
33
     dependency: transitive
33
     dependency: transitive
34
     description:
34
     description:
35
       name: charcode
35
       name: charcode
36
-      url: "https://pub.flutter-io.cn"
36
+      url: "https://pub.dartlang.org"
37
     source: hosted
37
     source: hosted
38
     version: "1.1.2"
38
     version: "1.1.2"
39
   collection:
39
   collection:
40
     dependency: transitive
40
     dependency: transitive
41
     description:
41
     description:
42
       name: collection
42
       name: collection
43
-      url: "https://pub.flutter-io.cn"
43
+      url: "https://pub.dartlang.org"
44
     source: hosted
44
     source: hosted
45
     version: "1.14.11"
45
     version: "1.14.11"
46
   convert:
46
   convert:
47
     dependency: transitive
47
     dependency: transitive
48
     description:
48
     description:
49
       name: convert
49
       name: convert
50
-      url: "https://pub.flutter-io.cn"
50
+      url: "https://pub.dartlang.org"
51
     source: hosted
51
     source: hosted
52
     version: "2.1.1"
52
     version: "2.1.1"
53
   crypto:
53
   crypto:
54
     dependency: transitive
54
     dependency: transitive
55
     description:
55
     description:
56
       name: crypto
56
       name: crypto
57
-      url: "https://pub.flutter-io.cn"
57
+      url: "https://pub.dartlang.org"
58
     source: hosted
58
     source: hosted
59
     version: "2.1.3"
59
     version: "2.1.3"
60
   flutter:
60
   flutter:
71
     dependency: transitive
71
     dependency: transitive
72
     description:
72
     description:
73
       name: image
73
       name: image
74
-      url: "https://pub.flutter-io.cn"
74
+      url: "https://pub.dartlang.org"
75
     source: hosted
75
     source: hosted
76
     version: "2.1.4"
76
     version: "2.1.4"
77
   matcher:
77
   matcher:
78
     dependency: transitive
78
     dependency: transitive
79
     description:
79
     description:
80
       name: matcher
80
       name: matcher
81
-      url: "https://pub.flutter-io.cn"
81
+      url: "https://pub.dartlang.org"
82
     source: hosted
82
     source: hosted
83
     version: "0.12.6"
83
     version: "0.12.6"
84
   meta:
84
   meta:
85
     dependency: transitive
85
     dependency: transitive
86
     description:
86
     description:
87
       name: meta
87
       name: meta
88
-      url: "https://pub.flutter-io.cn"
88
+      url: "https://pub.dartlang.org"
89
     source: hosted
89
     source: hosted
90
     version: "1.1.8"
90
     version: "1.1.8"
91
   path:
91
   path:
92
     dependency: transitive
92
     dependency: transitive
93
     description:
93
     description:
94
       name: path
94
       name: path
95
-      url: "https://pub.flutter-io.cn"
95
+      url: "https://pub.dartlang.org"
96
     source: hosted
96
     source: hosted
97
     version: "1.6.4"
97
     version: "1.6.4"
98
   pedantic:
98
   pedantic:
99
     dependency: transitive
99
     dependency: transitive
100
     description:
100
     description:
101
       name: pedantic
101
       name: pedantic
102
-      url: "https://pub.flutter-io.cn"
102
+      url: "https://pub.dartlang.org"
103
     source: hosted
103
     source: hosted
104
     version: "1.8.0+1"
104
     version: "1.8.0+1"
105
   petitparser:
105
   petitparser:
106
     dependency: transitive
106
     dependency: transitive
107
     description:
107
     description:
108
       name: petitparser
108
       name: petitparser
109
-      url: "https://pub.flutter-io.cn"
109
+      url: "https://pub.dartlang.org"
110
     source: hosted
110
     source: hosted
111
     version: "2.4.0"
111
     version: "2.4.0"
112
   photo_manager:
112
   photo_manager:
113
     dependency: "direct main"
113
     dependency: "direct main"
114
     description:
114
     description:
115
       name: photo_manager
115
       name: photo_manager
116
-      url: "https://pub.flutter-io.cn"
116
+      url: "https://pub.dartlang.org"
117
     source: hosted
117
     source: hosted
118
-    version: "0.4.5"
118
+    version: "0.4.7"
119
   quiver:
119
   quiver:
120
     dependency: transitive
120
     dependency: transitive
121
     description:
121
     description:
122
       name: quiver
122
       name: quiver
123
-      url: "https://pub.flutter-io.cn"
123
+      url: "https://pub.dartlang.org"
124
     source: hosted
124
     source: hosted
125
     version: "2.0.5"
125
     version: "2.0.5"
126
   sky_engine:
126
   sky_engine:
132
     dependency: transitive
132
     dependency: transitive
133
     description:
133
     description:
134
       name: source_span
134
       name: source_span
135
-      url: "https://pub.flutter-io.cn"
135
+      url: "https://pub.dartlang.org"
136
     source: hosted
136
     source: hosted
137
     version: "1.5.5"
137
     version: "1.5.5"
138
   stack_trace:
138
   stack_trace:
139
     dependency: transitive
139
     dependency: transitive
140
     description:
140
     description:
141
       name: stack_trace
141
       name: stack_trace
142
-      url: "https://pub.flutter-io.cn"
142
+      url: "https://pub.dartlang.org"
143
     source: hosted
143
     source: hosted
144
     version: "1.9.3"
144
     version: "1.9.3"
145
   stream_channel:
145
   stream_channel:
146
     dependency: transitive
146
     dependency: transitive
147
     description:
147
     description:
148
       name: stream_channel
148
       name: stream_channel
149
-      url: "https://pub.flutter-io.cn"
149
+      url: "https://pub.dartlang.org"
150
     source: hosted
150
     source: hosted
151
     version: "2.0.0"
151
     version: "2.0.0"
152
   string_scanner:
152
   string_scanner:
153
     dependency: transitive
153
     dependency: transitive
154
     description:
154
     description:
155
       name: string_scanner
155
       name: string_scanner
156
-      url: "https://pub.flutter-io.cn"
156
+      url: "https://pub.dartlang.org"
157
     source: hosted
157
     source: hosted
158
     version: "1.0.5"
158
     version: "1.0.5"
159
   term_glyph:
159
   term_glyph:
160
     dependency: transitive
160
     dependency: transitive
161
     description:
161
     description:
162
       name: term_glyph
162
       name: term_glyph
163
-      url: "https://pub.flutter-io.cn"
163
+      url: "https://pub.dartlang.org"
164
     source: hosted
164
     source: hosted
165
     version: "1.1.0"
165
     version: "1.1.0"
166
   test_api:
166
   test_api:
167
     dependency: transitive
167
     dependency: transitive
168
     description:
168
     description:
169
       name: test_api
169
       name: test_api
170
-      url: "https://pub.flutter-io.cn"
170
+      url: "https://pub.dartlang.org"
171
     source: hosted
171
     source: hosted
172
     version: "0.2.11"
172
     version: "0.2.11"
173
   typed_data:
173
   typed_data:
174
     dependency: transitive
174
     dependency: transitive
175
     description:
175
     description:
176
       name: typed_data
176
       name: typed_data
177
-      url: "https://pub.flutter-io.cn"
177
+      url: "https://pub.dartlang.org"
178
     source: hosted
178
     source: hosted
179
     version: "1.1.6"
179
     version: "1.1.6"
180
   vector_math:
180
   vector_math:
181
     dependency: transitive
181
     dependency: transitive
182
     description:
182
     description:
183
       name: vector_math
183
       name: vector_math
184
-      url: "https://pub.flutter-io.cn"
184
+      url: "https://pub.dartlang.org"
185
     source: hosted
185
     source: hosted
186
     version: "2.0.8"
186
     version: "2.0.8"
187
   xml:
187
   xml:
188
     dependency: transitive
188
     dependency: transitive
189
     description:
189
     description:
190
       name: xml
190
       name: xml
191
-      url: "https://pub.flutter-io.cn"
191
+      url: "https://pub.dartlang.org"
192
     source: hosted
192
     source: hosted
193
     version: "3.5.0"
193
     version: "3.5.0"
194
 sdks:
194
 sdks:

+ 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.4.5+1
3
+version: 0.4.6
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.4.5
14
+  photo_manager: ^0.4.7
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