From df270926edfecd37c0b0bb262bbf3446a6e80214 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Fri, 9 Jul 2021 18:15:00 +0200 Subject: [PATCH 01/20] feat: add camera_web plugin --- packages/camera/camera_web/CHANGELOG.md | 3 + packages/camera/camera_web/LICENSE | 25 +++ packages/camera/camera_web/README.md | 5 + .../camera/camera_web/lib/camera_web.dart | 193 ++++++++++++++++++ packages/camera/camera_web/pubspec.yaml | 29 +++ 5 files changed, 255 insertions(+) create mode 100644 packages/camera/camera_web/CHANGELOG.md create mode 100644 packages/camera/camera_web/LICENSE create mode 100644 packages/camera/camera_web/README.md create mode 100644 packages/camera/camera_web/lib/camera_web.dart create mode 100644 packages/camera/camera_web/pubspec.yaml diff --git a/packages/camera/camera_web/CHANGELOG.md b/packages/camera/camera_web/CHANGELOG.md new file mode 100644 index 000000000000..29f648fd17f1 --- /dev/null +++ b/packages/camera/camera_web/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* Initial release diff --git a/packages/camera/camera_web/LICENSE b/packages/camera/camera_web/LICENSE new file mode 100644 index 000000000000..c6823b81eb84 --- /dev/null +++ b/packages/camera/camera_web/LICENSE @@ -0,0 +1,25 @@ +Copyright 2013 The Flutter Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/camera/camera_web/README.md b/packages/camera/camera_web/README.md new file mode 100644 index 000000000000..e8a797110d7d --- /dev/null +++ b/packages/camera/camera_web/README.md @@ -0,0 +1,5 @@ +# Camera Web Plugin + +A Flutter plugin for Web allowing access to the device cameras. + +*Note*: This plugin is under development. \ No newline at end of file diff --git a/packages/camera/camera_web/lib/camera_web.dart b/packages/camera/camera_web/lib/camera_web.dart new file mode 100644 index 000000000000..fc3be09eec1d --- /dev/null +++ b/packages/camera/camera_web/lib/camera_web.dart @@ -0,0 +1,193 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:async'; +import 'dart:html' as html; +import 'dart:math'; + +import 'package:camera_platform_interface/camera_platform_interface.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; + +/// The web implementation of [CameraPlatform]. +/// +/// This class implements the `package:camera` functionality for the web. +class CameraPlugin extends CameraPlatform { + /// Registers this class as the default instance of [CameraPlatform]. + static void registerWith(Registrar registrar) { + CameraPlatform.instance = CameraPlugin(); + } + + /// The current browser window used to access device cameras. + @visibleForTesting + html.Window? window; + + @override + Future> availableCameras() { + throw UnimplementedError('availableCameras() is not implemented.'); + } + + @override + Future createCamera( + CameraDescription cameraDescription, + ResolutionPreset? resolutionPreset, { + bool enableAudio = false, + }) { + throw UnimplementedError('createCamera() is not implemented.'); + } + + @override + Future initializeCamera( + int cameraId, { + ImageFormatGroup imageFormatGroup = ImageFormatGroup.unknown, + }) { + throw UnimplementedError('initializeCamera() is not implemented.'); + } + + @override + Stream onCameraInitialized(int cameraId) { + throw UnimplementedError('onCameraInitialized() is not implemented.'); + } + + @override + Stream onCameraResolutionChanged(int cameraId) { + throw UnimplementedError('onCameraResolutionChanged() is not implemented.'); + } + + @override + Stream onCameraClosing(int cameraId) { + throw UnimplementedError('onCameraClosing() is not implemented.'); + } + + @override + Stream onCameraError(int cameraId) { + throw UnimplementedError('onCameraError() is not implemented.'); + } + + @override + Stream onVideoRecordedEvent(int cameraId) { + throw UnimplementedError('onVideoRecordedEvent() is not implemented.'); + } + + @override + Stream onDeviceOrientationChanged() { + throw UnimplementedError( + 'onDeviceOrientationChanged() is not implemented.', + ); + } + + @override + Future lockCaptureOrientation( + int cameraId, + DeviceOrientation orientation, + ) { + throw UnimplementedError('lockCaptureOrientation() is not implemented.'); + } + + @override + Future unlockCaptureOrientation(int cameraId) { + throw UnimplementedError('unlockCaptureOrientation() is not implemented.'); + } + + @override + Future takePicture(int cameraId) { + throw UnimplementedError('takePicture() is not implemented.'); + } + + @override + Future prepareForVideoRecording() { + throw UnimplementedError('prepareForVideoRecording() is not implemented.'); + } + + @override + Future startVideoRecording(int cameraId, {Duration? maxVideoDuration}) { + throw UnimplementedError('startVideoRecording() is not implemented.'); + } + + @override + Future stopVideoRecording(int cameraId) { + throw UnimplementedError('stopVideoRecording() is not implemented.'); + } + + @override + Future pauseVideoRecording(int cameraId) { + throw UnimplementedError('pauseVideoRecording() is not implemented.'); + } + + @override + Future resumeVideoRecording(int cameraId) { + throw UnimplementedError('resumeVideoRecording() is not implemented.'); + } + + @override + Future setFlashMode(int cameraId, FlashMode mode) { + throw UnimplementedError('setFlashMode() is not implemented.'); + } + + @override + Future setExposureMode(int cameraId, ExposureMode mode) { + throw UnimplementedError('setExposureMode() is not implemented.'); + } + + @override + Future setExposurePoint(int cameraId, Point? point) { + throw UnimplementedError('setExposurePoint() is not implemented.'); + } + + @override + Future getMinExposureOffset(int cameraId) { + throw UnimplementedError('getMinExposureOffset() is not implemented.'); + } + + @override + Future getMaxExposureOffset(int cameraId) { + throw UnimplementedError('getMaxExposureOffset() is not implemented.'); + } + + @override + Future getExposureOffsetStepSize(int cameraId) { + throw UnimplementedError('getExposureOffsetStepSize() is not implemented.'); + } + + @override + Future setExposureOffset(int cameraId, double offset) { + throw UnimplementedError('setExposureOffset() is not implemented.'); + } + + @override + Future setFocusMode(int cameraId, FocusMode mode) { + throw UnimplementedError('setFocusMode() is not implemented.'); + } + + @override + Future setFocusPoint(int cameraId, Point? point) { + throw UnimplementedError('setFocusPoint() is not implemented.'); + } + + @override + Future getMaxZoomLevel(int cameraId) { + throw UnimplementedError('getMaxZoomLevel() is not implemented.'); + } + + @override + Future getMinZoomLevel(int cameraId) { + throw UnimplementedError('getMinZoomLevel() is not implemented.'); + } + + @override + Future setZoomLevel(int cameraId, double zoom) { + throw UnimplementedError('setZoomLevel() is not implemented.'); + } + + @override + Widget buildPreview(int cameraId) { + throw UnimplementedError('buildPreview() is not implemented.'); + } + + @override + Future dispose(int cameraId) { + throw UnimplementedError('dispose() is not implemented.'); + } +} diff --git a/packages/camera/camera_web/pubspec.yaml b/packages/camera/camera_web/pubspec.yaml new file mode 100644 index 000000000000..df7409421edf --- /dev/null +++ b/packages/camera/camera_web/pubspec.yaml @@ -0,0 +1,29 @@ +name: camera_web +description: A Flutter plugin for getting information about and controlling the camera on Web. +repository: https://github.com/flutter/plugins/tree/master/packages/camera/camera_web +issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 +version: 0.0.1 + +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" + +flutter: + plugin: + platforms: + web: + pluginClass: CameraPlugin + fileName: camera_web.dart + +dependencies: + camera_platform_interface: ^2.0.1 + flutter: + sdk: flutter + flutter_web_plugins: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter + mocktail: ^0.1.4 + pedantic: ^1.11.1 \ No newline at end of file From 552fd62c53e98ac5e7d96491c9f7339e43c47d85 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Fri, 9 Jul 2021 18:15:22 +0200 Subject: [PATCH 02/20] test: add camera_web integration tests --- packages/camera/camera_web/example/README.md | 21 ++ packages/camera/camera_web/example/build.yaml | 6 + .../integration_test/camera_web_test.dart | 297 ++++++++++++++++++ .../integration_test/helpers/helpers.dart | 5 + .../integration_test/helpers/mocks.dart | 23 ++ .../camera/camera_web/example/lib/main.dart | 25 ++ .../camera/camera_web/example/pubspec.yaml | 22 ++ .../camera/camera_web/example/run_test.sh | 22 ++ .../example/test_driver/integration_test.dart | 7 + .../camera/camera_web/example/web/index.html | 12 + packages/camera/camera_web/test/README.md | 5 + .../test/tests_exist_elsewhere_test.dart | 14 + 12 files changed, 459 insertions(+) create mode 100644 packages/camera/camera_web/example/README.md create mode 100644 packages/camera/camera_web/example/build.yaml create mode 100644 packages/camera/camera_web/example/integration_test/camera_web_test.dart create mode 100644 packages/camera/camera_web/example/integration_test/helpers/helpers.dart create mode 100644 packages/camera/camera_web/example/integration_test/helpers/mocks.dart create mode 100644 packages/camera/camera_web/example/lib/main.dart create mode 100644 packages/camera/camera_web/example/pubspec.yaml create mode 100755 packages/camera/camera_web/example/run_test.sh create mode 100644 packages/camera/camera_web/example/test_driver/integration_test.dart create mode 100644 packages/camera/camera_web/example/web/index.html create mode 100644 packages/camera/camera_web/test/README.md create mode 100644 packages/camera/camera_web/test/tests_exist_elsewhere_test.dart diff --git a/packages/camera/camera_web/example/README.md b/packages/camera/camera_web/example/README.md new file mode 100644 index 000000000000..4bc087e4cbc6 --- /dev/null +++ b/packages/camera/camera_web/example/README.md @@ -0,0 +1,21 @@ +# Testing + +This package utilizes the `integration_test` package to run its tests in a web browser. + +See [flutter.dev > Integration testing](https://flutter.dev/docs/testing/integration-tests) for more info. + +## Running the tests + +Make sure you have updated to the latest Flutter master. + +1. Check what version of Chrome is running on the machine you're running tests on. + +2. Download and install driver for that version from here: + * + +3. Start the driver using `chromedriver --port=4444` + +4. Run tests: `flutter drive -d web-server --browser-name=chrome --driver=test_driver/integration_test_driver.dart --target=integration_test/TEST_NAME.dart`, or (in Linux): + + * Single: `./run_test.sh integration_test/TEST_NAME.dart` + * All: `./run_test.sh` \ No newline at end of file diff --git a/packages/camera/camera_web/example/build.yaml b/packages/camera/camera_web/example/build.yaml new file mode 100644 index 000000000000..db3104bb04c6 --- /dev/null +++ b/packages/camera/camera_web/example/build.yaml @@ -0,0 +1,6 @@ +targets: + $default: + sources: + - integration_test/*.dart + - lib/$lib$ + - $package$ diff --git a/packages/camera/camera_web/example/integration_test/camera_web_test.dart b/packages/camera/camera_web/example/integration_test/camera_web_test.dart new file mode 100644 index 000000000000..5d840a338eea --- /dev/null +++ b/packages/camera/camera_web/example/integration_test/camera_web_test.dart @@ -0,0 +1,297 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:html'; + +import 'package:camera_platform_interface/camera_platform_interface.dart'; +import 'package:camera_web/camera_web.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; + +import 'helpers/helpers.dart'; + +void main() { + group('CameraPlugin', () { + const cameraId = 0; + + late Window window; + late Navigator navigator; + late MediaDevices mediaDevices; + late VideoElement videoElement; + + setUp(() async { + window = MockWindow(); + navigator = MockNavigator(); + mediaDevices = MockMediaDevices(); + videoElement = VideoElement() + ..src = 'https://www.w3schools.com/tags/mov_bbb.mp4' + ..preload = 'true' + ..width = 10 + ..height = 10; + + when(() => window.navigator).thenReturn(navigator); + when(() => navigator.mediaDevices).thenReturn(mediaDevices); + when( + () => mediaDevices.getUserMedia(any()), + ).thenAnswer((_) async => videoElement.captureStream()); + + CameraPlatform.instance = CameraPlugin()..window = window; + }); + + testWidgets('CameraPlugin is the live instance', (tester) async { + expect(CameraPlatform.instance, isA()); + }); + + test('availableCameras throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.availableCameras(), + throwsUnimplementedError, + ); + }); + + test('createCamera throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.createCamera( + CameraDescription( + name: 'name', + lensDirection: CameraLensDirection.external, + sensorOrientation: 0, + ), + ResolutionPreset.medium, + ), + throwsUnimplementedError, + ); + }); + + test('initializeCamera throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.initializeCamera(cameraId), + throwsUnimplementedError, + ); + }); + + test('lockCaptureOrientation throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.lockCaptureOrientation( + cameraId, + DeviceOrientation.landscapeLeft, + ), + throwsUnimplementedError, + ); + }); + + test('unlockCaptureOrientation throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.unlockCaptureOrientation(cameraId), + throwsUnimplementedError, + ); + }); + + test('takePicture throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.takePicture(cameraId), + throwsUnimplementedError, + ); + }); + + test('prepareForVideoRecording throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.prepareForVideoRecording(), + throwsUnimplementedError, + ); + }); + + test('startVideoRecording throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.startVideoRecording(cameraId), + throwsUnimplementedError, + ); + }); + + test('stopVideoRecording throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.stopVideoRecording(cameraId), + throwsUnimplementedError, + ); + }); + + test('pauseVideoRecording throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.pauseVideoRecording(cameraId), + throwsUnimplementedError, + ); + }); + + test('resumeVideoRecording throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.resumeVideoRecording(cameraId), + throwsUnimplementedError, + ); + }); + + test('setFlashMode throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.setFlashMode( + cameraId, + FlashMode.auto, + ), + throwsUnimplementedError, + ); + }); + + test('setExposureMode throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.setExposureMode( + cameraId, + ExposureMode.auto, + ), + throwsUnimplementedError, + ); + }); + + test('setExposurePoint throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.setExposurePoint( + cameraId, + const Point(0, 0), + ), + throwsUnimplementedError, + ); + }); + + test('getMinExposureOffset throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.getMinExposureOffset(cameraId), + throwsUnimplementedError, + ); + }); + + test('getMaxExposureOffset throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.getMaxExposureOffset(cameraId), + throwsUnimplementedError, + ); + }); + + test('getExposureOffsetStepSize throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.getExposureOffsetStepSize(cameraId), + throwsUnimplementedError, + ); + }); + + test('setExposureOffset throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.setExposureOffset( + cameraId, + 0, + ), + throwsUnimplementedError, + ); + }); + + test('setFocusMode throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.setFocusMode( + cameraId, + FocusMode.auto, + ), + throwsUnimplementedError, + ); + }); + + test('setFocusPoint throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.setFocusPoint( + cameraId, + const Point(0, 0), + ), + throwsUnimplementedError, + ); + }); + + test('getMaxZoomLevel throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.getMaxZoomLevel(cameraId), + throwsUnimplementedError, + ); + }); + + test('getMinZoomLevel throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.getMinZoomLevel(cameraId), + throwsUnimplementedError, + ); + }); + + test('setZoomLevel throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.setZoomLevel( + cameraId, + 1.0, + ), + throwsUnimplementedError, + ); + }); + + test('buildPreview throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.buildPreview(cameraId), + throwsUnimplementedError, + ); + }); + + test('dispose throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.dispose(cameraId), + throwsUnimplementedError, + ); + }); + + group('events', () { + test('onCameraInitialized throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.onCameraInitialized(cameraId), + throwsUnimplementedError, + ); + }); + + test('onCameraResolutionChanged throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.onCameraResolutionChanged(cameraId), + throwsUnimplementedError, + ); + }); + + test('onCameraClosing throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.onCameraClosing(cameraId), + throwsUnimplementedError, + ); + }); + + test('onCameraError throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.onCameraError(cameraId), + throwsUnimplementedError, + ); + }); + + test('onVideoRecordedEvent throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.onVideoRecordedEvent(cameraId), + throwsUnimplementedError, + ); + }); + + test('onDeviceOrientationChanged throws UnimplementedError', () { + expect( + () => CameraPlatform.instance.onDeviceOrientationChanged(), + throwsUnimplementedError, + ); + }); + }); + }); +} diff --git a/packages/camera/camera_web/example/integration_test/helpers/helpers.dart b/packages/camera/camera_web/example/integration_test/helpers/helpers.dart new file mode 100644 index 000000000000..7094f55bb62e --- /dev/null +++ b/packages/camera/camera_web/example/integration_test/helpers/helpers.dart @@ -0,0 +1,5 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export 'mocks.dart'; diff --git a/packages/camera/camera_web/example/integration_test/helpers/mocks.dart b/packages/camera/camera_web/example/integration_test/helpers/mocks.dart new file mode 100644 index 000000000000..03be3f0b3ca6 --- /dev/null +++ b/packages/camera/camera_web/example/integration_test/helpers/mocks.dart @@ -0,0 +1,23 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:html'; + +import 'package:mocktail/mocktail.dart'; + +class MockWindow extends Mock implements Window {} + +class MockNavigator extends Mock implements Navigator {} + +class MockMediaDevices extends Mock implements MediaDevices {} + +/// A fake [DomException] that returns the provided [errorName]. +class FakeDomException extends Fake implements DomException { + FakeDomException(this.errorName); + + final String errorName; + + @override + String get name => errorName; +} diff --git a/packages/camera/camera_web/example/lib/main.dart b/packages/camera/camera_web/example/lib/main.dart new file mode 100644 index 000000000000..e1a38dcdcd46 --- /dev/null +++ b/packages/camera/camera_web/example/lib/main.dart @@ -0,0 +1,25 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/material.dart'; + +void main() { + runApp(MyApp()); +} + +/// App for testing +class MyApp extends StatefulWidget { + @override + _MyAppState createState() => _MyAppState(); +} + +class _MyAppState extends State { + @override + Widget build(BuildContext context) { + return Directionality( + textDirection: TextDirection.ltr, + child: Text('Testing... Look at the console output for results!'), + ); + } +} diff --git a/packages/camera/camera_web/example/pubspec.yaml b/packages/camera/camera_web/example/pubspec.yaml new file mode 100644 index 000000000000..a2eeb9262698 --- /dev/null +++ b/packages/camera/camera_web/example/pubspec.yaml @@ -0,0 +1,22 @@ +name: regular_integration_tests +publish_to: none + +environment: + sdk: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" + +dependencies: + flutter: + sdk: flutter + +dev_dependencies: + build_runner: ^1.10.0 + mocktail: ^0.1.4 + camera_web: + path: ../ + flutter_driver: + sdk: flutter + flutter_test: + sdk: flutter + integration_test: + sdk: flutter diff --git a/packages/camera/camera_web/example/run_test.sh b/packages/camera/camera_web/example/run_test.sh new file mode 100755 index 000000000000..00482faa53df --- /dev/null +++ b/packages/camera/camera_web/example/run_test.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Copyright 2013 The Flutter Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +if pgrep -lf chromedriver > /dev/null; then + echo "chromedriver is running." + + if [ $# -eq 0 ]; then + echo "No target specified, running all tests..." + find integration_test/ -iname *_test.dart | xargs -n1 -I{} -t flutter drive -d web-server --web-port=7357 --browser-name=chrome --driver=test_driver/integration_test.dart --target='{}' + else + echo "Running test target: $1..." + set -x + flutter drive -d web-server --web-port=7357 --browser-name=chrome --driver=test_driver/integration_test.dart --target=$1 + fi + + else + echo "chromedriver is not running." + echo "Please, check the README.md for instructions on how to use run_test.sh" +fi + diff --git a/packages/camera/camera_web/example/test_driver/integration_test.dart b/packages/camera/camera_web/example/test_driver/integration_test.dart new file mode 100644 index 000000000000..4f10f2a522f3 --- /dev/null +++ b/packages/camera/camera_web/example/test_driver/integration_test.dart @@ -0,0 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:integration_test/integration_test_driver.dart'; + +Future main() => integrationDriver(); diff --git a/packages/camera/camera_web/example/web/index.html b/packages/camera/camera_web/example/web/index.html new file mode 100644 index 000000000000..dc9f89762aec --- /dev/null +++ b/packages/camera/camera_web/example/web/index.html @@ -0,0 +1,12 @@ + + + + + Browser Tests + + + + + diff --git a/packages/camera/camera_web/test/README.md b/packages/camera/camera_web/test/README.md new file mode 100644 index 000000000000..7c5b4ad682ba --- /dev/null +++ b/packages/camera/camera_web/test/README.md @@ -0,0 +1,5 @@ +## test + +This package uses integration tests for testing. + +See `example/README.md` for more info. diff --git a/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart b/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart new file mode 100644 index 000000000000..442c50144727 --- /dev/null +++ b/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart @@ -0,0 +1,14 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + test('Tell the user where to find the real tests', () { + print('---'); + print('This package uses integration_test for its tests.'); + print('See `example/README.md` for more info.'); + print('---'); + }); +} From 557b2788e25e34e479cae6d8952762d13b4c470c Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Mon, 12 Jul 2021 10:25:39 +0200 Subject: [PATCH 03/20] chore: rename camera_web integration tests name in pubspec --- packages/camera/camera_web/example/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_web/example/pubspec.yaml b/packages/camera/camera_web/example/pubspec.yaml index a2eeb9262698..36a28277bf3d 100644 --- a/packages/camera/camera_web/example/pubspec.yaml +++ b/packages/camera/camera_web/example/pubspec.yaml @@ -1,4 +1,4 @@ -name: regular_integration_tests +name: camera_web_integration_tests publish_to: none environment: From e8267b37e75174921bff4395ff4454a7600d937d Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Mon, 12 Jul 2021 11:59:30 +0200 Subject: [PATCH 04/20] chore: migrate camera_web tests to integration tests --- .../integration_test/camera_web_test.dart | 78 +++++++++++-------- 1 file changed, 47 insertions(+), 31 deletions(-) diff --git a/packages/camera/camera_web/example/integration_test/camera_web_test.dart b/packages/camera/camera_web/example/integration_test/camera_web_test.dart index 5d840a338eea..0eea3100e9ed 100644 --- a/packages/camera/camera_web/example/integration_test/camera_web_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_web_test.dart @@ -8,11 +8,14 @@ import 'package:camera_platform_interface/camera_platform_interface.dart'; import 'package:camera_web/camera_web.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:integration_test/integration_test.dart'; import 'package:mocktail/mocktail.dart'; import 'helpers/helpers.dart'; void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + group('CameraPlugin', () { const cameraId = 0; @@ -44,14 +47,14 @@ void main() { expect(CameraPlatform.instance, isA()); }); - test('availableCameras throws UnimplementedError', () { + testWidgets('availableCameras throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.availableCameras(), throwsUnimplementedError, ); }); - test('createCamera throws UnimplementedError', () { + testWidgets('createCamera throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.createCamera( CameraDescription( @@ -65,14 +68,15 @@ void main() { ); }); - test('initializeCamera throws UnimplementedError', () { + testWidgets('initializeCamera throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.initializeCamera(cameraId), throwsUnimplementedError, ); }); - test('lockCaptureOrientation throws UnimplementedError', () { + testWidgets('lockCaptureOrientation throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.lockCaptureOrientation( cameraId, @@ -82,56 +86,61 @@ void main() { ); }); - test('unlockCaptureOrientation throws UnimplementedError', () { + testWidgets('unlockCaptureOrientation throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.unlockCaptureOrientation(cameraId), throwsUnimplementedError, ); }); - test('takePicture throws UnimplementedError', () { + testWidgets('takePicture throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.takePicture(cameraId), throwsUnimplementedError, ); }); - test('prepareForVideoRecording throws UnimplementedError', () { + testWidgets('prepareForVideoRecording throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.prepareForVideoRecording(), throwsUnimplementedError, ); }); - test('startVideoRecording throws UnimplementedError', () { + testWidgets('startVideoRecording throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.startVideoRecording(cameraId), throwsUnimplementedError, ); }); - test('stopVideoRecording throws UnimplementedError', () { + testWidgets('stopVideoRecording throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.stopVideoRecording(cameraId), throwsUnimplementedError, ); }); - test('pauseVideoRecording throws UnimplementedError', () { + testWidgets('pauseVideoRecording throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.pauseVideoRecording(cameraId), throwsUnimplementedError, ); }); - test('resumeVideoRecording throws UnimplementedError', () { + testWidgets('resumeVideoRecording throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.resumeVideoRecording(cameraId), throwsUnimplementedError, ); }); - test('setFlashMode throws UnimplementedError', () { + testWidgets('setFlashMode throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.setFlashMode( cameraId, @@ -141,7 +150,7 @@ void main() { ); }); - test('setExposureMode throws UnimplementedError', () { + testWidgets('setExposureMode throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.setExposureMode( cameraId, @@ -151,7 +160,7 @@ void main() { ); }); - test('setExposurePoint throws UnimplementedError', () { + testWidgets('setExposurePoint throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.setExposurePoint( cameraId, @@ -161,28 +170,31 @@ void main() { ); }); - test('getMinExposureOffset throws UnimplementedError', () { + testWidgets('getMinExposureOffset throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.getMinExposureOffset(cameraId), throwsUnimplementedError, ); }); - test('getMaxExposureOffset throws UnimplementedError', () { + testWidgets('getMaxExposureOffset throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.getMaxExposureOffset(cameraId), throwsUnimplementedError, ); }); - test('getExposureOffsetStepSize throws UnimplementedError', () { + testWidgets('getExposureOffsetStepSize throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.getExposureOffsetStepSize(cameraId), throwsUnimplementedError, ); }); - test('setExposureOffset throws UnimplementedError', () { + testWidgets('setExposureOffset throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.setExposureOffset( cameraId, @@ -192,7 +204,7 @@ void main() { ); }); - test('setFocusMode throws UnimplementedError', () { + testWidgets('setFocusMode throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.setFocusMode( cameraId, @@ -202,7 +214,7 @@ void main() { ); }); - test('setFocusPoint throws UnimplementedError', () { + testWidgets('setFocusPoint throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.setFocusPoint( cameraId, @@ -212,21 +224,21 @@ void main() { ); }); - test('getMaxZoomLevel throws UnimplementedError', () { + testWidgets('getMaxZoomLevel throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.getMaxZoomLevel(cameraId), throwsUnimplementedError, ); }); - test('getMinZoomLevel throws UnimplementedError', () { + testWidgets('getMinZoomLevel throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.getMinZoomLevel(cameraId), throwsUnimplementedError, ); }); - test('setZoomLevel throws UnimplementedError', () { + testWidgets('setZoomLevel throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.setZoomLevel( cameraId, @@ -236,14 +248,14 @@ void main() { ); }); - test('buildPreview throws UnimplementedError', () { + testWidgets('buildPreview throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.buildPreview(cameraId), throwsUnimplementedError, ); }); - test('dispose throws UnimplementedError', () { + testWidgets('dispose throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.dispose(cameraId), throwsUnimplementedError, @@ -251,42 +263,46 @@ void main() { }); group('events', () { - test('onCameraInitialized throws UnimplementedError', () { + testWidgets('onCameraInitialized throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.onCameraInitialized(cameraId), throwsUnimplementedError, ); }); - test('onCameraResolutionChanged throws UnimplementedError', () { + testWidgets('onCameraResolutionChanged throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.onCameraResolutionChanged(cameraId), throwsUnimplementedError, ); }); - test('onCameraClosing throws UnimplementedError', () { + testWidgets('onCameraClosing throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.onCameraClosing(cameraId), throwsUnimplementedError, ); }); - test('onCameraError throws UnimplementedError', () { + testWidgets('onCameraError throws UnimplementedError', (tester) async { expect( () => CameraPlatform.instance.onCameraError(cameraId), throwsUnimplementedError, ); }); - test('onVideoRecordedEvent throws UnimplementedError', () { + testWidgets('onVideoRecordedEvent throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.onVideoRecordedEvent(cameraId), throwsUnimplementedError, ); }); - test('onDeviceOrientationChanged throws UnimplementedError', () { + testWidgets('onDeviceOrientationChanged throws UnimplementedError', + (tester) async { expect( () => CameraPlatform.instance.onDeviceOrientationChanged(), throwsUnimplementedError, From adc01771e0b3a7df2ac9f7047272fc8f508d02a1 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 12:17:25 +0200 Subject: [PATCH 05/20] Update packages/camera/camera_web/example/web/index.html Co-authored-by: Felix Angelov --- packages/camera/camera_web/example/web/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_web/example/web/index.html b/packages/camera/camera_web/example/web/index.html index dc9f89762aec..f3c6a5e8a8e3 100644 --- a/packages/camera/camera_web/example/web/index.html +++ b/packages/camera/camera_web/example/web/index.html @@ -1,4 +1,4 @@ - + From 9fdeafd99610c364ca2b394ff5f3ba02cbd09766 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 12:01:02 +0200 Subject: [PATCH 06/20] chore: bump initial version to 0.1.0 --- packages/camera/camera_web/CHANGELOG.md | 2 +- packages/camera/camera_web/pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/camera/camera_web/CHANGELOG.md b/packages/camera/camera_web/CHANGELOG.md index 29f648fd17f1..1318780830f8 100644 --- a/packages/camera/camera_web/CHANGELOG.md +++ b/packages/camera/camera_web/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.0.1 +## 0.1.0 * Initial release diff --git a/packages/camera/camera_web/pubspec.yaml b/packages/camera/camera_web/pubspec.yaml index df7409421edf..3a26695001de 100644 --- a/packages/camera/camera_web/pubspec.yaml +++ b/packages/camera/camera_web/pubspec.yaml @@ -2,7 +2,7 @@ name: camera_web description: A Flutter plugin for getting information about and controlling the camera on Web. repository: https://github.com/flutter/plugins/tree/master/packages/camera/camera_web issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 -version: 0.0.1 +version: 0.1.0 environment: sdk: ">=2.12.0 <3.0.0" From 8b068770ac0f2cbf892069cfaf4fd944e03b4aed Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 12:02:42 +0200 Subject: [PATCH 07/20] docs: update integration tests readme --- packages/camera/camera_web/example/README.md | 22 +++++--------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/packages/camera/camera_web/example/README.md b/packages/camera/camera_web/example/README.md index 4bc087e4cbc6..8a6e74b107ea 100644 --- a/packages/camera/camera_web/example/README.md +++ b/packages/camera/camera_web/example/README.md @@ -1,21 +1,9 @@ # Testing -This package utilizes the `integration_test` package to run its tests in a web browser. +This package uses `package:integration_test` to run its tests in a web browser. -See [flutter.dev > Integration testing](https://flutter.dev/docs/testing/integration-tests) for more info. +See [Plugin Tests > Web Tests](https://github.com/flutter/flutter/wiki/Plugin-Tests#web-tests) +in the Flutter wiki for instructions to setup and run the tests in this package. -## Running the tests - -Make sure you have updated to the latest Flutter master. - -1. Check what version of Chrome is running on the machine you're running tests on. - -2. Download and install driver for that version from here: - * - -3. Start the driver using `chromedriver --port=4444` - -4. Run tests: `flutter drive -d web-server --browser-name=chrome --driver=test_driver/integration_test_driver.dart --target=integration_test/TEST_NAME.dart`, or (in Linux): - - * Single: `./run_test.sh integration_test/TEST_NAME.dart` - * All: `./run_test.sh` \ No newline at end of file +Check [flutter.dev > Integration testing](https://flutter.dev/docs/testing/integration-tests) +for more info. \ No newline at end of file From 9c6088b8d58cc5036cd1d059015cbcad85b6c72d Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 12:04:27 +0200 Subject: [PATCH 08/20] chore: remove unnecessary build.yaml used for mockito --- packages/camera/camera_web/example/build.yaml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 packages/camera/camera_web/example/build.yaml diff --git a/packages/camera/camera_web/example/build.yaml b/packages/camera/camera_web/example/build.yaml deleted file mode 100644 index db3104bb04c6..000000000000 --- a/packages/camera/camera_web/example/build.yaml +++ /dev/null @@ -1,6 +0,0 @@ -targets: - $default: - sources: - - integration_test/*.dart - - lib/$lib$ - - $package$ From 453df181ea6f2adfd6c3be8964a2d0a41b2d756c Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 12:10:31 +0200 Subject: [PATCH 09/20] build: remove mocktail from direct dependencies of camera_web --- packages/camera/camera_web/pubspec.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/camera/camera_web/pubspec.yaml b/packages/camera/camera_web/pubspec.yaml index 3a26695001de..c8cf5591a6b7 100644 --- a/packages/camera/camera_web/pubspec.yaml +++ b/packages/camera/camera_web/pubspec.yaml @@ -25,5 +25,4 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - mocktail: ^0.1.4 pedantic: ^1.11.1 \ No newline at end of file From 7474eeb1b4712364f11e2193689836cb0523ffac Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 12:11:06 +0200 Subject: [PATCH 10/20] build: update build_runner version --- packages/camera/camera_web/example/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_web/example/pubspec.yaml b/packages/camera/camera_web/example/pubspec.yaml index 36a28277bf3d..756561c084bc 100644 --- a/packages/camera/camera_web/example/pubspec.yaml +++ b/packages/camera/camera_web/example/pubspec.yaml @@ -10,7 +10,7 @@ dependencies: sdk: flutter dev_dependencies: - build_runner: ^1.10.0 + build_runner: ^2.0.6 mocktail: ^0.1.4 camera_web: path: ../ From 22417958dd8e180dcc2bf2dec45931e4eee08bad Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 12:22:10 +0200 Subject: [PATCH 11/20] refactor: make testing MyApp a stateless widget --- packages/camera/camera_web/example/lib/main.dart | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/camera/camera_web/example/lib/main.dart b/packages/camera/camera_web/example/lib/main.dart index e1a38dcdcd46..6e8f85e74f40 100644 --- a/packages/camera/camera_web/example/lib/main.dart +++ b/packages/camera/camera_web/example/lib/main.dart @@ -4,17 +4,10 @@ import 'package:flutter/material.dart'; -void main() { - runApp(MyApp()); -} +void main() => runApp(MyApp()); /// App for testing -class MyApp extends StatefulWidget { - @override - _MyAppState createState() => _MyAppState(); -} - -class _MyAppState extends State { +class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return Directionality( From 155e08d3014431ec4b6ff2630f010fd7b93a6662 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 13:51:12 +0200 Subject: [PATCH 12/20] feat: add camera_web barrel file --- .../camera/camera_web/lib/camera_web.dart | 194 +----------------- .../camera/camera_web/lib/src/camera_web.dart | 193 +++++++++++++++++ 2 files changed, 195 insertions(+), 192 deletions(-) create mode 100644 packages/camera/camera_web/lib/src/camera_web.dart diff --git a/packages/camera/camera_web/lib/camera_web.dart b/packages/camera/camera_web/lib/camera_web.dart index fc3be09eec1d..2edc4531f6ae 100644 --- a/packages/camera/camera_web/lib/camera_web.dart +++ b/packages/camera/camera_web/lib/camera_web.dart @@ -1,193 +1,3 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. +library camera_web; -import 'dart:async'; -import 'dart:html' as html; -import 'dart:math'; - -import 'package:camera_platform_interface/camera_platform_interface.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_web_plugins/flutter_web_plugins.dart'; - -/// The web implementation of [CameraPlatform]. -/// -/// This class implements the `package:camera` functionality for the web. -class CameraPlugin extends CameraPlatform { - /// Registers this class as the default instance of [CameraPlatform]. - static void registerWith(Registrar registrar) { - CameraPlatform.instance = CameraPlugin(); - } - - /// The current browser window used to access device cameras. - @visibleForTesting - html.Window? window; - - @override - Future> availableCameras() { - throw UnimplementedError('availableCameras() is not implemented.'); - } - - @override - Future createCamera( - CameraDescription cameraDescription, - ResolutionPreset? resolutionPreset, { - bool enableAudio = false, - }) { - throw UnimplementedError('createCamera() is not implemented.'); - } - - @override - Future initializeCamera( - int cameraId, { - ImageFormatGroup imageFormatGroup = ImageFormatGroup.unknown, - }) { - throw UnimplementedError('initializeCamera() is not implemented.'); - } - - @override - Stream onCameraInitialized(int cameraId) { - throw UnimplementedError('onCameraInitialized() is not implemented.'); - } - - @override - Stream onCameraResolutionChanged(int cameraId) { - throw UnimplementedError('onCameraResolutionChanged() is not implemented.'); - } - - @override - Stream onCameraClosing(int cameraId) { - throw UnimplementedError('onCameraClosing() is not implemented.'); - } - - @override - Stream onCameraError(int cameraId) { - throw UnimplementedError('onCameraError() is not implemented.'); - } - - @override - Stream onVideoRecordedEvent(int cameraId) { - throw UnimplementedError('onVideoRecordedEvent() is not implemented.'); - } - - @override - Stream onDeviceOrientationChanged() { - throw UnimplementedError( - 'onDeviceOrientationChanged() is not implemented.', - ); - } - - @override - Future lockCaptureOrientation( - int cameraId, - DeviceOrientation orientation, - ) { - throw UnimplementedError('lockCaptureOrientation() is not implemented.'); - } - - @override - Future unlockCaptureOrientation(int cameraId) { - throw UnimplementedError('unlockCaptureOrientation() is not implemented.'); - } - - @override - Future takePicture(int cameraId) { - throw UnimplementedError('takePicture() is not implemented.'); - } - - @override - Future prepareForVideoRecording() { - throw UnimplementedError('prepareForVideoRecording() is not implemented.'); - } - - @override - Future startVideoRecording(int cameraId, {Duration? maxVideoDuration}) { - throw UnimplementedError('startVideoRecording() is not implemented.'); - } - - @override - Future stopVideoRecording(int cameraId) { - throw UnimplementedError('stopVideoRecording() is not implemented.'); - } - - @override - Future pauseVideoRecording(int cameraId) { - throw UnimplementedError('pauseVideoRecording() is not implemented.'); - } - - @override - Future resumeVideoRecording(int cameraId) { - throw UnimplementedError('resumeVideoRecording() is not implemented.'); - } - - @override - Future setFlashMode(int cameraId, FlashMode mode) { - throw UnimplementedError('setFlashMode() is not implemented.'); - } - - @override - Future setExposureMode(int cameraId, ExposureMode mode) { - throw UnimplementedError('setExposureMode() is not implemented.'); - } - - @override - Future setExposurePoint(int cameraId, Point? point) { - throw UnimplementedError('setExposurePoint() is not implemented.'); - } - - @override - Future getMinExposureOffset(int cameraId) { - throw UnimplementedError('getMinExposureOffset() is not implemented.'); - } - - @override - Future getMaxExposureOffset(int cameraId) { - throw UnimplementedError('getMaxExposureOffset() is not implemented.'); - } - - @override - Future getExposureOffsetStepSize(int cameraId) { - throw UnimplementedError('getExposureOffsetStepSize() is not implemented.'); - } - - @override - Future setExposureOffset(int cameraId, double offset) { - throw UnimplementedError('setExposureOffset() is not implemented.'); - } - - @override - Future setFocusMode(int cameraId, FocusMode mode) { - throw UnimplementedError('setFocusMode() is not implemented.'); - } - - @override - Future setFocusPoint(int cameraId, Point? point) { - throw UnimplementedError('setFocusPoint() is not implemented.'); - } - - @override - Future getMaxZoomLevel(int cameraId) { - throw UnimplementedError('getMaxZoomLevel() is not implemented.'); - } - - @override - Future getMinZoomLevel(int cameraId) { - throw UnimplementedError('getMinZoomLevel() is not implemented.'); - } - - @override - Future setZoomLevel(int cameraId, double zoom) { - throw UnimplementedError('setZoomLevel() is not implemented.'); - } - - @override - Widget buildPreview(int cameraId) { - throw UnimplementedError('buildPreview() is not implemented.'); - } - - @override - Future dispose(int cameraId) { - throw UnimplementedError('dispose() is not implemented.'); - } -} +export 'src/camera_web.dart'; diff --git a/packages/camera/camera_web/lib/src/camera_web.dart b/packages/camera/camera_web/lib/src/camera_web.dart new file mode 100644 index 000000000000..fc3be09eec1d --- /dev/null +++ b/packages/camera/camera_web/lib/src/camera_web.dart @@ -0,0 +1,193 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:async'; +import 'dart:html' as html; +import 'dart:math'; + +import 'package:camera_platform_interface/camera_platform_interface.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_web_plugins/flutter_web_plugins.dart'; + +/// The web implementation of [CameraPlatform]. +/// +/// This class implements the `package:camera` functionality for the web. +class CameraPlugin extends CameraPlatform { + /// Registers this class as the default instance of [CameraPlatform]. + static void registerWith(Registrar registrar) { + CameraPlatform.instance = CameraPlugin(); + } + + /// The current browser window used to access device cameras. + @visibleForTesting + html.Window? window; + + @override + Future> availableCameras() { + throw UnimplementedError('availableCameras() is not implemented.'); + } + + @override + Future createCamera( + CameraDescription cameraDescription, + ResolutionPreset? resolutionPreset, { + bool enableAudio = false, + }) { + throw UnimplementedError('createCamera() is not implemented.'); + } + + @override + Future initializeCamera( + int cameraId, { + ImageFormatGroup imageFormatGroup = ImageFormatGroup.unknown, + }) { + throw UnimplementedError('initializeCamera() is not implemented.'); + } + + @override + Stream onCameraInitialized(int cameraId) { + throw UnimplementedError('onCameraInitialized() is not implemented.'); + } + + @override + Stream onCameraResolutionChanged(int cameraId) { + throw UnimplementedError('onCameraResolutionChanged() is not implemented.'); + } + + @override + Stream onCameraClosing(int cameraId) { + throw UnimplementedError('onCameraClosing() is not implemented.'); + } + + @override + Stream onCameraError(int cameraId) { + throw UnimplementedError('onCameraError() is not implemented.'); + } + + @override + Stream onVideoRecordedEvent(int cameraId) { + throw UnimplementedError('onVideoRecordedEvent() is not implemented.'); + } + + @override + Stream onDeviceOrientationChanged() { + throw UnimplementedError( + 'onDeviceOrientationChanged() is not implemented.', + ); + } + + @override + Future lockCaptureOrientation( + int cameraId, + DeviceOrientation orientation, + ) { + throw UnimplementedError('lockCaptureOrientation() is not implemented.'); + } + + @override + Future unlockCaptureOrientation(int cameraId) { + throw UnimplementedError('unlockCaptureOrientation() is not implemented.'); + } + + @override + Future takePicture(int cameraId) { + throw UnimplementedError('takePicture() is not implemented.'); + } + + @override + Future prepareForVideoRecording() { + throw UnimplementedError('prepareForVideoRecording() is not implemented.'); + } + + @override + Future startVideoRecording(int cameraId, {Duration? maxVideoDuration}) { + throw UnimplementedError('startVideoRecording() is not implemented.'); + } + + @override + Future stopVideoRecording(int cameraId) { + throw UnimplementedError('stopVideoRecording() is not implemented.'); + } + + @override + Future pauseVideoRecording(int cameraId) { + throw UnimplementedError('pauseVideoRecording() is not implemented.'); + } + + @override + Future resumeVideoRecording(int cameraId) { + throw UnimplementedError('resumeVideoRecording() is not implemented.'); + } + + @override + Future setFlashMode(int cameraId, FlashMode mode) { + throw UnimplementedError('setFlashMode() is not implemented.'); + } + + @override + Future setExposureMode(int cameraId, ExposureMode mode) { + throw UnimplementedError('setExposureMode() is not implemented.'); + } + + @override + Future setExposurePoint(int cameraId, Point? point) { + throw UnimplementedError('setExposurePoint() is not implemented.'); + } + + @override + Future getMinExposureOffset(int cameraId) { + throw UnimplementedError('getMinExposureOffset() is not implemented.'); + } + + @override + Future getMaxExposureOffset(int cameraId) { + throw UnimplementedError('getMaxExposureOffset() is not implemented.'); + } + + @override + Future getExposureOffsetStepSize(int cameraId) { + throw UnimplementedError('getExposureOffsetStepSize() is not implemented.'); + } + + @override + Future setExposureOffset(int cameraId, double offset) { + throw UnimplementedError('setExposureOffset() is not implemented.'); + } + + @override + Future setFocusMode(int cameraId, FocusMode mode) { + throw UnimplementedError('setFocusMode() is not implemented.'); + } + + @override + Future setFocusPoint(int cameraId, Point? point) { + throw UnimplementedError('setFocusPoint() is not implemented.'); + } + + @override + Future getMaxZoomLevel(int cameraId) { + throw UnimplementedError('getMaxZoomLevel() is not implemented.'); + } + + @override + Future getMinZoomLevel(int cameraId) { + throw UnimplementedError('getMinZoomLevel() is not implemented.'); + } + + @override + Future setZoomLevel(int cameraId, double zoom) { + throw UnimplementedError('setZoomLevel() is not implemented.'); + } + + @override + Widget buildPreview(int cameraId) { + throw UnimplementedError('buildPreview() is not implemented.'); + } + + @override + Future dispose(int cameraId) { + throw UnimplementedError('dispose() is not implemented.'); + } +} From 17050458582c59526c9648aa875b57aeadb92de4 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 16:00:10 +0200 Subject: [PATCH 13/20] docs: update copyright 2013 to 2021 --- packages/camera/camera_web/LICENSE | 2 +- .../camera_web/example/integration_test/camera_web_test.dart | 2 +- .../camera_web/example/integration_test/helpers/helpers.dart | 2 +- .../camera_web/example/integration_test/helpers/mocks.dart | 2 +- packages/camera/camera_web/example/lib/main.dart | 2 +- packages/camera/camera_web/example/run_test.sh | 2 +- .../camera/camera_web/example/test_driver/integration_test.dart | 2 +- packages/camera/camera_web/example/web/index.html | 2 +- packages/camera/camera_web/lib/src/camera_web.dart | 2 +- packages/camera/camera_web/test/tests_exist_elsewhere_test.dart | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/camera/camera_web/LICENSE b/packages/camera/camera_web/LICENSE index c6823b81eb84..e959479e646f 100644 --- a/packages/camera/camera_web/LICENSE +++ b/packages/camera/camera_web/LICENSE @@ -1,4 +1,4 @@ -Copyright 2013 The Flutter Authors. All rights reserved. +Copyright 2021 The Flutter Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/packages/camera/camera_web/example/integration_test/camera_web_test.dart b/packages/camera/camera_web/example/integration_test/camera_web_test.dart index 0eea3100e9ed..ad7953e79702 100644 --- a/packages/camera/camera_web/example/integration_test/camera_web_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_web_test.dart @@ -1,4 +1,4 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. +// Copyright 2021 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/example/integration_test/helpers/helpers.dart b/packages/camera/camera_web/example/integration_test/helpers/helpers.dart index 7094f55bb62e..8c27d28afb77 100644 --- a/packages/camera/camera_web/example/integration_test/helpers/helpers.dart +++ b/packages/camera/camera_web/example/integration_test/helpers/helpers.dart @@ -1,4 +1,4 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. +// Copyright 2021 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/example/integration_test/helpers/mocks.dart b/packages/camera/camera_web/example/integration_test/helpers/mocks.dart index 03be3f0b3ca6..81f431d982a0 100644 --- a/packages/camera/camera_web/example/integration_test/helpers/mocks.dart +++ b/packages/camera/camera_web/example/integration_test/helpers/mocks.dart @@ -1,4 +1,4 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. +// Copyright 2021 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/example/lib/main.dart b/packages/camera/camera_web/example/lib/main.dart index 6e8f85e74f40..f06310bb5322 100644 --- a/packages/camera/camera_web/example/lib/main.dart +++ b/packages/camera/camera_web/example/lib/main.dart @@ -1,4 +1,4 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. +// Copyright 2021 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/example/run_test.sh b/packages/camera/camera_web/example/run_test.sh index 00482faa53df..c1bd02435f63 100755 --- a/packages/camera/camera_web/example/run_test.sh +++ b/packages/camera/camera_web/example/run_test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright 2013 The Flutter Authors. All rights reserved. +# Copyright 2021 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/packages/camera/camera_web/example/test_driver/integration_test.dart b/packages/camera/camera_web/example/test_driver/integration_test.dart index 4f10f2a522f3..efc9c93ee57b 100644 --- a/packages/camera/camera_web/example/test_driver/integration_test.dart +++ b/packages/camera/camera_web/example/test_driver/integration_test.dart @@ -1,4 +1,4 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. +// Copyright 2021 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/example/web/index.html b/packages/camera/camera_web/example/web/index.html index f3c6a5e8a8e3..376bd7359386 100644 --- a/packages/camera/camera_web/example/web/index.html +++ b/packages/camera/camera_web/example/web/index.html @@ -1,5 +1,5 @@ - diff --git a/packages/camera/camera_web/lib/src/camera_web.dart b/packages/camera/camera_web/lib/src/camera_web.dart index fc3be09eec1d..64f18812ef49 100644 --- a/packages/camera/camera_web/lib/src/camera_web.dart +++ b/packages/camera/camera_web/lib/src/camera_web.dart @@ -1,4 +1,4 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. +// Copyright 2021 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart b/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart index 442c50144727..b103ea951866 100644 --- a/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart +++ b/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart @@ -1,4 +1,4 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. +// Copyright 2021 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. From 4710036ca13a0a6adffafdbf0d604d751ee1beb8 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 16:01:11 +0200 Subject: [PATCH 14/20] docs: update camera_web readme --- packages/camera/camera_web/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/camera/camera_web/README.md b/packages/camera/camera_web/README.md index e8a797110d7d..d57bd7446d17 100644 --- a/packages/camera/camera_web/README.md +++ b/packages/camera/camera_web/README.md @@ -2,4 +2,6 @@ A Flutter plugin for Web allowing access to the device cameras. -*Note*: This plugin is under development. \ No newline at end of file +*Note*: This plugin is under development. + +In order to use this plugin, your app should depend both on `camera` and `camera_web`. This is a temporary solution until a plugin is released. \ No newline at end of file From 719308166ee3123d0ae9f510acbcf6ada13156aa Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 17:41:30 +0200 Subject: [PATCH 15/20] revert: update copyright 2013 to 2021 --- packages/camera/camera_web/LICENSE | 2 +- .../camera_web/example/integration_test/camera_web_test.dart | 2 +- .../camera_web/example/integration_test/helpers/helpers.dart | 2 +- .../camera_web/example/integration_test/helpers/mocks.dart | 2 +- packages/camera/camera_web/example/lib/main.dart | 2 +- packages/camera/camera_web/example/run_test.sh | 2 +- .../camera/camera_web/example/test_driver/integration_test.dart | 2 +- packages/camera/camera_web/example/web/index.html | 2 +- packages/camera/camera_web/lib/src/camera_web.dart | 2 +- packages/camera/camera_web/test/tests_exist_elsewhere_test.dart | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/camera/camera_web/LICENSE b/packages/camera/camera_web/LICENSE index e959479e646f..c6823b81eb84 100644 --- a/packages/camera/camera_web/LICENSE +++ b/packages/camera/camera_web/LICENSE @@ -1,4 +1,4 @@ -Copyright 2021 The Flutter Authors. All rights reserved. +Copyright 2013 The Flutter Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/packages/camera/camera_web/example/integration_test/camera_web_test.dart b/packages/camera/camera_web/example/integration_test/camera_web_test.dart index ad7953e79702..0eea3100e9ed 100644 --- a/packages/camera/camera_web/example/integration_test/camera_web_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_web_test.dart @@ -1,4 +1,4 @@ -// Copyright 2021 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/example/integration_test/helpers/helpers.dart b/packages/camera/camera_web/example/integration_test/helpers/helpers.dart index 8c27d28afb77..7094f55bb62e 100644 --- a/packages/camera/camera_web/example/integration_test/helpers/helpers.dart +++ b/packages/camera/camera_web/example/integration_test/helpers/helpers.dart @@ -1,4 +1,4 @@ -// Copyright 2021 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/example/integration_test/helpers/mocks.dart b/packages/camera/camera_web/example/integration_test/helpers/mocks.dart index 81f431d982a0..03be3f0b3ca6 100644 --- a/packages/camera/camera_web/example/integration_test/helpers/mocks.dart +++ b/packages/camera/camera_web/example/integration_test/helpers/mocks.dart @@ -1,4 +1,4 @@ -// Copyright 2021 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/example/lib/main.dart b/packages/camera/camera_web/example/lib/main.dart index f06310bb5322..6e8f85e74f40 100644 --- a/packages/camera/camera_web/example/lib/main.dart +++ b/packages/camera/camera_web/example/lib/main.dart @@ -1,4 +1,4 @@ -// Copyright 2021 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/example/run_test.sh b/packages/camera/camera_web/example/run_test.sh index c1bd02435f63..00482faa53df 100755 --- a/packages/camera/camera_web/example/run_test.sh +++ b/packages/camera/camera_web/example/run_test.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Copyright 2021 The Flutter Authors. All rights reserved. +# Copyright 2013 The Flutter Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. diff --git a/packages/camera/camera_web/example/test_driver/integration_test.dart b/packages/camera/camera_web/example/test_driver/integration_test.dart index efc9c93ee57b..4f10f2a522f3 100644 --- a/packages/camera/camera_web/example/test_driver/integration_test.dart +++ b/packages/camera/camera_web/example/test_driver/integration_test.dart @@ -1,4 +1,4 @@ -// Copyright 2021 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/example/web/index.html b/packages/camera/camera_web/example/web/index.html index 376bd7359386..f3c6a5e8a8e3 100644 --- a/packages/camera/camera_web/example/web/index.html +++ b/packages/camera/camera_web/example/web/index.html @@ -1,5 +1,5 @@ - diff --git a/packages/camera/camera_web/lib/src/camera_web.dart b/packages/camera/camera_web/lib/src/camera_web.dart index 64f18812ef49..fc3be09eec1d 100644 --- a/packages/camera/camera_web/lib/src/camera_web.dart +++ b/packages/camera/camera_web/lib/src/camera_web.dart @@ -1,4 +1,4 @@ -// Copyright 2021 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. diff --git a/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart b/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart index b103ea951866..442c50144727 100644 --- a/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart +++ b/packages/camera/camera_web/test/tests_exist_elsewhere_test.dart @@ -1,4 +1,4 @@ -// Copyright 2021 The Flutter Authors. All rights reserved. +// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. From 183c0e096154f1f46b9e42204fa8f0a01d275150 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Tue, 13 Jul 2021 20:51:49 +0200 Subject: [PATCH 16/20] docs: add missing copyright to camera_web --- packages/camera/camera_web/lib/camera_web.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/camera/camera_web/lib/camera_web.dart b/packages/camera/camera_web/lib/camera_web.dart index 2edc4531f6ae..dcefc9293b88 100644 --- a/packages/camera/camera_web/lib/camera_web.dart +++ b/packages/camera/camera_web/lib/camera_web.dart @@ -1,3 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + library camera_web; export 'src/camera_web.dart'; From ca9569ce26a167de137ef036c846160a508800c3 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Thu, 15 Jul 2021 08:59:35 +0200 Subject: [PATCH 17/20] build: remove unused dependency --- packages/camera/camera_web/example/pubspec.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/camera/camera_web/example/pubspec.yaml b/packages/camera/camera_web/example/pubspec.yaml index 756561c084bc..1e075712325e 100644 --- a/packages/camera/camera_web/example/pubspec.yaml +++ b/packages/camera/camera_web/example/pubspec.yaml @@ -10,7 +10,6 @@ dependencies: sdk: flutter dev_dependencies: - build_runner: ^2.0.6 mocktail: ^0.1.4 camera_web: path: ../ From d075c497ab0eeaec27f41690ac1a6620119f0799 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Thu, 15 Jul 2021 10:28:22 +0200 Subject: [PATCH 18/20] Update packages/camera/camera_web/example/integration_test/camera_web_test.dart --- .../camera_web/example/integration_test/camera_web_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/camera/camera_web/example/integration_test/camera_web_test.dart b/packages/camera/camera_web/example/integration_test/camera_web_test.dart index 0eea3100e9ed..a6ee0e81ccb2 100644 --- a/packages/camera/camera_web/example/integration_test/camera_web_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_web_test.dart @@ -29,7 +29,7 @@ void main() { navigator = MockNavigator(); mediaDevices = MockMediaDevices(); videoElement = VideoElement() - ..src = 'https://www.w3schools.com/tags/mov_bbb.mp4' + ..src = 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4' ..preload = 'true' ..width = 10 ..height = 10; From 32569095f083c038953e8b7e639e354dd9fbca7f Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Thu, 15 Jul 2021 10:33:38 +0200 Subject: [PATCH 19/20] style: update camera_web_test formatting --- .../camera_web/example/integration_test/camera_web_test.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/camera/camera_web/example/integration_test/camera_web_test.dart b/packages/camera/camera_web/example/integration_test/camera_web_test.dart index a6ee0e81ccb2..d26f0e855889 100644 --- a/packages/camera/camera_web/example/integration_test/camera_web_test.dart +++ b/packages/camera/camera_web/example/integration_test/camera_web_test.dart @@ -29,7 +29,8 @@ void main() { navigator = MockNavigator(); mediaDevices = MockMediaDevices(); videoElement = VideoElement() - ..src = 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4' + ..src = + 'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4' ..preload = 'true' ..width = 10 ..height = 10; From 3ddbec9c683f8b06ea3b0f933a3c94f3b00a3051 Mon Sep 17 00:00:00 2001 From: Bartosz Selwesiuk Date: Thu, 15 Jul 2021 16:52:56 +0200 Subject: [PATCH 20/20] chore: add publish_to: none in pubspec --- packages/camera/camera_web/pubspec.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/camera/camera_web/pubspec.yaml b/packages/camera/camera_web/pubspec.yaml index c8cf5591a6b7..a2aa43c22d65 100644 --- a/packages/camera/camera_web/pubspec.yaml +++ b/packages/camera/camera_web/pubspec.yaml @@ -4,6 +4,11 @@ repository: https://github.com/flutter/plugins/tree/master/packages/camera/camer issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22 version: 0.1.0 +# This plugin is under development and will be published +# when the first working web camera implementation is added. +# TODO(bselwe): Remove when camera_web should be published. +publish_to: none + environment: sdk: ">=2.12.0 <3.0.0" flutter: ">=2.0.0"