switchExposureMode method

Future<void> switchExposureMode()

Use the specific mode to update the exposure mode. 设置曝光模式

Implementation

Future<void> switchExposureMode() async {
  final ExposureMode mode = controller.value.exposureMode;
  final ExposureMode newMode;
  if (mode == ExposureMode.auto) {
    newMode = ExposureMode.locked;
  } else {
    newMode = ExposureMode.auto;
  }
  exposurePointDisplayTimer?.cancel();
  if (newMode == ExposureMode.auto) {
    exposurePointDisplayTimer = Timer(const Duration(seconds: 5), () {
      lastExposurePoint.value = null;
    });
  }
  try {
    await controller.setExposureMode(newMode);
  } catch (e, s) {
    handleErrorWithHandler(e, pickerConfig.onError, s: s);
  }
  restartDisplayModeDisplayTimer();
}