CamerAwesome
CamerAwesome copied to clipboard
Preview off and zoomed in when taking photo
Hi everyone,
I'm trying to get a fullscreen preview and capture images from the plugin, but the files returned are zoomed and tranlated to the left. Here's whats the preview looks like:
And her's whats the result looks like:
Here's my implementation:
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(child: _cameraBody),
);
}
Widget get _cameraBody => CameraAwesomeBuilder.awesome(
onImageForAnalysis: (img) => _processImageBarcode(img),
imageAnalysisConfig: AnalysisConfig(
androidOptions: const AndroidAnalysisOptions.nv21(
width: 512,
),
maxFramesPerSecond: 4,
autoStart: true,
),
sensorConfig: SensorConfig.single(
aspectRatio: CameraAspectRatios.ratio_16_9,
),
previewFit: CameraPreviewFit.cover,
saveConfig: SaveConfig.photo(),
topActionsBuilder: (state) {
return AwesomeTopActions(
state: state,
children: [],
);
},
progressIndicator: CustomCircularProgressIndicator(),
bottomActionsBuilder: (state) => Padding(
padding: const EdgeInsets.only(bottom: 38.0),
child: AwesomeBottomActions(
padding: EdgeInsets.zero,
state: state,
captureButton: GestureDetector(
onTap: true
? () {
state.when(
onPhotoMode: (state) => state.takePhoto(
onPhoto: (photo) {
debugPrint('photo: $photo');
photo.when(
single: (captureRequest) {
XFile? file = captureRequest.file;
if (file != null) {
navigateToPage(
context, Routes.createGarageItem,
settings: RouteSettings(arguments: file));
}
},
);
},
),
);
}
: null,
child: Container(
decoration: BoxDecoration(
color:
_hasCar ? Palette.red.withOpacity(0.72) : Colors.white54,
borderRadius: BorderRadius.circular(50),
border: Border.all(
color: Colors.white70,
width: 4,
),
),
height: 72,
width: 72,
padding: const EdgeInsets.all(8),
),
),
left: _backButton,
right: AwesomeFlashButton(
state: state,
),
),
),
middleContentBuilder: (state) => Container(),
theme: AwesomeTheme(
bottomActionsBackgroundColor: Colors.transparent,
),
previewDecoratorBuilder: (state, preview) {
return TakePhotoUI();
},
);
I tried with every configuration of sensors, preview fit possible, am I missing something ? Issue is the same on iOS and Android, multiple devices.
Flutter 3.16.9 • channel stable • https://github.com/flutter/flutter.git Framework • revision 41456452f2 (3 weeks ago) • 2024-01-25 10:06:23 -0800 Engine • revision f40e976bed Tools • Dart 3.2.6 • DevTools 2.28.5
Hi, Yes I found this on Android only for the back camera. The surface that takes the image on this configuration is not right.
I am having the same issue, thought I misconfigured something but nope. Any solution?
@Juanchote I started to work on something. But I'm not sure if that fixes the issue on every phones.
Just for the record I switched to the classic camera flutter package and managed to take fullscreen photos with minor distortion.
@Juanchote I started to work on something. But I'm not sure if that fixes the issue on every phones.
Thank you. I will QC it haha
Facing same issue in a production app (P8P). Any workaround or knows when this bug was introduced?
@g-apparence Any update? This seems to happen on most Android cameras and makes it unusable.
Yes I had quite good results but I lack time to finish it.
I am now alone working on this and I also have a lot of work.
Same issue happened to me on iOS. So I migrated over to official camera
plugin unfortunately.
Same issue happened to me on iOS. So I migrated over to official
camera
plugin unfortunately.
I will probably unfortunately also need to do this. If there's only one person maintaining the package, it will be hard to keep up with bug fixes and features.
@g-apparence Also experiencing this issue. Please advise if you see this being fixed soon or if not, the best way I can contribute to help you fix it.
I also experienced this issue and temporarily resolved it by adjusting the code as follows:
Center( child: SizedBox(
width: mediaSize.width,
height: mediaSize.height,
child: AspectRatio(
aspectRatio: 1,
child: CameraAwesomeBuilder.custom(
previewFit: CameraPreviewFit.contain,
sensorConfig: SensorConfig.single(aspectRatio: CameraAspectRatios.ratio_16_9),
I also experienced this issue and temporarily resolved it by adjusting the code as follows:
Center( child: SizedBox( width: mediaSize.width, height: mediaSize.height, child: AspectRatio( aspectRatio: 1, child: CameraAwesomeBuilder.custom( previewFit: CameraPreviewFit.contain, sensorConfig: SensorConfig.single(aspectRatio: CameraAspectRatios.ratio_16_9),
this did fix it for me, thanks
Any updates on this? It has been months. Taken picture != Screen feed in all cases throughout all devices.
If the app is landscape only: On portrait: Taken image cuts a portion from the Feed on top and adds the portion that is not visible on Live feed around the bottom.
On landscape: Taken image cuts a portion from the Feed on left and adds the portion that is not visible on Live feed on the right.