Skip to content

Commit 796447f

Browse files
committed
⚡️ Reset exposure offset when update exposure point.
1 parent fc645bc commit 796447f

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/src/widget/camera_picker.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,9 @@ class CameraPickerState extends State<CameraPicker>
573573

574574
/// Use the [details] point to set exposure and focus.
575575
/// 通过点击点的 [details] 设置曝光和对焦。
576-
void setExposureAndFocusPoint(TapUpDetails details) {
576+
Future<void> setExposureAndFocusPoint(TapUpDetails details) async {
577577
assert(controller != null);
578+
_isExposureModeDisplays.value = false;
578579
// Ignore point update when the new point is less than 8% and higher than
579580
// 92% of the screen's height.
580581
if (details.globalPosition.dy < Screens.height / 12 ||
@@ -593,6 +594,13 @@ class CameraPickerState extends State<CameraPicker>
593594
);
594595
_restartPointDisplayTimer();
595596
_currentExposureOffset.value = 0;
597+
if (_exposureMode.value == ExposureMode.locked) {
598+
_exposureMode.value = ExposureMode.auto;
599+
await Future.wait(<Future<void>>[
600+
controller.setExposureOffset(0),
601+
controller.setExposureMode(ExposureMode.auto),
602+
]);
603+
}
596604
controller.setExposurePoint(
597605
_lastExposurePoint.value.scale(1 / Screens.width, 1 / Screens.height),
598606
);
@@ -601,10 +609,6 @@ class CameraPickerState extends State<CameraPicker>
601609
_lastExposurePoint.value.scale(1 / Screens.width, 1 / Screens.height),
602610
);
603611
}
604-
if (_exposureMode.value == ExposureMode.locked) {
605-
_exposureMode.value = ExposureMode.auto;
606-
}
607-
_isExposureModeDisplays.value = false;
608612
}
609613

610614
/// Update the exposure offset using the exposure controller.

0 commit comments

Comments
 (0)