I need one help form You end, I am implementing one camera project as well, i have to make take picture in Landscape mode only, i don’t want mode, i am not able to view lands cape mode, always in portrait mode only, i cannot change lands cape mode, How to change oreaintaion, Any idea,
This is the i am using controller,
CameraController? controller;
controller = CameraController(
cameraDescription,
ResolutionPreset.high,
enableAudio: enableAudio,
androidUseOpenGL: useOpenGL,
);
//UI
return RotatedBox(
quarterTurns: 7,
// aspectRatio: controller!.value.previewSize!.aspectRatio,
child: CameraPreview(controller!),
);
This is the controller i am using for camera purpose,I cannot change in Landscape mode, how to do, is any have any Idea , Please comment, it would be appreciated
3
Answers
CameraController? controller;
// Initialize the CameraController with landscape orientation
controller = CameraController(
cameraDescription,
ResolutionPreset.high, // Choose an appropriate resolution preset
enableAudio: enableAudio,
androidUseOpenGL: useOpenGL,
);
// UI
return RotatedBox(
quarterTurns: 1, // Rotate by 90 degrees clockwise for landscape orientation
child: CameraPreview(controller!),
);
use quarterTurns property to move camera orientation.
If you need to handle potential orientation changes (e.g., during app backgrounding/foregrounding), consider using the OrientationBuilder widget to adapt UI elements based on the device’s current orientation. However, this might not be strictly necessary if you’ve locked the orientation.