Skip to content

Commit 4db1858

Browse files
committed
Fix examples analyze
1 parent fcf095c commit 4db1858

File tree

3 files changed

+21
-47
lines changed

3 files changed

+21
-47
lines changed

packages/camera/camera/lib/src/camera_controller.dart

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:camera_platform_interface/camera_platform_interface.dart';
99
import 'package:flutter/foundation.dart';
1010
import 'package:flutter/material.dart';
1111
import 'package:flutter/services.dart';
12-
import 'package:quiver/core.dart';
1312

1413
import '../camera.dart';
1514

@@ -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

@@ -372,8 +367,7 @@ class CameraController extends ValueNotifier<CameraValue> {
372367
}
373368
try {
374369
await CameraPlatform.instance.resumePreview(_cameraId);
375-
value =
376-
value.copyWith(isPreviewPaused: false, previewPauseOrientation: null);
370+
value = value.copyWith(isPreviewPaused: false);
377371
} on PlatformException catch (e) {
378372
throw CameraException(e.code, e.message);
379373
}
@@ -525,8 +519,7 @@ class CameraController extends ValueNotifier<CameraValue> {
525519
try {
526520
final XFile file =
527521
await CameraPlatform.instance.stopVideoRecording(_cameraId);
528-
value =
529-
value.copyWith(isRecordingVideo: false, recordingOrientation: null);
522+
value = value.copyWith(isRecordingVideo: false);
530523
return file;
531524
} on PlatformException catch (e) {
532525
throw CameraException(e.code, e.message);
@@ -764,7 +757,7 @@ class CameraController extends ValueNotifier<CameraValue> {
764757
Future<void> unlockCaptureOrientation() async {
765758
try {
766759
await CameraPlatform.instance.unlockCaptureOrientation(_cameraId);
767-
value = value.copyWith(lockedCaptureOrientation: null);
760+
value = value.copyWith();
768761
} on PlatformException catch (e) {
769762
throw CameraException(e.code, e.message);
770763
}

packages/camera/camera_android/example/lib/camera_controller.dart

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'package:camera_platform_interface/camera_platform_interface.dart';
88
import 'package:flutter/foundation.dart';
99
import 'package:flutter/material.dart';
1010
import 'package:flutter/services.dart';
11-
import 'package:quiver/core.dart';
1211

1312
/// The state of a [CameraController].
1413
class CameraValue {
@@ -108,7 +107,6 @@ class CameraValue {
108107
FocusMode? focusMode,
109108
bool? exposurePointSupported,
110109
bool? focusPointSupported,
111-
bool? isPreviewPaused,
112110
DeviceOrientation? deviceOrientation,
113111
DeviceOrientation? lockedCaptureOrientation,
114112
DeviceOrientation? recordingOrientation,
@@ -126,16 +124,12 @@ class CameraValue {
126124
exposureMode: exposureMode ?? this.exposureMode,
127125
focusMode: focusMode ?? this.focusMode,
128126
deviceOrientation: deviceOrientation ?? this.deviceOrientation,
129-
lockedCaptureOrientation: lockedCaptureOrientation == null
130-
? this.lockedCaptureOrientation
131-
: lockedCaptureOrientation.orNull,
132-
recordingOrientation: recordingOrientation == null
133-
? this.recordingOrientation
134-
: recordingOrientation.orNull,
127+
lockedCaptureOrientation:
128+
lockedCaptureOrientation ?? this.lockedCaptureOrientation,
129+
recordingOrientation: recordingOrientation ?? this.recordingOrientation,
135130
isPreviewPaused: isPreviewPaused ?? this.isPreviewPaused,
136-
previewPauseOrientation: previewPauseOrientation == null
137-
? this.previewPauseOrientation
138-
: previewPauseOrientation.orNull,
131+
previewPauseOrientation:
132+
previewPauseOrientation ?? this.previewPauseOrientation,
139133
);
140134
}
141135

@@ -270,8 +264,7 @@ class CameraController extends ValueNotifier<CameraValue> {
270264
/// Resumes the current camera preview
271265
Future<void> resumePreview() async {
272266
await CameraPlatform.instance.resumePreview(_cameraId);
273-
value =
274-
value.copyWith(isPreviewPaused: false, previewPauseOrientation: null);
267+
value = value.copyWith(isPreviewPaused: false);
275268
}
276269

277270
/// Captures an image and returns the file where it was saved.
@@ -331,7 +324,6 @@ class CameraController extends ValueNotifier<CameraValue> {
331324
value = value.copyWith(
332325
isRecordingVideo: false,
333326
isRecordingPaused: false,
334-
recordingOrientation: null,
335327
);
336328
return file;
337329
}
@@ -406,7 +398,6 @@ class CameraController extends ValueNotifier<CameraValue> {
406398
/// Unlocks the capture orientation.
407399
Future<void> unlockCaptureOrientation() async {
408400
await CameraPlatform.instance.unlockCaptureOrientation(_cameraId);
409-
value = value.copyWith(lockedCaptureOrientation: null);
410401
}
411402

412403
/// Sets the focus mode for taking pictures.

packages/camera/camera_avfoundation/example/lib/camera_controller.dart

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'package:camera_platform_interface/camera_platform_interface.dart';
88
import 'package:flutter/foundation.dart';
99
import 'package:flutter/material.dart';
1010
import 'package:flutter/services.dart';
11-
import 'package:quiver/core.dart';
1211

1312
/// The state of a [CameraController].
1413
class CameraValue {
@@ -125,16 +124,12 @@ class CameraValue {
125124
exposureMode: exposureMode ?? this.exposureMode,
126125
focusMode: focusMode ?? this.focusMode,
127126
deviceOrientation: deviceOrientation ?? this.deviceOrientation,
128-
lockedCaptureOrientation: lockedCaptureOrientation == null
129-
? this.lockedCaptureOrientation
130-
: lockedCaptureOrientation.orNull,
131-
recordingOrientation: recordingOrientation == null
132-
? this.recordingOrientation
133-
: recordingOrientation.orNull,
127+
lockedCaptureOrientation:
128+
lockedCaptureOrientation ?? this.lockedCaptureOrientation,
129+
recordingOrientation: recordingOrientation ?? this.recordingOrientation,
134130
isPreviewPaused: isPreviewPaused ?? this.isPreviewPaused,
135-
previewPauseOrientation: previewPauseOrientation == null
136-
? this.previewPauseOrientation
137-
: previewPauseOrientation.orNull,
131+
previewPauseOrientation:
132+
previewPauseOrientation ?? this.previewPauseOrientation,
138133
);
139134
}
140135

@@ -269,8 +264,7 @@ class CameraController extends ValueNotifier<CameraValue> {
269264
/// Resumes the current camera preview
270265
Future<void> resumePreview() async {
271266
await CameraPlatform.instance.resumePreview(_cameraId);
272-
value =
273-
value.copyWith(isPreviewPaused: false, previewPauseOrientation: null);
267+
value = value.copyWith(isPreviewPaused: false);
274268
}
275269

276270
/// Captures an image and returns the file where it was saved.
@@ -327,10 +321,7 @@ class CameraController extends ValueNotifier<CameraValue> {
327321

328322
final XFile file =
329323
await CameraPlatform.instance.stopVideoRecording(_cameraId);
330-
value = value.copyWith(
331-
isRecordingVideo: false,
332-
recordingOrientation: null,
333-
);
324+
value = value.copyWith(isRecordingVideo: false);
334325
return file;
335326
}
336327

@@ -404,7 +395,6 @@ class CameraController extends ValueNotifier<CameraValue> {
404395
/// Unlocks the capture orientation.
405396
Future<void> unlockCaptureOrientation() async {
406397
await CameraPlatform.instance.unlockCaptureOrientation(_cameraId);
407-
value = value.copyWith(lockedCaptureOrientation: null);
408398
}
409399

410400
/// Sets the focus mode for taking pictures.

0 commit comments

Comments
 (0)