Closed naamapps closed 3 years ago
Okay, so I found out that setting the height to MediaQuery.of(context).size.width.roundToDouble()
, fixes the issue.
Although it is not perfect either.
The camera outputs a zoomed in image (not the whole width and height of the cropped camera feed).
So when pressing the shoot button, the actual image taken is like a zoomed out version of the square preview (even after cropping it to a square image).
You should use the same technic as the inner code to crop the content into a square. Our plugin rely on the device preview size for ratio so you have to crop it. let me know if you need help.
I'm using the following code to create the camera. But like he mentioned the preview is a bit zoomed. If I use fitted true the image looks stretched.
CameraAwesome(
// onPermissionsResult: _onPermissionsResult,
selectDefaultSize: (availableSizes) {
_photoSize = ValueNotifier(availableSizes[0]);
return availableSizes[0];
},
captureMode: _captureMode,
photoSize: _photoSize,
sensor: _sensor,
fitted: false,
switchFlashMode: _switchFlash,
zoom: _zoomNotifier,
),
The issue is I think, the Camera preview is always in 9:16 ratio, and takes the photo in the ratio we specify. Whatever the resolution we give the preview is always in 9:16.
Just try wrapping the CameraAwesome widget inside a Transform.scale with scale: 0.4
But if we want to record square ? How can we achieve that without ffmpeg ?
Awesome package!
However I have an issue with making the camera preview window square. I followed the example and actually copied the function
buildSizedScreenCamera
to build the sized camera.If I put the height and the width as the width of the screen (to create a square), the camera preview will not be square and the camera feed will become distorted.
This is the code:
And for some reason, setting the height of the container to 300 (like in the example), the camera is not distorted. But again, not square.
I think it's because in
_CameraPreviewWidget
whenfitted
is true, theFittedBox
fit is set tofit: BoxFit.fitWidth
, But I'm not really sure this is the cause of the problem.Hope to get a solution, Thank you!