@@ -654,15 +654,9 @@ class CameraPickerState extends State<CameraPicker>
654
654
_controller = null ;
655
655
});
656
656
});
657
- final AssetEntity ? entity = await CameraPickerViewer .pushToViewer (
658
- context,
659
- pickerState: this ,
660
- pickerType: CameraPickerViewType .image,
661
- previewXFile: _file,
662
- theme: theme,
663
- shouldDeletePreviewFile: shouldDeletePreviewFile,
664
- shouldAutoPreviewVideo: shouldAutoPreviewVideo,
665
- onEntitySaving: config.onEntitySaving,
657
+ final AssetEntity ? entity = await _pushToViewer (
658
+ file: _file,
659
+ viewType: CameraPickerViewType .image,
666
660
);
667
661
if (entity != null ) {
668
662
Navigator .of (context).pop (entity);
@@ -748,14 +742,9 @@ class CameraPickerState extends State<CameraPicker>
748
742
749
743
if (controller.value.isRecordingVideo) {
750
744
controller.stopVideoRecording ().then ((XFile file) async {
751
- final AssetEntity ? entity = await CameraPickerViewer .pushToViewer (
752
- context,
753
- pickerState: this ,
754
- pickerType: CameraPickerViewType .video,
755
- previewXFile: file,
756
- theme: theme,
757
- shouldDeletePreviewFile: shouldDeletePreviewFile,
758
- shouldAutoPreviewVideo: shouldAutoPreviewVideo,
745
+ final AssetEntity ? entity = await _pushToViewer (
746
+ file: file,
747
+ viewType: CameraPickerViewType .video,
759
748
);
760
749
if (entity != null ) {
761
750
Navigator .of (context).pop (entity);
@@ -775,6 +764,23 @@ class CameraPickerState extends State<CameraPicker>
775
764
_handleError ();
776
765
}
777
766
767
+ Future <AssetEntity ?> _pushToViewer ({
768
+ required XFile file,
769
+ required CameraPickerViewType viewType,
770
+ }) {
771
+ return CameraPickerViewer .pushToViewer (
772
+ context,
773
+ pickerState: this ,
774
+ pickerType: viewType,
775
+ previewXFile: file,
776
+ theme: theme,
777
+ shouldDeletePreviewFile: shouldDeletePreviewFile,
778
+ shouldAutoPreviewVideo: shouldAutoPreviewVideo,
779
+ onEntitySaving: config.onEntitySaving,
780
+ onError: config.onError,
781
+ );
782
+ }
783
+
778
784
////////////////////////////////////////////////////////////////////////////
779
785
////////////////////////////////////////////////////////////////////////////
780
786
/////////////////////////// Just a line breaker ////////////////////////////
0 commit comments