diff --git a/lib/screens/metering/components/camera_container/bloc_container_camera.dart b/lib/screens/metering/components/camera_container/bloc_container_camera.dart index 56dec48..08bfee4 100644 --- a/lib/screens/metering/components/camera_container/bloc_container_camera.dart +++ b/lib/screens/metering/components/camera_container/bloc_container_camera.dart @@ -169,9 +169,10 @@ class CameraContainerBloc extends EvSourceBlocBase _onZoomChanged(ZoomChangedEvent event, Emitter emit) async { - if (_cameraController != null && event.value >= _zoomRange!.start && event.value <= _zoomRange!.end) { - _cameraController!.setZoomLevel(event.value); - _currentZoom = event.value; + if (_cameraController != null) { + final double zoom = event.value.clamp(_zoomRange!.start, _zoomRange!.end); + _cameraController!.setZoomLevel(zoom); + _currentZoom = zoom; _emitActiveState(emit); } }