Selaa lähdekoodia

Update picked asset list.

Caijinglong 5 vuotta sitten
vanhempi
commit
4897322703

+ 18
- 0
example/ios/Flutter/Flutter.podspec Näytä tiedosto

@@ -0,0 +1,18 @@
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 Näytä tiedosto

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

+ 2
- 4
example/ios/Runner/Info.plist Näytä tiedosto

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

+ 16
- 1
lib/photo.dart Näytä tiedosto

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

+ 2
- 0
lib/src/provider/asset_provider.dart Näytä tiedosto

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

+ 5
- 1
lib/src/provider/config_provider.dart Näytä tiedosto

@@ -2,12 +2,12 @@ import 'package:flutter/material.dart';
2 2
 import 'package:photo/src/entity/options.dart';
3 3
 import 'package:photo/src/provider/asset_provider.dart';
4 4
 import 'package:photo/src/provider/i18n_provider.dart';
5
+import 'package:photo_manager/photo_manager.dart';
5 6
 
6 7
 class PhotoPickerProvider extends InheritedWidget {
7 8
   final Options options;
8 9
   final I18nProvider provider;
9 10
   final AssetProvider assetProvider = AssetProvider();
10
-
11 11
   PhotoPickerProvider({
12 12
     @required this.options,
13 13
     @required this.provider,
@@ -25,4 +25,8 @@ class PhotoPickerProvider extends InheritedWidget {
25 25
 
26 26
   static AssetProvider assetProviderOf(BuildContext context) =>
27 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 Näytä tiedosto

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

+ 1
- 1
pubspec.lock Näytä tiedosto

@@ -115,7 +115,7 @@ packages:
115 115
       name: photo_manager
116 116
       url: "https://pub.flutter-io.cn"
117 117
     source: hosted
118
-    version: "0.4.5"
118
+    version: "0.4.6"
119 119
   quiver:
120 120
     dependency: transitive
121 121
     description:

+ 2
- 2
pubspec.yaml Näytä tiedosto

@@ -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.4.5+1
3
+version: 0.4.6
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.4.5
14
+  photo_manager: ^0.4.6
15 15
   # photo_manager:
16 16
   #   git:
17 17
   #     url: https://github.com/CaiJingLong/flutter_photo_manager.git