mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 15:00:40 +00:00
Lock & release focus when taking a picture
This commit is contained in:
parent
50c2460f16
commit
c12cfb1697
1 changed files with 6 additions and 1 deletions
|
@ -129,7 +129,6 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
|
||||||
|
|
||||||
await _cameraController!.initialize();
|
await _cameraController!.initialize();
|
||||||
await _cameraController!.setFlashMode(FlashMode.off);
|
await _cameraController!.setFlashMode(FlashMode.off);
|
||||||
await _cameraController!.setFocusMode(FocusMode.locked);
|
|
||||||
|
|
||||||
_zoomRange = await Future.wait<double>([
|
_zoomRange = await Future.wait<double>([
|
||||||
_cameraController!.getMinZoomLevel(),
|
_cameraController!.getMinZoomLevel(),
|
||||||
|
@ -206,7 +205,13 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
|
||||||
|
|
||||||
Future<double?> _takePhoto() async {
|
Future<double?> _takePhoto() async {
|
||||||
try {
|
try {
|
||||||
|
// https://github.com/flutter/flutter/issues/84957#issuecomment-1661155095
|
||||||
|
await _cameraController!.setFocusMode(FocusMode.locked);
|
||||||
|
await _cameraController!.setExposureMode(ExposureMode.locked);
|
||||||
final file = await _cameraController!.takePicture();
|
final file = await _cameraController!.takePicture();
|
||||||
|
await _cameraController!.setFocusMode(FocusMode.auto);
|
||||||
|
await _cameraController!.setExposureMode(ExposureMode.auto);
|
||||||
|
|
||||||
final Uint8List bytes = await file.readAsBytes();
|
final Uint8List bytes = await file.readAsBytes();
|
||||||
Directory(file.path).deleteSync(recursive: true);
|
Directory(file.path).deleteSync(recursive: true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue