tapToFocus method

Future<void> tapToFocus(
  1. Offset relativePoint
)

Trigger tap-to-focus on camera preview coordinates.

Implementation

Future<void> tapToFocus(Offset relativePoint) async {
  _lastTapFocusPoint = relativePoint;
  _safeNotifyListeners();

  if (_cameraController != null && _cameraController!.value.isInitialized) {
    try {
      await _cameraController!.setFocusPoint(relativePoint);
      await _cameraController!.setFocusMode(cam.FocusMode.auto);
    } catch (e) {
      debugPrint('Tap to focus failed: $e');
    }
  }
}