@@ -304,7 +304,7 @@ class CameraPickerState extends State<CameraPicker>
304
304
///
305
305
/// 对于 [CameraController] 的方法增加是否无效的控制。
306
306
/// 如果 [T] 是非 void 且方法无效,返回 [fallback] 。
307
- Future <T > wrapControllerMethod <T >(
307
+ Future <T ? > wrapControllerMethod <T >(
308
308
String key,
309
309
Future <T > Function () method, {
310
310
CameraDescription ? description,
@@ -313,7 +313,7 @@ class CameraPickerState extends State<CameraPicker>
313
313
}) async {
314
314
description ?? = currentCamera;
315
315
if (invalidControllerMethods[description]! .contains (key)) {
316
- return fallback! ;
316
+ return fallback;
317
317
}
318
318
try {
319
319
return await method ();
@@ -431,37 +431,37 @@ class CameraPickerState extends State<CameraPicker>
431
431
() => newController.getExposureOffsetStepSize (),
432
432
description: description,
433
433
fallback: exposureStep,
434
- ).then ((value) => exposureStep = value),
434
+ ).then ((value) => exposureStep = value! ),
435
435
wrapControllerMethod (
436
436
'getMaxExposureOffset' ,
437
437
() => newController.getMaxExposureOffset (),
438
438
description: description,
439
439
fallback: maxAvailableExposureOffset,
440
- ).then ((value) => maxAvailableExposureOffset = value),
440
+ ).then ((value) => maxAvailableExposureOffset = value! ),
441
441
wrapControllerMethod (
442
442
'getMinExposureOffset' ,
443
443
() => newController.getMinExposureOffset (),
444
444
description: description,
445
445
fallback: minAvailableExposureOffset,
446
- ).then ((value) => minAvailableExposureOffset = value),
446
+ ).then ((value) => minAvailableExposureOffset = value! ),
447
447
wrapControllerMethod (
448
448
'getMaxZoomLevel' ,
449
449
() => newController.getMaxZoomLevel (),
450
450
description: description,
451
451
fallback: maxAvailableZoom,
452
- ).then ((value) => maxAvailableZoom = value),
452
+ ).then ((value) => maxAvailableZoom = value! ),
453
453
wrapControllerMethod (
454
454
'getMinZoomLevel' ,
455
455
() => newController.getMinZoomLevel (),
456
456
description: description,
457
457
fallback: minAvailableZoom,
458
- ).then ((value) => minAvailableZoom = value),
458
+ ).then ((value) => minAvailableZoom = value! ),
459
459
wrapControllerMethod (
460
460
'getMinZoomLevel' ,
461
461
() => newController.getMinZoomLevel (),
462
462
description: description,
463
463
fallback: minAvailableZoom,
464
- ).then ((value) => minAvailableZoom = value),
464
+ ).then ((value) => minAvailableZoom = value! ),
465
465
if (pickerConfig.lockCaptureOrientation != null )
466
466
wrapControllerMethod <void >(
467
467
'lockCaptureOrientation' ,
@@ -1172,6 +1172,13 @@ class CameraPickerState extends State<CameraPicker>
1172
1172
/// This displayed at the top of the screen.
1173
1173
/// 该区域显示在屏幕上方。
1174
1174
Widget buildSettingActions (BuildContext context) {
1175
+ if (innerController == null ) {
1176
+ return Container (
1177
+ alignment: AlignmentDirectional .topStart,
1178
+ padding: const EdgeInsets .symmetric (horizontal: 12 ),
1179
+ child: buildBackButton (context),
1180
+ );
1181
+ }
1175
1182
return buildInitializeWrapper (
1176
1183
builder: (CameraValue v, __) {
1177
1184
if (v.isRecordingVideo) {
@@ -1787,7 +1794,6 @@ class CameraPickerState extends State<CameraPicker>
1787
1794
children: < Widget > [
1788
1795
Semantics (
1789
1796
sortKey: const OrdinalSortKey (0 ),
1790
- hidden: innerController == null ,
1791
1797
child: buildSettingActions (context),
1792
1798
),
1793
1799
const Spacer (),
0 commit comments