فهرست منبع

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

gavin.chen 2 سال پیش
والد
کامیت
7683aabf82
2فایلهای تغییر یافته به همراه12 افزوده شده و 18 حذف شده
  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 final aiPatintController = Get.find<AiPatintController>();
 
 
   late bool enableCarotid2DMeasure = false;
   late bool enableCarotid2DMeasure = false;
-  bool isCaptureState = false;
+  bool isCaptureState = false; // 是否是截图状态,按钮隐藏
   late double calibrationLine = 4;
   late double calibrationLine = 4;
   final List<OutputItem> outputs = [];
   final List<OutputItem> outputs = [];
 
 
@@ -156,8 +156,9 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
 
 
   /// 保存图片
   /// 保存图片
   void capturePng() async {
   void capturePng() async {
-    isCaptureState = true;
-    setState(() {});
+    setState(() {
+      isCaptureState = true;
+    });
     for (var item in application.measureItems) {
     for (var item in application.measureItems) {
       if (item.calculator != null) {
       if (item.calculator != null) {
         // 添加历史测量值
         // 添加历史测量值
@@ -193,7 +194,7 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
           measureData.measureImageData.remedicalCode ?? '',
           measureData.measureImageData.remedicalCode ?? '',
           measureResult.toDisplay(),
           measureResult.toDisplay(),
         );
         );
-        isCaptureState = false;
+
         Future.delayed(
         Future.delayed(
           const Duration(
           const Duration(
             milliseconds: 600,
             milliseconds: 600,
@@ -202,7 +203,9 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
             Get.back();
             Get.back();
           },
           },
         );
         );
-        setState(() {});
+        setState(() {
+          isCaptureState = false;
+        });
       }
       }
     });
     });
   }
   }
@@ -381,13 +384,6 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
                       id: _LayerLayoutIds.canvasMagnifier,
                       id: _LayerLayoutIds.canvasMagnifier,
                       child: const CanvasMagnifier(),
                       child: const CanvasMagnifier(),
                     ),
                     ),
-                    // if (!isCaptureState)
-                    //   LayoutId(
-                    //     id: _LayerLayoutIds.buttonGroups,
-                    //     child: ButtonGroup(
-                    //       capturePng: () => capturePng(),
-                    //     ),
-                    //   )
                   ],
                   ],
                   if (isPlayerMode && canShowAI) ...[
                   if (isPlayerMode && canShowAI) ...[
                     LayoutId(
                     LayoutId(
@@ -401,7 +397,7 @@ class _MobileMeasureMainViewState extends State<MobileMeasureMainView> {
               ),
               ),
             ),
             ),
             const MobileRightPanel(),
             const MobileRightPanel(),
-            ifShowTopMenu ? const MobileTopMenu() : Container(),
+            ifShowTopMenu ? MobileTopMenu(capturePng: capturePng) : Container(),
             ifShowBottomMenu ? const MobileBottomMenu() : Container(),
             ifShowBottomMenu ? const MobileBottomMenu() : Container(),
           ],
           ],
         ),
         ),
@@ -460,7 +456,6 @@ class _LayerLayoutDelegate extends MultiChildLayoutDelegate {
     );
     );
     layoutLayer(_LayerLayoutIds.pause, offset, renderSize);
     layoutLayer(_LayerLayoutIds.pause, offset, renderSize);
     layoutLayer(_LayerLayoutIds.paintAI, offset, renderSize);
     layoutLayer(_LayerLayoutIds.paintAI, offset, renderSize);
-    layoutLayer(_LayerLayoutIds.buttonGroups, offset, renderSize);
   }
   }
 
 
   void layoutLayer(_LayerLayoutIds layoutId, Offset offset, Size size) {
   void layoutLayer(_LayerLayoutIds layoutId, Offset offset, Size size) {
@@ -530,9 +525,6 @@ enum _LayerLayoutIds {
   /// AI画板
   /// AI画板
   paintAI,
   paintAI,
 
 
-  /// 按钮组
-  buttonGroups,
-
   /// 参考校准线画板
   /// 参考校准线画板
   standardLineCalibration,
   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';
 import 'package:get/get.dart';
 
 
 class MobileTopMenu extends StatefulWidget {
 class MobileTopMenu extends StatefulWidget {
+  final VoidCallback capturePng;
   const MobileTopMenu({
   const MobileTopMenu({
     Key? key,
     Key? key,
+    required this.capturePng,
   }) : super(key: key);
   }) : super(key: key);
 
 
   @override
   @override
@@ -106,7 +108,7 @@ class _MobileTopMenuState extends State<MobileTopMenu> {
     return SingleIconButton(
     return SingleIconButton(
       icon: Icons.save,
       icon: Icons.save,
       onPressed: () {
       onPressed: () {
-        print("call 截图保存");
+        widget.capturePng();
       },
       },
     );
     );
   }
   }