Skip to content

Commit

Permalink
🐛 Wrap controller methods
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed Dec 23, 2024
1 parent c9dc3fd commit b7db23f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/src/states/camera_picker_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -945,15 +945,19 @@ class CameraPickerState extends State<CameraPicker>
}
wrapControllerMethod<void>(
'setFocusMode',
() => controller.setFocusMode(FocusMode.auto),
() async {
await innerController?.setFocusMode(FocusMode.auto);
},
);
if (previousExposureMode != ExposureMode.locked) {
wrapControllerMethod<void>(
'setExposureMode',
() => controller.setExposureMode(previousExposureMode),
() async {
await innerController?.setExposureMode(previousExposureMode);
},
);
}
await controller.resumePreview();
await innerController?.resumePreview();
} catch (e, s) {
handleErrorWithHandler(e, s, pickerConfig.onError);
} finally {
Expand Down Expand Up @@ -1071,13 +1075,13 @@ class CameraPickerState extends State<CameraPicker>
);
if (entity != null) {
if (pickerConfig.onPickConfirmed case final onPickConfirmed?) {
await controller.resumePreview();
await innerController?.resumePreview();
onPickConfirmed(entity);
} else {
Navigator.of(context).pop(entity);
}
} else {
await controller.resumePreview();
await innerController?.resumePreview();
}
} catch (e, s) {
recordCountdownTimer?.cancel();
Expand Down

0 comments on commit b7db23f

Please sign in to comment.