diff --git a/CHANGELOG.md b/CHANGELOG.md index dfe735d..d8eb776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ that can be found in the LICENSE file. --> # Changelog +## 3.5.0-dev.3 + +### Improvements + +- Prevent switching cameras when taking picture or recording video. (#120) + ## 3.5.0-dev.2 ### Improvements diff --git a/lib/src/states/camera_picker_state.dart b/lib/src/states/camera_picker_state.dart index 205a5f0..e81612f 100644 --- a/lib/src/states/camera_picker_state.dart +++ b/lib/src/states/camera_picker_state.dart @@ -349,6 +349,10 @@ class CameraPickerState extends State /// of cameras, start from the beginning. /// 按顺序切换相机。当达到相机数量时从头开始。 void switchCameras() { + // Skip switching when taking picture or recording video. + if (controller.value.isTakingPicture || controller.value.isRecordingVideo) { + return; + } ++currentCameraIndex; if (currentCameraIndex == cameras.length) { currentCameraIndex = 0; diff --git a/pubspec.yaml b/pubspec.yaml index 3e80f91..3c838b1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: wechat_camera_picker description: A camera picker which is an extension to wechat_assets_picker, but can be run separately. -version: 3.5.0-dev.2 +version: 3.5.0-dev.3 homepage: https://github.com/fluttercandies/flutter_wechat_camera_picker environment: