Skip to content

Commit ea60b21

Browse files
committed
🚑 Restore exposure offset and zoom level after switch between cameras.
ref: #23 (comment)
1 parent eb688b9 commit ea60b21

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/src/widget/camera_picker.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,18 @@ class CameraPickerState extends State<CameraPicker>
439439
final CameraController _c = controller;
440440
// Then unbind the controller from widgets, which requires a build frame.
441441
setState(() {
442+
_currentZoom = 1.0;
443+
_baseZoom = 1.0;
444+
_maxAvailableZoom = null;
445+
_minAvailableZoom = null;
442446
_controllerNotifier.value = null;
443447
// Meanwhile, cancel the existed exposure point and mode display.
444448
_exposureModeDisplayTimer?.cancel();
445449
_exposurePointDisplayTimer?.cancel();
446450
_lastExposurePoint.value = null;
451+
if (_currentExposureOffset.value != 0.0) {
452+
_currentExposureOffset.value = 0.0;
453+
}
447454
});
448455
// **IMPORTANT**: Push methods into a post frame callback, which ensures the
449456
// controller has already unbind from widgets.

0 commit comments

Comments
 (0)