CamerAwesome icon indicating copy to clipboard operation
CamerAwesome copied to clipboard

Preview off and zoomed in when taking photo

Open GoodVibesLab opened this issue 4 months ago • 11 comments

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:

1708113118749

And her's whats the result looks like:

bd7b1ba1-d324-4eaf-ab65-38a06eba79ec

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.
[CameraAw](camerawesome: ^2.0.0+1)

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

GoodVibesLab avatar Feb 16 '24 19:02 GoodVibesLab

Hi, Yes I found this on Android only for the back camera. The surface that takes the image on this configuration is not right.

g-apparence avatar Feb 22 '24 12:02 g-apparence

I am having the same issue, thought I misconfigured something but nope. Any solution?

Juanchote avatar Feb 26 '24 06:02 Juanchote

@Juanchote I started to work on something. But I'm not sure if that fixes the issue on every phones.

g-apparence avatar Feb 26 '24 07:02 g-apparence

Just for the record I switched to the classic camera flutter package and managed to take fullscreen photos with minor distortion.

GoodVibesLab avatar Feb 26 '24 14:02 GoodVibesLab

@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

Juanchote avatar Mar 04 '24 09:03 Juanchote

Facing same issue in a production app (P8P). Any workaround or knows when this bug was introduced?

Fintasys avatar Mar 23 '24 12:03 Fintasys

@g-apparence Any update? This seems to happen on most Android cameras and makes it unusable.

jt274 avatar Mar 28 '24 16:03 jt274

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.

g-apparence avatar Mar 28 '24 17:03 g-apparence

Same issue happened to me on iOS. So I migrated over to official camera plugin unfortunately.

Fintasys avatar Apr 03 '24 02:04 Fintasys

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.

jt274 avatar Apr 03 '24 05:04 jt274

@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.

Woolloff avatar May 04 '24 08:05 Woolloff