setExposureAndFocus method

Future<void> setExposureAndFocus(
  1. TapDownDetails details,
  2. BoxConstraints constraints, {
  3. ValueSetter<Exception>? onException,
})

Set exposure and focus point on the screen

Implementation

Future<void> setExposureAndFocus(
  TapDownDetails details,
  BoxConstraints constraints, {
  ValueSetter<Exception>? onException,
}) async {
  if (!_hasCamera(onException)) return;

  final offset = Offset(
    details.localPosition.dx / constraints.maxWidth,
    details.localPosition.dy / constraints.maxHeight,
  );

  try {
    await Future.wait([
      _controller!.setExposurePoint(offset),
      _controller!.setFocusPoint(offset),
    ]);
  } on CameraException catch (e) {
    onException?.call(e);
  } catch (e) {
    onException?.call(Exception(e));
  }
}