Skip to content

Commit b9447bf

Browse files
committed
fix(image_picker): Add limit parameter in pickMultiImage
1 parent c3c4c5a commit b9447bf

File tree

8 files changed

+14
-3
lines changed

8 files changed

+14
-3
lines changed

packages/image_picker/image_picker_android/lib/image_picker_android.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,13 @@ class ImagePickerAndroid extends ImagePickerPlatform {
204204
double? maxWidth,
205205
double? maxHeight,
206206
int? imageQuality,
207+
int? limit,
207208
}) async {
208209
final List<String> paths = await _getMultiImagePath(
209210
maxWidth: maxWidth,
210211
maxHeight: maxHeight,
211212
imageQuality: imageQuality,
213+
limit: limit,
212214
);
213215
if (paths.isEmpty) {
214216
return null;

packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ class ImagePickerPlugin extends ImagePickerPlatform {
205205
double? maxWidth,
206206
double? maxHeight,
207207
int? imageQuality,
208+
int? limit,
208209
}) async {
209210
return getMultiImageWithOptions(
210211
options: MultiImagePickerOptions(

packages/image_picker/image_picker_ios/lib/image_picker_ios.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ class ImagePickerIOS extends ImagePickerPlatform {
8787
double? maxWidth,
8888
double? maxHeight,
8989
int? imageQuality,
90+
int? limit,
9091
}) async {
9192
final List<String> paths = await _pickMultiImageAsPath(
9293
options: MultiImagePickerOptions(
@@ -95,6 +96,7 @@ class ImagePickerIOS extends ImagePickerPlatform {
9596
maxHeight: maxHeight,
9697
imageQuality: imageQuality,
9798
),
99+
limit: limit,
98100
),
99101
);
100102
// Convert an empty list to a null return since that was the legacy behavior

packages/image_picker/image_picker_linux/lib/image_picker_linux.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,15 @@ class ImagePickerLinux extends CameraDelegatingImagePickerPlatform {
139139
throw UnimplementedError('Unknown ImageSource: $source');
140140
}
141141

142-
// `maxWidth`, `maxHeight`, and `imageQuality` arguments are not currently
142+
// `maxWidth`, `maxHeight`, `limit`, and `imageQuality` arguments are not currently
143143
// supported. If any of these arguments are supplied, they will be silently
144144
// ignored.
145145
@override
146146
Future<List<XFile>> getMultiImage({
147147
double? maxWidth,
148148
double? maxHeight,
149149
int? imageQuality,
150+
int? limit,
150151
}) async {
151152
const XTypeGroup typeGroup =
152153
XTypeGroup(label: 'Images', mimeTypes: <String>['image/*']);

packages/image_picker/image_picker_macos/lib/image_picker_macos.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,15 @@ class ImagePickerMacOS extends CameraDelegatingImagePickerPlatform {
141141
throw UnimplementedError('Unknown ImageSource: $source');
142142
}
143143

144-
// `maxWidth`, `maxHeight`, and `imageQuality` arguments are not currently
144+
// `maxWidth`, `maxHeight`, `limit`, and `imageQuality` arguments are not currently
145145
// supported. If any of these arguments are supplied, they will be silently
146146
// ignored.
147147
@override
148148
Future<List<XFile>> getMultiImage({
149149
double? maxWidth,
150150
double? maxHeight,
151151
int? imageQuality,
152+
int? limit,
152153
}) async {
153154
// TODO(stuartmorgan): Add a native implementation that can use
154155
// PHPickerViewController on macOS 13+, with this as a fallback for

packages/image_picker/image_picker_platform_interface/lib/src/method_channel/method_channel_image_picker.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,13 @@ class MethodChannelImagePicker extends ImagePickerPlatform {
224224
double? maxWidth,
225225
double? maxHeight,
226226
int? imageQuality,
227+
int? limit,
227228
}) async {
228229
final List<dynamic>? paths = await _getMultiImagePath(
229230
maxWidth: maxWidth,
230231
maxHeight: maxHeight,
231232
imageQuality: imageQuality,
233+
limit: limit,
232234
);
233235
if (paths == null) {
234236
return null;

packages/image_picker/image_picker_platform_interface/lib/src/platform_interface/image_picker_platform.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ abstract class ImagePickerPlatform extends PlatformInterface {
209209
double? maxWidth,
210210
double? maxHeight,
211211
int? imageQuality,
212+
int? limit,
212213
}) {
213214
throw UnimplementedError('getMultiImage() has not been implemented.');
214215
}

packages/image_picker/image_picker_windows/lib/image_picker_windows.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,15 @@ class ImagePickerWindows extends CameraDelegatingImagePickerPlatform {
168168
throw UnimplementedError('Unknown ImageSource: $source');
169169
}
170170

171-
// `maxWidth`, `maxHeight`, and `imageQuality` arguments are not currently
171+
// `maxWidth`, `maxHeight`, `limit`, and `imageQuality` arguments are not currently
172172
// supported. If any of these arguments are supplied, they will be silently
173173
// ignored.
174174
@override
175175
Future<List<XFile>> getMultiImage({
176176
double? maxWidth,
177177
double? maxHeight,
178178
int? imageQuality,
179+
int? limit,
179180
}) async {
180181
const XTypeGroup typeGroup =
181182
XTypeGroup(label: 'Images', extensions: imageFormats);

0 commit comments

Comments
 (0)