@@ -27,13 +27,13 @@ void main() {
27
27
28
28
final Map <ResolutionPreset , Size > presetExpectedSizes =
29
29
< ResolutionPreset , Size > {
30
- ResolutionPreset .low: const Size (240 , 320 ),
31
- ResolutionPreset .medium: const Size (480 , 720 ),
32
- ResolutionPreset .high: const Size (720 , 1280 ),
33
- ResolutionPreset .veryHigh: const Size (1080 , 1920 ),
34
- ResolutionPreset .ultraHigh: const Size (2160 , 3840 ),
35
- // Don't bother checking for max here since it could be anything.
36
- };
30
+ ResolutionPreset .low: const Size (240 , 320 ),
31
+ ResolutionPreset .medium: const Size (480 , 720 ),
32
+ ResolutionPreset .high: const Size (720 , 1280 ),
33
+ ResolutionPreset .veryHigh: const Size (1080 , 1920 ),
34
+ ResolutionPreset .ultraHigh: const Size (2160 , 3840 ),
35
+ // Don't bother checking for max here since it could be anything.
36
+ };
37
37
38
38
/// Verify that [actual] has dimensions that are at most as large as
39
39
/// [expectedSize] . Allows for a mismatch in portrait vs landscape. Returns
@@ -45,20 +45,24 @@ void main() {
45
45
actual.longestSide == expectedSize.longestSide;
46
46
}
47
47
48
- testWidgets ('availableCameras only supports valid back or front cameras' ,
49
- (WidgetTester tester) async {
48
+ testWidgets ('availableCameras only supports valid back or front cameras' , (
49
+ WidgetTester tester,
50
+ ) async {
50
51
final List <CameraDescription > availableCameras =
51
52
await CameraPlatform .instance.availableCameras ();
52
53
53
54
for (final CameraDescription cameraDescription in availableCameras) {
54
55
expect (
55
- cameraDescription.lensDirection, isNot (CameraLensDirection .external ));
56
+ cameraDescription.lensDirection,
57
+ isNot (CameraLensDirection .external ),
58
+ );
56
59
expect (cameraDescription.sensorOrientation, anyOf (0 , 90 , 180 , 270 ));
57
60
}
58
61
});
59
62
60
- testWidgets ('Preview takes expected resolution from preset' ,
61
- (WidgetTester tester) async {
63
+ testWidgets ('Preview takes expected resolution from preset' , (
64
+ WidgetTester tester,
65
+ ) async {
62
66
final List <CameraDescription > cameras =
63
67
await CameraPlatform .instance.availableCameras ();
64
68
if (cameras.isEmpty) {
@@ -80,21 +84,26 @@ void main() {
80
84
}
81
85
82
86
final bool presetExactlySupported = assertExpectedDimensions (
83
- preset.value, controller.value.previewSize! );
87
+ preset.value,
88
+ controller.value.previewSize! ,
89
+ );
84
90
// Ensures that if a lower resolution was used for previous (lower)
85
91
// resolution preset, then the current (higher) preset also is adjusted,
86
92
// as it demands a hgher resolution.
87
93
expect (
88
- previousPresetExactlySupported || ! presetExactlySupported, isTrue,
89
- reason: 'The preview has a lower resolution than that specified.' );
94
+ previousPresetExactlySupported || ! presetExactlySupported,
95
+ isTrue,
96
+ reason: 'The preview has a lower resolution than that specified.' ,
97
+ );
90
98
previousPresetExactlySupported = presetExactlySupported;
91
99
await controller.dispose ();
92
100
}
93
101
}
94
102
});
95
103
96
- testWidgets ('Images from streaming have expected resolution from preset' ,
97
- (WidgetTester tester) async {
104
+ testWidgets ('Images from streaming have expected resolution from preset' , (
105
+ WidgetTester tester,
106
+ ) async {
98
107
final List <CameraDescription > cameras =
99
108
await CameraPlatform .instance.availableCameras ();
100
109
if (cameras.isEmpty) {
@@ -117,14 +126,17 @@ void main() {
117
126
118
127
final CameraImage image = await imageCompleter.future;
119
128
final bool presetExactlySupported = assertExpectedDimensions (
120
- preset.value,
121
- Size (image.height.toDouble (), image.width.toDouble ()));
129
+ preset.value,
130
+ Size (image.height.toDouble (), image.width.toDouble ()),
131
+ );
122
132
// Ensures that if a lower resolution was used for previous (lower)
123
133
// resolution preset, then the current (higher) preset also is adjusted,
124
134
// as it demands a hgher resolution.
125
135
expect (
126
- previousPresetExactlySupported || ! presetExactlySupported, isTrue,
127
- reason: 'The preview has a lower resolution than that specified.' );
136
+ previousPresetExactlySupported || ! presetExactlySupported,
137
+ isTrue,
138
+ reason: 'The preview has a lower resolution than that specified.' ,
139
+ );
128
140
previousPresetExactlySupported = presetExactlySupported;
129
141
130
142
await controller.dispose ();
@@ -138,9 +150,12 @@ void main() {
138
150
return ;
139
151
}
140
152
141
- final CameraController controller = CameraController (cameras[0 ],
142
- mediaSettings:
143
- const MediaSettings (resolutionPreset: ResolutionPreset .low));
153
+ final CameraController controller = CameraController (
154
+ cameras[0 ],
155
+ mediaSettings: const MediaSettings (
156
+ resolutionPreset: ResolutionPreset .low,
157
+ ),
158
+ );
144
159
await controller.initialize ();
145
160
await controller.prepareForVideoRecording ();
146
161
@@ -170,9 +185,12 @@ void main() {
170
185
return ;
171
186
}
172
187
173
- final CameraController controller = CameraController (cameras[0 ],
174
- mediaSettings:
175
- const MediaSettings (resolutionPreset: ResolutionPreset .low));
188
+ final CameraController controller = CameraController (
189
+ cameras[0 ],
190
+ mediaSettings: const MediaSettings (
191
+ resolutionPreset: ResolutionPreset .low,
192
+ ),
193
+ );
176
194
await controller.initialize ();
177
195
await controller.prepareForVideoRecording ();
178
196
0 commit comments