From 25f21d0a0fa9a47977fef9221ba4e5b30350bedb Mon Sep 17 00:00:00 2001 From: kArtDevelopers <54713849+kArtDevelopers@users.noreply.github.com> Date: Tue, 3 May 2022 17:57:55 +0530 Subject: [PATCH 1/5] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index f40d190..ab60993 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: ">=2.12.0-0.0 <3.0.0" dependencies: - camera: ^0.9.4+5 + camera: ^0.9.4+21 font_awesome_flutter: ^9.0.0-nullsafety rxdart: ^0.26.0 flutter: From eb84d48ec88228d6408a17594837165072498a0d Mon Sep 17 00:00:00 2001 From: kArtDevelopers <54713849+kArtDevelopers@users.noreply.github.com> Date: Wed, 4 May 2022 16:53:11 +0530 Subject: [PATCH 2/5] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index ab60993..34fee1a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: ">=2.12.0-0.0 <3.0.0" dependencies: - camera: ^0.9.4+21 + camera: ^0.9.4+17 font_awesome_flutter: ^9.0.0-nullsafety rxdart: ^0.26.0 flutter: From e20a60327d6891491258df1e95a1f5f96e7ef92b Mon Sep 17 00:00:00 2001 From: kArtDevelopers <54713849+kArtDevelopers@users.noreply.github.com> Date: Wed, 4 May 2022 16:59:17 +0530 Subject: [PATCH 3/5] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 34fee1a..a10273b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: ">=2.12.0-0.0 <3.0.0" dependencies: - camera: ^0.9.4+17 + camera: ^0.9.4+10 font_awesome_flutter: ^9.0.0-nullsafety rxdart: ^0.26.0 flutter: From c708e22885beca36119342fce73969dced61dec3 Mon Sep 17 00:00:00 2001 From: Anson Date: Sat, 11 Jun 2022 02:35:57 +0800 Subject: [PATCH 4/5] upgrade libs. --- pubspec.lock | 285 ++++++++++++++++++++++++++++++++++++++++++++++----- pubspec.yaml | 4 +- 2 files changed, 260 insertions(+), 29 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index c9151fb..3df03c4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,13 +1,34 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + url: "https://pub.dartlang.org" + source: hosted + version: "40.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.0" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.1" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -21,28 +42,42 @@ packages: name: camera url: "https://pub.dartlang.org" source: hosted - version: "0.9.4+5" + version: "0.9.8" + camera_android: + dependency: transitive + description: + name: camera_android + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.7+1" + camera_avfoundation: + dependency: transitive + description: + name: camera_avfoundation + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.7+1" camera_platform_interface: dependency: transitive description: name: camera_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.2.0" camera_web: dependency: transitive description: name: camera_web url: "https://pub.dartlang.org" source: hosted - version: "0.2.1+1" + version: "0.2.1+6" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -63,21 +98,49 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" + coverage: + dependency: transitive + description: + name: coverage + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.2" cross_file: dependency: transitive description: name: cross_file url: "https://pub.dartlang.org" source: hosted - version: "0.3.1" + version: "0.3.3+1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.2" flutter: dependency: "direct main" description: flutter @@ -89,7 +152,7 @@ packages: name: flutter_plugin_android_lifecycle url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.6" flutter_test: dependency: "direct dev" description: flutter @@ -106,21 +169,70 @@ packages: name: font_awesome_flutter url: "https://pub.dartlang.org" source: hosted - version: "9.0.0-nullsafety" + version: "9.2.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.0" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.1" + io: + dependency: transitive + description: + name: io + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" js: dependency: transitive description: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" + logging: + dependency: transitive + description: + name: logging + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" meta: dependency: transitive description: @@ -128,41 +240,69 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.0" + mime: + dependency: transitive + description: + name: mime + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" mocktail: dependency: "direct dev" description: name: mocktail url: "https://pub.dartlang.org" source: hosted - version: "0.0.1-dev.11" - path: + version: "0.3.0" + node_preamble: dependency: transitive description: - name: path + name: node_preamble url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" - pedantic: + version: "2.0.1" + package_config: dependency: transitive description: - name: pedantic + name: package_config url: "https://pub.dartlang.org" source: hosted - version: "1.10.0" + version: "2.0.2" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.1" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.2" + pool: + dependency: transitive + description: + name: pool + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" quiver: dependency: transitive description: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.1.0" rxdart: dependency: "direct main" description: @@ -170,18 +310,60 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.26.0" + shelf: + dependency: transitive + description: + name: shelf + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" + shelf_static: + dependency: transitive + description: + name: shelf_static + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + source_maps: + dependency: transitive + description: + name: source_maps + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.10" source_span: dependency: transitive description: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -217,27 +399,76 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" + test: + dependency: transitive + description: + name: test + url: "https://pub.dartlang.org" + source: hosted + version: "1.21.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.9" + test_core: + dependency: transitive + description: + name: test_core + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.13" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" + vm_service: + dependency: transitive + description: + name: vm_service + url: "https://pub.dartlang.org" + source: hosted + version: "8.3.0" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.1" sdks: - dart: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + dart: ">=2.17.0-0 <3.0.0" + flutter: ">=2.8.0" diff --git a/pubspec.yaml b/pubspec.yaml index a10273b..c1b8f8e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ environment: sdk: ">=2.12.0-0.0 <3.0.0" dependencies: - camera: ^0.9.4+10 + camera: ^0.9.8 font_awesome_flutter: ^9.0.0-nullsafety rxdart: ^0.26.0 flutter: @@ -17,7 +17,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - mocktail: ^0.0.1-dev.11 + mocktail: ^0.3.0 # For information on the generic Dart part of this file, see the # following page: https://www.dartlang.org/tools/pub/pubspec From 6805b7cfceda64012a060464ef25cd493bf6138d Mon Sep 17 00:00:00 2001 From: Anson Date: Sat, 11 Jun 2022 02:36:10 +0800 Subject: [PATCH 5/5] fix camera preview scale. --- .../controller/camera_camera_controller.dart | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/src/presentation/controller/camera_camera_controller.dart b/lib/src/presentation/controller/camera_camera_controller.dart index 0e4187d..e2f0a08 100644 --- a/lib/src/presentation/controller/camera_camera_controller.dart +++ b/lib/src/presentation/controller/camera_camera_controller.dart @@ -15,7 +15,9 @@ class CameraCameraController { late CameraController _controller; final statusNotifier = ValueNotifier(CameraCameraEmpty()); + CameraCameraStatus get status => statusNotifier.value; + set status(CameraCameraStatus status) => statusNotifier.value = status; CameraCameraController({ @@ -25,8 +27,7 @@ class CameraCameraController { required this.onPath, this.enableAudio = false, }) { - _controller = CameraController(cameraDescription, resolutionPreset, - enableAudio: enableAudio); + _controller = CameraController(cameraDescription, resolutionPreset, enableAudio: enableAudio); } void init() async { @@ -99,8 +100,7 @@ class CameraCameraController { void setZoomLevel(double zoom) async { if (zoom != 1) { var cameraZoom = double.parse(((zoom)).toStringAsFixed(1)); - if (cameraZoom >= status.camera.minZoom && - cameraZoom <= status.camera.maxZoom) { + if (cameraZoom >= status.camera.minZoom && cameraZoom <= status.camera.maxZoom) { final camera = status.camera.copyWith(zoom: cameraZoom); status = CameraCameraSuccess(camera: camera); await _controller.setZoomLevel(cameraZoom); @@ -152,7 +152,16 @@ class CameraCameraController { double get aspectRatio => _controller.value.aspectRatio; - Widget buildPreview() => _controller.buildPreview(); + Widget buildPreview() { + var aspectRatio = _controller.value.aspectRatio; + if (aspectRatio > 1) { + aspectRatio = 1 / aspectRatio; + } + return AspectRatio( + aspectRatio: aspectRatio, + child: _controller.buildPreview(), + ); + } DeviceOrientation getApplicableOrientation() { return _controller.value.isRecordingVideo