Apparence-io / CamerAwesome

📸 Embedding a camera experience within your own app shouldn't be that hard. A flutter plugin to integrate awesome Android / iOS camera experience.
https://ApparenceKit.dev
MIT License
949 stars 240 forks source link

Tap on preview to focus not working #173

Closed munum closed 1 year ago

munum commented 1 year ago

Steps to Reproduce

Run ai_analysis_faces and tap on preview screen.

Expected results

Focus on tapped position.

Actual results

No focus action is triggered.

About your device

Brand Model OS
LG V30 Android 9

g-apparence commented 1 year ago

I think it is due as this example has a canvas above the preview. That's not a bug.

The canvas has been put in this example only as a demo.

munum commented 1 year ago

I think it is due as this example has a canvas above the preview. That's not a bug.

The canvas has been put in this example only as a demo.

Is there a way to make focus work even when there's a canvas? I imagine zoom doesn't work in this example either because of the canvas.

apalala-dev commented 1 year ago

Just wrap the content printed above CameraAwesomeBuilder with an IgnorePointer and you will again have access to the built-in gestures of CamerAwesome:

Positioned(
  top: 132,
  bottom: 132,
  left: 0,
  right: 0,
  child: IgnorePointer(
    child: AnimatedBuilder(
        animation: animation,
        builder: (context, widget) {
          return CustomPaint(
            painter: FaceDetectorPainter(
                faces, absoluteImageSize, rotation, animation),
          );
        }),
  ),
)
munum commented 1 year ago

Just wrap the content printed above CameraAwesomeBuilder with an IgnorePointer and you will again have access to the built-in gestures of CamerAwesome:

Positioned(
  top: 132,
  bottom: 132,
  left: 0,
  right: 0,
  child: IgnorePointer(
    child: AnimatedBuilder(
        animation: animation,
        builder: (context, widget) {
          return CustomPaint(
            painter: FaceDetectorPainter(
                faces, absoluteImageSize, rotation, animation),
          );
        }),
  ),
)

Thank you. Would it be a good idea to make a pull request for this?

apalala-dev commented 1 year ago

This example is not supposed to be perfect, it's just there to show how one could do this kind of things. You might do them differently in a real app (splitting logic and UI for instance).

I will still include it in a PR I am working on as it's a small change that does no harm :)

apalala-dev commented 1 year ago

I'm closing this issue since the PR that includes this change has been merged to master. Feel free to open new issues if necessary :)