@@ -232,6 +232,9 @@ class CameraPickerState extends State<CameraPicker>
232232  /// The locked capture orientation of the current camera instance. 
233233DeviceOrientation ?  lockedCaptureOrientation;
234234
235+   /// The calculated capture actions section height. 
236+ double ?  lastCaptureActionsEffectiveHeight;
237+ 
235238  @override 
236239  void  initState () {
237240    super .initState ();
@@ -684,10 +687,10 @@ class CameraPickerState extends State<CameraPicker>
684687  /// 处理双指缩放更新 
685688Future <void > handleScaleUpdate (ScaleUpdateDetails  details) async  {
686689    // When there are not exactly two fingers on screen don't scale 
687-     if  (pointers !=  2 ) {
690+     if  (innerController  ==   null   ||   pointers !=  2 ) {
688691      return ;
689692    }
690-     zoom (details.scale);
693+     zoom (details.scale  *   2   -   1 );
691694  }
692695
693696  void  restartExposurePointDisplayTimer () {
@@ -926,17 +929,16 @@ class CameraPickerState extends State<CameraPicker>
926929        Navigator .of (context).pop (entity);
927930        return ;
928931      }
929-       await  Future .wait (< Future <void >> [
932+       wrapControllerMethod <void >(
933+         'setFocusMode' ,
934+         () =>  controller.setFocusMode (FocusMode .auto),
935+       );
936+       if  (previousExposureMode !=  ExposureMode .locked) {
930937        wrapControllerMethod <void >(
931-           'setFocusMode' ,
932-           () =>  controller.setFocusMode (FocusMode .auto),
933-         ),
934-         if  (previousExposureMode !=  ExposureMode .locked)
935-           wrapControllerMethod <void >(
936-             'setExposureMode' ,
937-             () =>  controller.setExposureMode (previousExposureMode),
938-           ),
939-       ]);
938+           'setExposureMode' ,
939+           () =>  controller.setExposureMode (previousExposureMode),
940+         );
941+       }
940942      await  controller.resumePreview ();
941943    } catch  (e, s) {
942944      handleErrorWithHandler (e, s, pickerConfig.onError);
@@ -1283,8 +1285,9 @@ class CameraPickerState extends State<CameraPicker>
12831285    return  AnimatedOpacity (
12841286      duration:  recordDetectDuration,
12851287      opacity:  controller? .value.isRecordingVideo ??  false  ?  0  :  1 ,
1286-       child:  Padding (
1287-         padding:  const  EdgeInsets .all (20 ),
1288+       child:  Container (
1289+         height:  48.0 ,
1290+         alignment:  Alignment .center,
12881291        child:  Text (
12891292          tips,
12901293          style:  const  TextStyle (fontSize:  15 ),
@@ -1304,13 +1307,15 @@ class CameraPickerState extends State<CameraPicker>
13041307    required  BoxConstraints  constraints,
13051308    CameraController ?  controller,
13061309  }) {
1307-     const  fallbackSize =  184 .0
1310+     const  fallbackSize =  150 .0
13081311    final  previewSize =  controller? .value.previewSize;
13091312    final  orientation =  controller? .value.deviceOrientation ?? 
13101313        MediaQuery .orientationOf (context);
13111314    final  isPortrait =  orientation.toString ().contains ('portrait' );
13121315    double  effectiveSize;
1313-     if  (previewSize !=  null ) {
1316+     if  (controller ==  null  ||  pickerConfig.enableScaledPreview) {
1317+       effectiveSize =  lastCaptureActionsEffectiveHeight ??  fallbackSize;
1318+     } else  if  (previewSize !=  null ) {
13141319      Size  constraintSize =  Size (constraints.maxWidth, constraints.maxHeight);
13151320      if  (isPortrait &&  constraintSize.aspectRatio >  1  || 
13161321          ! isPortrait &&  constraintSize.aspectRatio <  1 ) {
@@ -1323,9 +1328,11 @@ class CameraPickerState extends State<CameraPicker>
13231328        effectiveSize =  constraintSize.width - 
13241329            constraintSize.height *  previewSize.aspectRatio;
13251330      }
1331+     } else  if  (lastCaptureActionsEffectiveHeight !=  null ) {
1332+       effectiveSize =  lastCaptureActionsEffectiveHeight! ;
13261333    } else  {
13271334      // Fallback to a reasonable height. 
1328-       effectiveSize =  184.0 ;
1335+       effectiveSize =  fallbackSize ;
13291336    }
13301337    if  (effectiveSize <=  0 ) {
13311338      realDebugPrint (
@@ -1334,11 +1341,14 @@ class CameraPickerState extends State<CameraPicker>
13341341        'orientation: $orientation ' ,
13351342      );
13361343      effectiveSize =  fallbackSize;
1344+     } else  if  (effectiveSize <  fallbackSize) {
1345+       effectiveSize =  fallbackSize;
13371346    }
1338- 
1339-     return  SizedBox (
1347+     lastCaptureActionsEffectiveHeight  =  effectiveSize; 
1348+     return  Container (
13401349      width:  isPortrait ?  null  :  effectiveSize,
13411350      height:  isPortrait ?  effectiveSize :  null ,
1351+       padding:  EdgeInsets .only (bottom:  MediaQuery .paddingOf (context).bottom),
13421352      child:  Flex (
13431353        direction:  isPortrait ?  Axis .horizontal :  Axis .vertical,
13441354        verticalDirection:  orientation ==  DeviceOrientation .landscapeLeft
@@ -1670,8 +1680,8 @@ class CameraPickerState extends State<CameraPicker>
16701680      image:  true ,
16711681      onTap:  () {
16721682        // Focus on the center point when using semantics tap. 
1673-         final  Size   size =  MediaQuery .of (context).size ;
1674-         final  TapUpDetails   details =  TapUpDetails (
1683+         final  size =  MediaQuery .sizeOf (context);
1684+         final  details =  TapUpDetails (
16751685          kind:  PointerDeviceKind .touch,
16761686          globalPosition:  Offset (size.width /  2 , size.height /  2 ),
16771687        );
@@ -1752,22 +1762,6 @@ class CameraPickerState extends State<CameraPicker>
17521762      preview =  Stack (
17531763        children:  < Widget > [
17541764          preview,
1755-           Positioned .fill (
1756-             child:  ExcludeSemantics (
1757-               child:  RotatedBox (
1758-                 quarterTurns:  cameraQuarterTurns,
1759-                 child:  Align (
1760-                   alignment:  {
1761-                     DeviceOrientation .portraitUp:  Alignment .bottomCenter,
1762-                     DeviceOrientation .portraitDown:  Alignment .topCenter,
1763-                     DeviceOrientation .landscapeLeft:  Alignment .centerRight,
1764-                     DeviceOrientation .landscapeRight:  Alignment .centerLeft,
1765-                   }[cameraValue.deviceOrientation]! ,
1766-                   child:  buildCaptureTips (innerController),
1767-                 ),
1768-               ),
1769-             ),
1770-           ),
17711765          if  (pickerConfig.enableSetExposure)
17721766            buildExposureDetector (context, constraints),
17731767          buildFocusingPoint (
@@ -1827,9 +1821,10 @@ class CameraPickerState extends State<CameraPicker>
18271821    BoxConstraints  constraints,
18281822    DeviceOrientation ?  deviceOrientation,
18291823  ) {
1830-     final  orientation =  deviceOrientation ??  MediaQuery .of (context).orientation ;
1824+     final  orientation =  deviceOrientation ??  MediaQuery .orientationOf (context);
18311825    final  isPortrait =  orientation.toString ().contains ('portrait' );
18321826    return  SafeArea (
1827+       bottom:  false ,
18331828      child:  Flex (
18341829        direction:  isPortrait ?  Axis .vertical :  Axis .horizontal,
18351830        textDirection:  orientation ==  DeviceOrientation .landscapeRight
@@ -1844,8 +1839,7 @@ class CameraPickerState extends State<CameraPicker>
18441839            child:  buildSettingActions (context),
18451840          ),
18461841          const  Spacer (),
1847-           if  (enableScaledPreview)
1848-             ExcludeSemantics (child:  buildCaptureTips (innerController)),
1842+           ExcludeSemantics (child:  buildCaptureTips (innerController)),
18491843          Semantics (
18501844            sortKey:  const  OrdinalSortKey (2 ),
18511845            hidden:  innerController ==  null ,
@@ -1907,8 +1901,8 @@ class CameraPickerState extends State<CameraPicker>
19071901            image:  true ,
19081902            onTap:  () {
19091903              // Focus on the center point when using semantics tap. 
1910-               final  Size   size =  MediaQuery .of (context).size ;
1911-               final  TapUpDetails   details =  TapUpDetails (
1904+               final  size =  MediaQuery .sizeOf (context);
1905+               final  details =  TapUpDetails (
19121906                kind:  PointerDeviceKind .touch,
19131907                globalPosition:  Offset (size.width /  2 , size.height /  2 ),
19141908              );
0 commit comments