@@ -9,7 +9,6 @@ import 'package:camera_platform_interface/camera_platform_interface.dart';
99import 'package:flutter/foundation.dart' ;
1010import 'package:flutter/material.dart' ;
1111import 'package:flutter/services.dart' ;
12- import 'package:quiver/core.dart' ;
1312
1413import '../camera.dart' ;
1514
@@ -161,10 +160,10 @@ class CameraValue {
161160 bool ? exposurePointSupported,
162161 bool ? focusPointSupported,
163162 DeviceOrientation ? deviceOrientation,
164- Optional < DeviceOrientation > ? lockedCaptureOrientation,
165- Optional < DeviceOrientation > ? recordingOrientation,
163+ DeviceOrientation ? lockedCaptureOrientation,
164+ DeviceOrientation ? recordingOrientation,
166165 bool ? isPreviewPaused,
167- Optional < DeviceOrientation > ? previewPauseOrientation,
166+ DeviceOrientation ? previewPauseOrientation,
168167 }) {
169168 return CameraValue (
170169 isInitialized: isInitialized ?? this .isInitialized,
@@ -181,16 +180,12 @@ class CameraValue {
181180 exposurePointSupported ?? this .exposurePointSupported,
182181 focusPointSupported: focusPointSupported ?? this .focusPointSupported,
183182 deviceOrientation: deviceOrientation ?? this .deviceOrientation,
184- lockedCaptureOrientation: lockedCaptureOrientation == null
185- ? this .lockedCaptureOrientation
186- : lockedCaptureOrientation.orNull,
187- recordingOrientation: recordingOrientation == null
188- ? this .recordingOrientation
189- : recordingOrientation.orNull,
183+ lockedCaptureOrientation:
184+ lockedCaptureOrientation ?? this .lockedCaptureOrientation,
185+ recordingOrientation: recordingOrientation ?? this .recordingOrientation,
190186 isPreviewPaused: isPreviewPaused ?? this .isPreviewPaused,
191- previewPauseOrientation: previewPauseOrientation == null
192- ? this .previewPauseOrientation
193- : previewPauseOrientation.orNull,
187+ previewPauseOrientation:
188+ previewPauseOrientation ?? this .previewPauseOrientation,
194189 );
195190 }
196191
@@ -358,8 +353,8 @@ class CameraController extends ValueNotifier<CameraValue> {
358353 await CameraPlatform .instance.pausePreview (_cameraId);
359354 value = value.copyWith (
360355 isPreviewPaused: true ,
361- previewPauseOrientation: Optional < DeviceOrientation >. of (
362- value.lockedCaptureOrientation ?? value.deviceOrientation)) ;
356+ previewPauseOrientation:
357+ value.lockedCaptureOrientation ?? value.deviceOrientation);
363358 } on PlatformException catch (e) {
364359 throw CameraException (e.code, e.message);
365360 }
@@ -372,9 +367,7 @@ class CameraController extends ValueNotifier<CameraValue> {
372367 }
373368 try {
374369 await CameraPlatform .instance.resumePreview (_cameraId);
375- value = value.copyWith (
376- isPreviewPaused: false ,
377- previewPauseOrientation: const Optional <DeviceOrientation >.absent ());
370+ value = value.copyWith (isPreviewPaused: false );
378371 } on PlatformException catch (e) {
379372 throw CameraException (e.code, e.message);
380373 }
@@ -505,8 +498,8 @@ class CameraController extends ValueNotifier<CameraValue> {
505498 value = value.copyWith (
506499 isRecordingVideo: true ,
507500 isRecordingPaused: false ,
508- recordingOrientation: Optional < DeviceOrientation >. of (
509- value.lockedCaptureOrientation ?? value.deviceOrientation)) ;
501+ recordingOrientation:
502+ value.lockedCaptureOrientation ?? value.deviceOrientation);
510503 } on PlatformException catch (e) {
511504 throw CameraException (e.code, e.message);
512505 }
@@ -526,10 +519,7 @@ class CameraController extends ValueNotifier<CameraValue> {
526519 try {
527520 final XFile file =
528521 await CameraPlatform .instance.stopVideoRecording (_cameraId);
529- value = value.copyWith (
530- isRecordingVideo: false ,
531- recordingOrientation: const Optional <DeviceOrientation >.absent (),
532- );
522+ value = value.copyWith (isRecordingVideo: false );
533523 return file;
534524 } on PlatformException catch (e) {
535525 throw CameraException (e.code, e.message);
@@ -747,8 +737,7 @@ class CameraController extends ValueNotifier<CameraValue> {
747737 await CameraPlatform .instance.lockCaptureOrientation (
748738 _cameraId, orientation ?? value.deviceOrientation);
749739 value = value.copyWith (
750- lockedCaptureOrientation: Optional <DeviceOrientation >.of (
751- orientation ?? value.deviceOrientation));
740+ lockedCaptureOrientation: orientation ?? value.deviceOrientation);
752741 } on PlatformException catch (e) {
753742 throw CameraException (e.code, e.message);
754743 }
@@ -768,8 +757,7 @@ class CameraController extends ValueNotifier<CameraValue> {
768757 Future <void > unlockCaptureOrientation () async {
769758 try {
770759 await CameraPlatform .instance.unlockCaptureOrientation (_cameraId);
771- value = value.copyWith (
772- lockedCaptureOrientation: const Optional <DeviceOrientation >.absent ());
760+ value = value.copyWith ();
773761 } on PlatformException catch (e) {
774762 throw CameraException (e.code, e.message);
775763 }
0 commit comments