File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ that can be found in the LICENSE file. -->
66
77## 3.7.0
88
9+ ### New features
10+
11+ - Add ` preferredFlashMode ` , allowing users to choose which flash mode is preferred when first using the camera. (#158 )
12+
913### Improvements
1014
1115- Allow flash modes failed to switch and can move on to next when switching. (#156 )
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ class CameraPickerConfig {
3333 this .resolutionPreset = ResolutionPreset .max,
3434 this .imageFormatGroup = ImageFormatGroup .unknown,
3535 this .preferredLensDirection = CameraLensDirection .back,
36+ this .preferredFlashMode = FlashMode .auto,
3637 this .lockCaptureOrientation,
3738 this .foregroundBuilder,
3839 this .previewTransformBuilder,
@@ -138,6 +139,11 @@ class CameraPickerConfig {
138139 /// 摄像机在拍摄时锁定的旋转角度
139140 final DeviceOrientation ? lockCaptureOrientation;
140141
142+ /// Which flash mode is preferred when first using the camera,
143+ /// typically with the auto mode.
144+ /// 首次使用相机时首选的闪光灯,通常是自动模式。
145+ final FlashMode preferredFlashMode;
146+
141147 /// {@macro wechat_camera_picker.EntitySaveCallback}
142148 final EntitySaveCallback ? onEntitySaving;
143149
Original file line number Diff line number Diff line change @@ -337,6 +337,8 @@ class CameraPickerState extends State<CameraPicker>
337337 newController
338338 .getMinZoomLevel ()
339339 .then ((double value) => minAvailableZoom = value),
340+ if (pickerConfig.preferredFlashMode != FlashMode .auto)
341+ newController.setFlashMode (pickerConfig.preferredFlashMode),
340342 ],
341343 eagerError: true ,
342344 );
You can’t perform that action at this time.
0 commit comments