Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8b38f6

Browse files
ditmandevj3nsChris Yang
authored
[image_picker_for_web] Add doc comments to point out that some arguments aren't supported on the web (flutter#3566)
Re-landing a PR that @ditman messed up! flutter#3566 Co-authored-by: Jens Becker <[email protected]> Co-authored-by: Chris Yang <[email protected]>
1 parent 982e1ca commit e8b38f6

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

packages/image_picker/image_picker_for_web/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 2.0.0-nullsafety.1
2+
3+
* Add doc comments to point out that some arguments aren't supported on the web.
4+
15
# 2.0.0-nullsafety
26

37
* Migrate to null safety.

packages/image_picker/image_picker_for_web/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
A web implementation of [`image_picker`][1].
44

5-
## Browser Support
5+
## Limitations on the web platform
66

77
Since Web Browsers don't offer direct access to their users' file system,
88
this plugin provides a `PickedFile` abstraction to make access access uniform
@@ -42,6 +42,12 @@ In order to "take a photo", some mobile browsers offer a [`capture` attribute](h
4242
Each browser may implement `capture` any way they please, so it may (or may not) make a
4343
difference in your users' experience.
4444

45+
### pickImage()
46+
The arguments `maxWidth`, `maxHeight` and `imageQuality` are not supported on the web.
47+
48+
### pickVideo()
49+
The argument `maxDuration` is not supported on the web.
50+
4551
## Usage
4652

4753
### Import the package

packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ class ImagePickerPlugin extends ImagePickerPlatform {
3030
ImagePickerPlatform.instance = ImagePickerPlugin();
3131
}
3232

33+
/// Returns a [PickedFile] with the image that was picked.
34+
///
35+
/// The `source` argument controls where the image comes from. This can
36+
/// be either [ImageSource.camera] or [ImageSource.gallery].
37+
///
38+
/// Note that the `maxWidth`, `maxHeight` and `imageQuality` arguments are not supported on the web. If any of these arguments is supplied, it'll be silently ignored by the web version of the plugin.
39+
///
40+
/// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera].
41+
/// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device.
42+
/// Defaults to [CameraDevice.rear].
43+
///
44+
/// If no images were picked, the return value is null.
3345
@override
3446
Future<PickedFile> pickImage({
3547
required ImageSource source,
@@ -42,6 +54,18 @@ class ImagePickerPlugin extends ImagePickerPlatform {
4254
return pickFile(accept: _kAcceptImageMimeType, capture: capture);
4355
}
4456

57+
/// Returns a [PickedFile] containing the video that was picked.
58+
///
59+
/// The [source] argument controls where the video comes from. This can
60+
/// be either [ImageSource.camera] or [ImageSource.gallery].
61+
///
62+
/// Note that the `maxDuration` argument is not supported on the web. If the argument is supplied, it'll be silently ignored by the web version of the plugin.
63+
///
64+
/// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera].
65+
/// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device.
66+
/// Defaults to [CameraDevice.rear].
67+
///
68+
/// If no images were picked, the return value is null.
4569
@override
4670
Future<PickedFile> pickVideo({
4771
required ImageSource source,

packages/image_picker/image_picker_for_web/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: image_picker_for_web
22
description: Web platform implementation of image_picker
33
homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker/image_picker_for_web
44

5-
version: 2.0.0-nullsafety
5+
version: 2.0.0-nullsafety.1
66

77
flutter:
88
plugin:

0 commit comments

Comments
 (0)