Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.6.19

* Changes target rotation of captured images to current default display rotation to fix captured
photo orientation to upright.

## 0.6.18+3

* Fixes incorrect camera preview mirroring for front cameras of devices using the Impeller backend.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ class AndroidCameraCameraX extends CameraPlatform {
// Configure ImageCapture instance.
imageCapture = proxy.newImageCapture(
resolutionSelector: presetResolutionSelector,
/* use CameraX default target rotation */ targetRotation: null,
/* use CameraX default target rotation */ targetRotation:
await deviceOrientationManager.getDefaultDisplayRotation(),
);

// Configure ImageAnalysis instance.
Expand Down Expand Up @@ -966,9 +967,9 @@ class AndroidCameraCameraX extends CameraPlatform {
await imageCapture!.setFlashMode(CameraXFlashMode.off);
}

// Set target rotation to default CameraX rotation only if capture
// orientation not locked.
if (!captureOrientationLocked && shouldSetDefaultRotation) {
// Set target rotation to the current default CameraX rotation if
// the capture orientation is not locked.
if (!captureOrientationLocked) {
await imageCapture!.setTargetRotation(
await deviceOrientationManager.getDefaultDisplayRotation(),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_android_camerax/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_android_camerax
description: Android implementation of the camera plugin using the CameraX library.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.6.18+3
version: 0.6.19

environment:
sdk: ^3.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3488,7 +3488,7 @@ void main() {
);

test(
'takePicture sets ImageCapture target rotation to currrent photo rotation when orientation unlocked',
'takePicture sets ImageCapture target rotation as expected when orientation locked or unlocked',
() async {
final AndroidCameraCameraX camera = AndroidCameraCameraX();
final MockImageCapture mockImageCapture = MockImageCapture();
Expand Down Expand Up @@ -3531,7 +3531,7 @@ void main() {
// Orientation is unlocked and plugin does not need to set default target
// rotation manually.
await camera.takePicture(cameraId);
verifyNever(mockImageCapture.setTargetRotation(any));
verify(mockImageCapture.setTargetRotation(defaultTargetRotation));

// Orientation is locked and plugin does not need to set default target
// rotation manually.
Expand Down