I am viewing the camera within a restricted height area and it automatically adjusts the aspect ratio. I want to make the width equal to the device width but the view should not be distorted, I don’t want it to be a stretched view. How can I do?
Cropping is fine, all I want is to make the width equal to the screen width and the unstretched image.
I use "camera" plugin.
Widget build(BuildContext context) {
return Container(
height: SizeConfig.screenHeight,
width: SizeConfig.screenWidth,
child: Column(
children: [
Expanded(
child: CameraPreview(_controller),
),
SizedBox(
height: 230,
child: ///some elements here, this area fix
),
],
),
);
}
I tried many resizing solutions but they all resulted in a stretched view.
2
Answers
Inspired by Sanket Patel's suggestion, I got what I wanted as follows.
Try the below code where you want to show your camera.
Modify values according to your requirement.