ricnaaru / adv_camera

Advanced Camera for Flutter
BSD 3-Clause "New" or "Revised" License
54 stars 35 forks source link

Focus marker disappear on iOS after changing camera #58

Open margorski opened 3 years ago

margorski commented 3 years ago

After switching camera manual focus marker doesn't show anymore. It behaves like that only on iOS, on android it is fine.

adv_camera version: 2.0.1+1

The condition to trigger that issue is not only switching camera but trying to trigger manual focus first. If manual focus won't be triggered before switching camera on next manual focus marker is shown.

Steps to reproduce: 1) Click on screen to trigger manual focus. Marker is shown. 2) Click button which calls cameraController.switchCamera() and switch back camera to front camera. 3) Click on screen to trigger manual focus.

Result: Marker doesn't show. Marker doesn't show if we before step 3 click once more change camera button to get back to Back camera. Even the marker is not shown, manual focus still works.

I was thinking about showing some code but there is nothing unusual in AdvCamera widget configuration what could cause an error.

Widget declaration:

  Widget buildFullscreenCamera() {
    return Positioned(
        top: 0,
        left: 0,
        bottom: 0,
        right: 0,
        child: Center(
            child: AdvCamera(
                initialCameraType: cameraType,
                onCameraCreated: _onCameraCreated,
                onImageCaptured: _onImageCaptured,
                flashType: flashType)));
  }

where cameraType is equal CameraType.rear and flashType is equal FlashType.off

and _onCameraCreated:

  _onCameraCreated(AdvCameraController controller) {
    this.cameraController = controller;
  }