@@ -352,28 +352,38 @@ class CameraPickerState extends State<CameraPicker>
352
352
..start ();
353
353
await Future .wait (
354
354
< Future <void >> [
355
- if (pickerConfig.lockCaptureOrientation != null )
356
- newController
357
- .lockCaptureOrientation (pickerConfig.lockCaptureOrientation),
358
355
newController
359
356
.getExposureOffsetStepSize ()
360
- .then ((double value) => exposureStep = value),
357
+ .then ((double value) => exposureStep = value)
358
+ .catchError ((_) => exposureStep),
361
359
newController
362
360
.getMaxExposureOffset ()
363
- .then ((double value) => maxAvailableExposureOffset = value),
361
+ .then ((double value) => maxAvailableExposureOffset = value)
362
+ .catchError ((_) => maxAvailableExposureOffset),
364
363
newController
365
364
.getMinExposureOffset ()
366
- .then ((double value) => minAvailableExposureOffset = value),
365
+ .then ((double value) => minAvailableExposureOffset = value)
366
+ .catchError ((_) => minAvailableExposureOffset),
367
367
newController
368
368
.getMaxZoomLevel ()
369
- .then ((double value) => maxAvailableZoom = value),
369
+ .then ((double value) => maxAvailableZoom = value)
370
+ .catchError ((_) => maxAvailableZoom),
370
371
newController
371
372
.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 ((_) {}),
373
379
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
+ }),
375
386
],
376
- eagerError: true ,
377
387
);
378
388
stopwatch.stop ();
379
389
realDebugPrint ("${stopwatch .elapsed } for config's update." );
@@ -747,7 +757,7 @@ class CameraPickerState extends State<CameraPicker>
747
757
isShootingButtonAnimate = false ;
748
758
});
749
759
}
750
- if (controller .value.isRecordingVideo) {
760
+ if (innerController ? .value.isRecordingVideo == true ) {
751
761
lastShootingButtonPressedPosition = null ;
752
762
safeSetState (() {});
753
763
stopRecordingVideo ();
@@ -869,20 +879,23 @@ class CameraPickerState extends State<CameraPicker>
869
879
////////////////////////////////////////////////////////////////////////////
870
880
871
881
PointerUpEventListener ? get onPointerUp {
872
- if (enableRecording && ! enableTapRecording) {
882
+ if (innerController != null && enableRecording && ! enableTapRecording) {
873
883
return recordDetectionCancel;
874
884
}
875
885
return null ;
876
886
}
877
887
878
888
PointerMoveEventListener ? onPointerMove (BoxConstraints c) {
879
- if (enablePullToZoomInRecord) {
889
+ if (innerController != null && enablePullToZoomInRecord) {
880
890
return (PointerMoveEvent e) => onShootingButtonMove (e, c);
881
891
}
882
892
return null ;
883
893
}
884
894
885
895
GestureTapCallback ? get onTap {
896
+ if (innerController == null ) {
897
+ return null ;
898
+ }
886
899
if (enableTapRecording) {
887
900
if (innerController? .value.isRecordingVideo ?? false ) {
888
901
return stopRecordingVideo;
@@ -901,6 +914,9 @@ class CameraPickerState extends State<CameraPicker>
901
914
}
902
915
903
916
String ? get onTapHint {
917
+ if (innerController == null ) {
918
+ return null ;
919
+ }
904
920
if (enableTapRecording) {
905
921
if (innerController? .value.isRecordingVideo ?? false ) {
906
922
return textDelegate.sActionStopRecordingHint;
@@ -914,13 +930,19 @@ class CameraPickerState extends State<CameraPicker>
914
930
}
915
931
916
932
GestureLongPressCallback ? get onLongPress {
933
+ if (innerController == null ) {
934
+ return null ;
935
+ }
917
936
if (enableRecording && ! enableTapRecording) {
918
937
return recordDetection;
919
938
}
920
939
return null ;
921
940
}
922
941
923
942
String ? get onLongPressHint {
943
+ if (innerController == null ) {
944
+ return null ;
945
+ }
924
946
if (enableRecording && ! enableTapRecording) {
925
947
return textDelegate.sActionRecordHint;
926
948
}
0 commit comments