@@ -9,7 +9,6 @@ import 'package:camera_platform_interface/camera_platform_interface.dart';
9
9
import 'package:flutter/foundation.dart' ;
10
10
import 'package:flutter/material.dart' ;
11
11
import 'package:flutter/services.dart' ;
12
- import 'package:quiver/core.dart' ;
13
12
14
13
import '../camera.dart' ;
15
14
@@ -161,10 +160,10 @@ class CameraValue {
161
160
bool ? exposurePointSupported,
162
161
bool ? focusPointSupported,
163
162
DeviceOrientation ? deviceOrientation,
164
- Optional < DeviceOrientation > ? lockedCaptureOrientation,
165
- Optional < DeviceOrientation > ? recordingOrientation,
163
+ DeviceOrientation ? lockedCaptureOrientation,
164
+ DeviceOrientation ? recordingOrientation,
166
165
bool ? isPreviewPaused,
167
- Optional < DeviceOrientation > ? previewPauseOrientation,
166
+ DeviceOrientation ? previewPauseOrientation,
168
167
}) {
169
168
return CameraValue (
170
169
isInitialized: isInitialized ?? this .isInitialized,
@@ -181,16 +180,12 @@ class CameraValue {
181
180
exposurePointSupported ?? this .exposurePointSupported,
182
181
focusPointSupported: focusPointSupported ?? this .focusPointSupported,
183
182
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,
190
186
isPreviewPaused: isPreviewPaused ?? this .isPreviewPaused,
191
- previewPauseOrientation: previewPauseOrientation == null
192
- ? this .previewPauseOrientation
193
- : previewPauseOrientation.orNull,
187
+ previewPauseOrientation:
188
+ previewPauseOrientation ?? this .previewPauseOrientation,
194
189
);
195
190
}
196
191
@@ -358,8 +353,8 @@ class CameraController extends ValueNotifier<CameraValue> {
358
353
await CameraPlatform .instance.pausePreview (_cameraId);
359
354
value = value.copyWith (
360
355
isPreviewPaused: true ,
361
- previewPauseOrientation: Optional < DeviceOrientation >. of (
362
- value.lockedCaptureOrientation ?? value.deviceOrientation)) ;
356
+ previewPauseOrientation:
357
+ value.lockedCaptureOrientation ?? value.deviceOrientation);
363
358
} on PlatformException catch (e) {
364
359
throw CameraException (e.code, e.message);
365
360
}
@@ -372,9 +367,7 @@ class CameraController extends ValueNotifier<CameraValue> {
372
367
}
373
368
try {
374
369
await CameraPlatform .instance.resumePreview (_cameraId);
375
- value = value.copyWith (
376
- isPreviewPaused: false ,
377
- previewPauseOrientation: const Optional <DeviceOrientation >.absent ());
370
+ value = value.copyWith (isPreviewPaused: false );
378
371
} on PlatformException catch (e) {
379
372
throw CameraException (e.code, e.message);
380
373
}
@@ -505,8 +498,8 @@ class CameraController extends ValueNotifier<CameraValue> {
505
498
value = value.copyWith (
506
499
isRecordingVideo: true ,
507
500
isRecordingPaused: false ,
508
- recordingOrientation: Optional < DeviceOrientation >. of (
509
- value.lockedCaptureOrientation ?? value.deviceOrientation)) ;
501
+ recordingOrientation:
502
+ value.lockedCaptureOrientation ?? value.deviceOrientation);
510
503
} on PlatformException catch (e) {
511
504
throw CameraException (e.code, e.message);
512
505
}
@@ -526,10 +519,7 @@ class CameraController extends ValueNotifier<CameraValue> {
526
519
try {
527
520
final XFile file =
528
521
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 );
533
523
return file;
534
524
} on PlatformException catch (e) {
535
525
throw CameraException (e.code, e.message);
@@ -747,8 +737,7 @@ class CameraController extends ValueNotifier<CameraValue> {
747
737
await CameraPlatform .instance.lockCaptureOrientation (
748
738
_cameraId, orientation ?? value.deviceOrientation);
749
739
value = value.copyWith (
750
- lockedCaptureOrientation: Optional <DeviceOrientation >.of (
751
- orientation ?? value.deviceOrientation));
740
+ lockedCaptureOrientation: orientation ?? value.deviceOrientation);
752
741
} on PlatformException catch (e) {
753
742
throw CameraException (e.code, e.message);
754
743
}
@@ -768,8 +757,7 @@ class CameraController extends ValueNotifier<CameraValue> {
768
757
Future <void > unlockCaptureOrientation () async {
769
758
try {
770
759
await CameraPlatform .instance.unlockCaptureOrientation (_cameraId);
771
- value = value.copyWith (
772
- lockedCaptureOrientation: const Optional <DeviceOrientation >.absent ());
760
+ value = value.copyWith ();
773
761
} on PlatformException catch (e) {
774
762
throw CameraException (e.code, e.message);
775
763
}
0 commit comments