Skip to content

Commit 98392a0

Browse files
authored
🚸 Prevent switching cameras when taking picture or recording video (#120)
1 parent f50c499 commit 98392a0

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ that can be found in the LICENSE file. -->
44

55
# Changelog
66

7+
## 3.5.0-dev.3
8+
9+
### Improvements
10+
11+
- Prevent switching cameras when taking picture or recording video. (#120)
12+
713
## 3.5.0-dev.2
814

915
### Improvements

lib/src/states/camera_picker_state.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,10 @@ class CameraPickerState extends State<CameraPicker>
349349
/// of cameras, start from the beginning.
350350
/// 按顺序切换相机。当达到相机数量时从头开始。
351351
void switchCameras() {
352+
// Skip switching when taking picture or recording video.
353+
if (controller.value.isTakingPicture || controller.value.isRecordingVideo) {
354+
return;
355+
}
352356
++currentCameraIndex;
353357
if (currentCameraIndex == cameras.length) {
354358
currentCameraIndex = 0;

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: wechat_camera_picker
22
description: A camera picker which is an extension to wechat_assets_picker, but can be run separately.
3-
version: 3.5.0-dev.2
3+
version: 3.5.0-dev.3
44
homepage: https://github.com/fluttercandies/flutter_wechat_camera_picker
55

66
environment:

0 commit comments

Comments
 (0)