-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[android_camera_camerax] Fix incorrect camera mirroring for front cameras on devices using ImageReader Impeller backend
#9233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
7b3809a
1351c20
ceb9865
50897b2
fe4ffb3
bdf32a7
e2fba01
c4b1fd6
0139263
a0c9bc9
ad702cc
de19674
0061ab0
541f537
5fe7d84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,9 +157,21 @@ final class _ImageReaderRotatedPreviewState | |
| sign: widget.facingSign, | ||
| ); | ||
|
|
||
| // If the camera is front facing, mirror the camera preview | ||
| // according to the current device orientation. | ||
| Widget cameraPreview = widget.child; | ||
| if (widget.facingSign == 1) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is == 1 the correct comparison here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah because |
||
| if (deviceOrientation == DeviceOrientation.portraitDown || | ||
| deviceOrientation == DeviceOrientation.portraitUp) { | ||
| cameraPreview = Transform.scale(scaleY: -1, child: cameraPreview); | ||
| } else { | ||
| cameraPreview = Transform.scale(scaleX: -1, child: cameraPreview); | ||
| } | ||
| } | ||
|
|
||
| return RotatedBox( | ||
| quarterTurns: rotationDegrees ~/ 90, | ||
| child: widget.child, | ||
| child: cameraPreview, | ||
| ); | ||
| } else { | ||
| return const SizedBox.shrink(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.