Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚸 Prevent switching cameras when taking picture or recording video #120

Merged
merged 2 commits into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions lib/src/states/camera_picker_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ class CameraPickerState extends State<CameraPicker>
/// 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;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down