Bladeren bron

update(mobile): 接入测量页截图

gavin.chen 2 jaren geleden
bovenliggende
commit
7683aabf82
2 gewijzigde bestanden met toevoegingen van 12 en 18 verwijderingen
  1. 9 17
      lib/view/mobile_view/mobile_measure_main_view.dart
  2. 3 1
      lib/view/mobile_view/mobile_top_menu.dart

+ 9 - 17
lib/view/mobile_view/mobile_measure_main_view.dart

@@ -62,7 +62,7 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
   late final aiPatintController = Get.find<AiPatintController>();
 
   late bool enableCarotid2DMeasure = false;
-  bool isCaptureState = false;
+  bool isCaptureState = false; // 是否是截图状态,按钮隐藏
   late double calibrationLine = 4;
   final List<OutputItem> outputs = [];
 
@@ -156,8 +156,9 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
 
   /// 保存图片
   void capturePng() async {
-    isCaptureState = true;
-    setState(() {});
+    setState(() {
+      isCaptureState = true;
+    });
     for (var item in application.measureItems) {
       if (item.calculator != null) {
         // 添加历史测量值
@@ -193,7 +194,7 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
           measureData.measureImageData.remedicalCode ?? '',
           measureResult.toDisplay(),
         );
-        isCaptureState = false;
+
         Future.delayed(
           const Duration(
             milliseconds: 600,
@@ -202,7 +203,9 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
             Get.back();
           },
         );
-        setState(() {});
+        setState(() {
+          isCaptureState = false;
+        });
       }
     });
   }
@@ -381,13 +384,6 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
                       id: _LayerLayoutIds.canvasMagnifier,
                       child: const CanvasMagnifier(),
                     ),
-                    // if (!isCaptureState)
-                    //   LayoutId(
-                    //     id: _LayerLayoutIds.buttonGroups,
-                    //     child: ButtonGroup(
-                    //       capturePng: () => capturePng(),
-                    //     ),
-                    //   )
                   ],
                   if (isPlayerMode && canShowAI) ...[
                     LayoutId(
@@ -401,7 +397,7 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
               ),
             ),
             const MobileRightPanel(),
-            ifShowTopMenu ? const MobileTopMenu() : Container(),
+            ifShowTopMenu ? MobileTopMenu(capturePng: capturePng) : Container(),
             ifShowBottomMenu ? const MobileBottomMenu() : Container(),
           ],
         ),
@@ -460,7 +456,6 @@ class _LayerLayoutDelegate extends MultiChildLayoutDelegate {
     );
     layoutLayer(_LayerLayoutIds.pause, offset, renderSize);
     layoutLayer(_LayerLayoutIds.paintAI, offset, renderSize);
-    layoutLayer(_LayerLayoutIds.buttonGroups, offset, renderSize);
   }
 
   void layoutLayer(_LayerLayoutIds layoutId, Offset offset, Size size) {
@@ -530,9 +525,6 @@ enum _LayerLayoutIds {
   /// AI画板
   paintAI,
 
-  /// 按钮组
-  buttonGroups,
-
   /// 参考校准线画板
   standardLineCalibration,
 }

+ 3 - 1
lib/view/mobile_view/mobile_top_menu.dart

@@ -7,8 +7,10 @@ import 'package:flutter/material.dart';
 import 'package:get/get.dart';
 
 class MobileTopMenu extends StatefulWidget {
+  final VoidCallback capturePng;
   const MobileTopMenu({
     Key? key,
+    required this.capturePng,
   }) : super(key: key);
 
   @override
@@ -106,7 +108,7 @@ class _MobileTopMenuState extends State<MobileTopMenu> {
     return SingleIconButton(
       icon: Icons.save,
       onPressed: () {
-        print("call 截图保存");
+        widget.capturePng();
       },
     );
   }