From 8309870a7d9ee555dc2ade999c714cf96935a455 Mon Sep 17 00:00:00 2001 From: Jens Becker Date: Mon, 15 Feb 2021 15:50:43 +0100 Subject: [PATCH 1/7] Add doc comments to point out that some arguments are'nt supported on web --- .../lib/image_picker_for_web.dart | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart b/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart index 0c05980172aa..4ab9f719cad7 100644 --- a/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart +++ b/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart @@ -30,6 +30,18 @@ class ImagePickerPlugin extends ImagePickerPlatform { ImagePickerPlatform.instance = ImagePickerPlugin(); } + /// Returns a [PickedFile] with the image that was picked. + /// + /// The `source` argument controls where the image comes from. This can + /// be either [ImageSource.camera] or [ImageSource.gallery]. + /// + /// Note that the `maxWidth`, `maxHeight` and `imageQuality` arguments are not supported on the web. + /// + /// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera]. + /// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device. + /// Defaults to [CameraDevice.rear]. + /// + /// If no images were picked, the return value is null. @override Future pickImage({ required ImageSource source, @@ -42,6 +54,18 @@ class ImagePickerPlugin extends ImagePickerPlatform { return pickFile(accept: _kAcceptImageMimeType, capture: capture); } + /// Returns a [PickedFile] containing the video that was picked. + /// + /// The [source] argument controls where the video comes from. This can + /// be either [ImageSource.camera] or [ImageSource.gallery]. + /// + /// Note that the `maxDuration` argument is not supported on the web. + /// + /// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera]. + /// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device. + /// Defaults to [CameraDevice.rear]. + /// + /// If no images were picked, the return value is null. @override Future pickVideo({ required ImageSource source, From 4c368471219dff177b405e83e46aa6bb38c92025 Mon Sep 17 00:00:00 2001 From: Jens Becker Date: Mon, 15 Feb 2021 16:07:30 +0100 Subject: [PATCH 2/7] Update pubspec.yaml and CHANGELOG.md --- packages/image_picker/image_picker_for_web/CHANGELOG.md | 4 ++++ packages/image_picker/image_picker_for_web/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/image_picker/image_picker_for_web/CHANGELOG.md b/packages/image_picker/image_picker_for_web/CHANGELOG.md index 37b17b3eef26..ccbbd9606ecf 100644 --- a/packages/image_picker/image_picker_for_web/CHANGELOG.md +++ b/packages/image_picker/image_picker_for_web/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.0.0-nullsafety.1 + +* Add doc comments to point out that some arguments are'nt supported on the web + # 2.0.0-nullsafety * Migrate to null safety. diff --git a/packages/image_picker/image_picker_for_web/pubspec.yaml b/packages/image_picker/image_picker_for_web/pubspec.yaml index c270cd597c87..adc636192c69 100644 --- a/packages/image_picker/image_picker_for_web/pubspec.yaml +++ b/packages/image_picker/image_picker_for_web/pubspec.yaml @@ -2,7 +2,7 @@ name: image_picker_for_web description: Web platform implementation of image_picker homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker/image_picker_for_web -version: 2.0.0-nullsafety +version: 2.0.0-nullsafety.1 flutter: plugin: From 4d8b267d013f2294db62b1491dcb2c08ff8b6f9f Mon Sep 17 00:00:00 2001 From: Jens Becker Date: Thu, 18 Feb 2021 11:52:01 +0100 Subject: [PATCH 3/7] Add limitation note to README.md --- packages/image_picker/image_picker_for_web/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/image_picker/image_picker_for_web/README.md b/packages/image_picker/image_picker_for_web/README.md index 81452e290984..074053c9b956 100644 --- a/packages/image_picker/image_picker_for_web/README.md +++ b/packages/image_picker/image_picker_for_web/README.md @@ -2,7 +2,7 @@ A web implementation of [`image_picker`][1]. -## Browser Support +## Limitations on the web platform Since Web Browsers don't offer direct access to their users' file system, 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 Each browser may implement `capture` any way they please, so it may (or may not) make a difference in your users' experience. +### pickImage() +The arguments `maxWidth`, `maxHeight` and `imageQuality` are not supported on the web. + +### pickVideo() +The argument `maxDuration` is not supported on the web. + ## Usage ### Import the package From 61c9b087069918784e17756244c7689e96e83246 Mon Sep 17 00:00:00 2001 From: David Iglesias Date: Thu, 18 Feb 2021 14:33:01 -0800 Subject: [PATCH 4/7] Update packages/image_picker/image_picker_for_web/CHANGELOG.md --- packages/image_picker/image_picker_for_web/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/image_picker/image_picker_for_web/CHANGELOG.md b/packages/image_picker/image_picker_for_web/CHANGELOG.md index ccbbd9606ecf..98654b252957 100644 --- a/packages/image_picker/image_picker_for_web/CHANGELOG.md +++ b/packages/image_picker/image_picker_for_web/CHANGELOG.md @@ -1,6 +1,6 @@ # 2.0.0-nullsafety.1 -* Add doc comments to point out that some arguments are'nt supported on the web +* Add doc comments to point out that some arguments aren't supported on the web # 2.0.0-nullsafety From 85b0bb39319cb54336b240ce0c47b59fc0be79ec Mon Sep 17 00:00:00 2001 From: David Iglesias Date: Thu, 18 Feb 2021 18:40:44 -0800 Subject: [PATCH 5/7] Update packages/image_picker/image_picker_for_web/CHANGELOG.md Co-authored-by: Chris Yang --- packages/image_picker/image_picker_for_web/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/image_picker/image_picker_for_web/CHANGELOG.md b/packages/image_picker/image_picker_for_web/CHANGELOG.md index 98654b252957..fcc6c9980c29 100644 --- a/packages/image_picker/image_picker_for_web/CHANGELOG.md +++ b/packages/image_picker/image_picker_for_web/CHANGELOG.md @@ -1,6 +1,6 @@ # 2.0.0-nullsafety.1 -* Add doc comments to point out that some arguments aren't supported on the web +* Add doc comments to point out that some arguments aren't supported on the web. # 2.0.0-nullsafety From 27ceba38322d1b500eb0d8b9e7e51b41d0a20694 Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Thu, 18 Feb 2021 18:49:03 -0800 Subject: [PATCH 6/7] Address review comments. --- .../image_picker_for_web/lib/image_picker_for_web.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart b/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart index 4ab9f719cad7..ce52aad6e5da 100644 --- a/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart +++ b/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart @@ -35,7 +35,7 @@ class ImagePickerPlugin extends ImagePickerPlatform { /// The `source` argument controls where the image comes from. This can /// be either [ImageSource.camera] or [ImageSource.gallery]. /// - /// Note that the `maxWidth`, `maxHeight` and `imageQuality` arguments are not supported on the web. + /// 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. /// /// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera]. /// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device. @@ -59,7 +59,7 @@ class ImagePickerPlugin extends ImagePickerPlatform { /// The [source] argument controls where the video comes from. This can /// be either [ImageSource.camera] or [ImageSource.gallery]. /// - /// Note that the `maxDuration` argument is not supported on the web. + /// 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. /// /// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera]. /// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device. From 54c536a560314f4bba82514b227b4e46b9b4ad85 Mon Sep 17 00:00:00 2001 From: David Iglesias Teixeira Date: Fri, 19 Feb 2021 00:34:18 -0800 Subject: [PATCH 7/7] dartfmt -w . --- .../image_picker_for_web/lib/image_picker_for_web.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart b/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart index ce52aad6e5da..05afd2e54a4c 100644 --- a/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart +++ b/packages/image_picker/image_picker_for_web/lib/image_picker_for_web.dart @@ -35,7 +35,7 @@ class ImagePickerPlugin extends ImagePickerPlatform { /// The `source` argument controls where the image comes from. This can /// be either [ImageSource.camera] or [ImageSource.gallery]. /// - /// 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. + /// 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. /// /// Use `preferredCameraDevice` to specify the camera to use when the `source` is [ImageSource.camera]. /// The `preferredCameraDevice` is ignored when `source` is [ImageSource.gallery]. It is also ignored if the chosen camera is not supported on the device.