Browse Source

Update picked asset list.

Caijinglong 5 years ago
parent
commit
4897322703

+ 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>

+ 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
     );

+ 2
- 0
lib/src/provider/asset_provider.dart View File

31
   bool get noMore => getPaging()?.noMore ?? false;
31
   bool get noMore => getPaging()?.noMore ?? false;
32
 
32
 
33
   int get count => data?.length ?? 0;
33
   int get count => data?.length ?? 0;
34
+
35
+  void addPickedAssetList() {}
34
 }
36
 }
35
 
37
 
36
 class AssetPaging {
38
 class AssetPaging {

+ 5
- 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
   PhotoPickerProvider({
11
   PhotoPickerProvider({
12
     @required this.options,
12
     @required this.options,
13
     @required this.provider,
13
     @required this.provider,
25
 
25
 
26
   static AssetProvider assetProviderOf(BuildContext context) =>
26
   static AssetProvider assetProviderOf(BuildContext context) =>
27
       of(context).assetProvider;
27
       of(context).assetProvider;
28
+
29
+  void addPickedAssetList(List<AssetEntity> pickedAssetList) {
30
+    assetProvider.addPickedAssetList();
31
+  }
28
 }
32
 }

+ 5
- 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,
26
       child: PhotoMainPage(
28
       child: PhotoMainPage(
31
         photoList: photoList,
33
         photoList: photoList,
32
       ),
34
       ),
33
     );
35
     );
36
+
37
+    return pickerProvider;
34
   }
38
   }
35
 }
39
 }

+ 1
- 1
pubspec.lock View File

115
       name: photo_manager
115
       name: photo_manager
116
       url: "https://pub.flutter-io.cn"
116
       url: "https://pub.flutter-io.cn"
117
     source: hosted
117
     source: hosted
118
-    version: "0.4.5"
118
+    version: "0.4.6"
119
   quiver:
119
   quiver:
120
     dependency: transitive
120
     dependency: transitive
121
     description:
121
     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.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.6
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