@@ -352,28 +352,38 @@ class CameraPickerState extends State<CameraPicker>
352352 ..start ();
353353 await Future .wait (
354354 < Future <void >> [
355- if (pickerConfig.lockCaptureOrientation != null )
356- newController
357- .lockCaptureOrientation (pickerConfig.lockCaptureOrientation),
358355 newController
359356 .getExposureOffsetStepSize ()
360- .then ((double value) => exposureStep = value),
357+ .then ((double value) => exposureStep = value)
358+ .catchError ((_) => exposureStep),
361359 newController
362360 .getMaxExposureOffset ()
363- .then ((double value) => maxAvailableExposureOffset = value),
361+ .then ((double value) => maxAvailableExposureOffset = value)
362+ .catchError ((_) => maxAvailableExposureOffset),
364363 newController
365364 .getMinExposureOffset ()
366- .then ((double value) => minAvailableExposureOffset = value),
365+ .then ((double value) => minAvailableExposureOffset = value)
366+ .catchError ((_) => minAvailableExposureOffset),
367367 newController
368368 .getMaxZoomLevel ()
369- .then ((double value) => maxAvailableZoom = value),
369+ .then ((double value) => maxAvailableZoom = value)
370+ .catchError ((_) => maxAvailableZoom),
370371 newController
371372 .getMinZoomLevel ()
372- .then ((double value) => minAvailableZoom = value),
373+ .then ((double value) => minAvailableZoom = value)
374+ .catchError ((_) => minAvailableZoom),
375+ if (pickerConfig.lockCaptureOrientation != null )
376+ newController
377+ .lockCaptureOrientation (pickerConfig.lockCaptureOrientation)
378+ .catchError ((_) {}),
373379 if (pickerConfig.preferredFlashMode != FlashMode .auto)
374- newController.setFlashMode (pickerConfig.preferredFlashMode),
380+ newController
381+ .setFlashMode (pickerConfig.preferredFlashMode)
382+ .catchError ((_) {
383+ validFlashModes[currentCamera]
384+ ? .remove (pickerConfig.preferredFlashMode);
385+ }),
375386 ],
376- eagerError: true ,
377387 );
378388 stopwatch.stop ();
379389 realDebugPrint ("${stopwatch .elapsed } for config's update." );
@@ -747,7 +757,7 @@ class CameraPickerState extends State<CameraPicker>
747757 isShootingButtonAnimate = false ;
748758 });
749759 }
750- if (controller .value.isRecordingVideo) {
760+ if (innerController ? .value.isRecordingVideo == true ) {
751761 lastShootingButtonPressedPosition = null ;
752762 safeSetState (() {});
753763 stopRecordingVideo ();
@@ -869,20 +879,23 @@ class CameraPickerState extends State<CameraPicker>
869879 ////////////////////////////////////////////////////////////////////////////
870880
871881 PointerUpEventListener ? get onPointerUp {
872- if (enableRecording && ! enableTapRecording) {
882+ if (innerController != null && enableRecording && ! enableTapRecording) {
873883 return recordDetectionCancel;
874884 }
875885 return null ;
876886 }
877887
878888 PointerMoveEventListener ? onPointerMove (BoxConstraints c) {
879- if (enablePullToZoomInRecord) {
889+ if (innerController != null && enablePullToZoomInRecord) {
880890 return (PointerMoveEvent e) => onShootingButtonMove (e, c);
881891 }
882892 return null ;
883893 }
884894
885895 GestureTapCallback ? get onTap {
896+ if (innerController == null ) {
897+ return null ;
898+ }
886899 if (enableTapRecording) {
887900 if (innerController? .value.isRecordingVideo ?? false ) {
888901 return stopRecordingVideo;
@@ -901,6 +914,9 @@ class CameraPickerState extends State<CameraPicker>
901914 }
902915
903916 String ? get onTapHint {
917+ if (innerController == null ) {
918+ return null ;
919+ }
904920 if (enableTapRecording) {
905921 if (innerController? .value.isRecordingVideo ?? false ) {
906922 return textDelegate.sActionStopRecordingHint;
@@ -914,13 +930,19 @@ class CameraPickerState extends State<CameraPicker>
914930 }
915931
916932 GestureLongPressCallback ? get onLongPress {
933+ if (innerController == null ) {
934+ return null ;
935+ }
917936 if (enableRecording && ! enableTapRecording) {
918937 return recordDetection;
919938 }
920939 return null ;
921940 }
922941
923942 String ? get onLongPressHint {
943+ if (innerController == null ) {
944+ return null ;
945+ }
924946 if (enableRecording && ! enableTapRecording) {
925947 return textDelegate.sActionRecordHint;
926948 }
0 commit comments