Prechádzať zdrojové kódy

1、测量图片分享功能接口对接

bakamaka.guan 2 rokov pred
rodič
commit
8c6f791d8b

+ 5 - 0
lib/measure_page_test.dart

@@ -59,6 +59,10 @@ class MeasureDataTester {
   static Future<MeasureSystemSettingDTO?> getMeasureSystemSettingAsync() async {
     return null;
   }
+
+  static Future<String> shareImage(String vid) async {
+    return '';
+  }
 }
 
 class MeasureTestPage extends StatefulWidget {
@@ -92,6 +96,7 @@ class _MeasureTestPageState extends State<MeasureTestPage> {
     MeasureDataTester.saveImage,
     MeasureDataTester.saveMeasureSystemSettingAsync,
     MeasureDataTester.getMeasureSystemSettingAsync,
+    MeasureDataTester.shareImage,
   ));
   final controller = Get.put<IMeasureController>(MeasureController(
     "12345",

+ 3 - 0
lib/process/workspace/measure_controller.dart

@@ -2,6 +2,7 @@ import 'package:fis_measure/interfaces/process/workspace/exam_info.dart';
 import 'package:fis_measure/interfaces/process/workspace/measure_controller.dart';
 import 'package:fis_measure/process/workspace/application.dart';
 import 'package:fis_measure/process/workspace/third_part/application.dart';
+import 'package:fis_measure/utils/prompt_box.dart';
 import 'package:fis_measure/view/player/controller.dart';
 import 'package:fis_measure/view/player/enums.dart';
 import 'package:fis_measure/view/player/events.dart';
@@ -88,6 +89,8 @@ class MeasureController implements IMeasureController {
     dataHost.frameLoaded.addListener(_onFrameLoaded);
     playerController.load().then((_) async {
       if (playerController.status != VidPlayStatus.ready) {
+        /// TODO 翻译
+        PromptBox.toast('网络不稳定,图像下载失败');
         throw FlutterError("Vid file load fail.");
       }
       playerController.eventHandler.addListener(_onPlayerEnvent);

+ 3 - 0
lib/process/workspace/measure_data_controller.dart

@@ -287,6 +287,7 @@ class MeasureDataController implements IMeasureDataController {
     this.saveImage,
     this.saveMeasureSystemSettingAsync,
     this.getMeasureSystemSettingAsync,
+    this.shareImage,
   );
 
   ///参数1:patientCode,参数2:recordCode,参数3:token
@@ -303,6 +304,8 @@ class MeasureDataController implements IMeasureDataController {
   ///参数1:imageBytes 图片字节, 参数2: patientCode 病人code,参数3:recordCode 检查code, 参数4:remedicalCode 检查code,参数5: measuredData 测量值
   Future<bool?> Function(Uint8List, String, String, String, String) saveImage;
 
+  Future<String> Function(String) shareImage;
+
   Future<void> Function(MeasureModeSubmit)
       saveUserDefinedMeasureApplicationAsync;
   Future<void> Function(MeasureSystemSettingDTO) saveMeasureSystemSettingAsync;

+ 135 - 0
lib/utils/prompt_box.dart

@@ -0,0 +1,135 @@
+import 'package:fis_i18n/i18n.dart';
+import 'package:fis_ui/index.dart';
+import 'package:fis_ui/utils/sizer/sizer.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_easyloading/flutter_easyloading.dart';
+import 'package:get/get.dart';
+
+///弹出框位置
+enum PromptBoxSnackbarPosition {
+  //上部弹出
+  Top,
+
+  //底部弹出
+  Bottom,
+}
+
+///弹出框
+class PromptBox {
+  PromptBox._();
+
+  static void init() {
+    EasyLoading.instance
+      ..displayDuration = const Duration(milliseconds: 2000)
+      ..indicatorType = EasyLoadingIndicatorType.ring
+      ..loadingStyle = EasyLoadingStyle.custom
+      ..indicatorSize = 35.0
+      ..lineWidth = 2
+      ..radius = 10.0
+      ..progressColor = Colors.white
+      ..backgroundColor = Colors.black.withOpacity(0.7)
+      ..indicatorColor = Colors.white
+      ..textColor = Colors.white
+      ..fontSize = 16
+      ..maskColor = Colors.black.withOpacity(0.6)
+      ..successWidget = FIcon(Icons.done, color: Colors.green, size: 35)
+      ..errorWidget = FIcon(Icons.close, color: Colors.red, size: 35)
+      ..userInteractions = true
+      ..dismissOnTap = false;
+  }
+
+  static bool _enable = true;
+  static void $SetEnable(bool val) {
+    _enable = val;
+  }
+
+  /// 等待提示
+  ///
+  /// [text] 自定义提示文案
+  static void loading([String? text]) {
+    if (!_enable) return;
+
+    _setLoadingStyle();
+    EasyLoading.show(
+      indicator: LoadingWidget(text: text ?? '${i18nBook.common.loading.t}...'),
+      maskType: EasyLoadingMaskType.custom,
+      status: "",
+    );
+  }
+
+  /// 轻提示
+  ///
+  /// [text] 提示内容
+  static void toast(String text) {
+    if (!_enable) return;
+
+    _resetStyle();
+    EasyLoading.showToast(text);
+  }
+
+  /// 成功提示
+  ///
+  /// [text] 自定义提示文案
+  static void success(String text) {
+    if (!_enable) return;
+
+    _resetStyle();
+    EasyLoading.showSuccess(text);
+  }
+
+  /// 错误提示
+  ///
+  /// [text] 自定义提示文案
+  static void error(String text) {
+    if (!_enable) return;
+
+    _resetStyle();
+    EasyLoading.showError(text);
+  }
+
+  /// 停止提示
+  static void dismiss() {
+    EasyLoading.instance.userInteractions = true;
+    EasyLoading.dismiss();
+  }
+
+  /// 提示框(带标题)
+  ///
+  /// [message] 提示内容
+  ///
+  /// [title] 标题
+  ///
+  /// [position] 弹出位置
+  static void snackbar(
+    String message, {
+    String? title,
+    PromptBoxSnackbarPosition position = PromptBoxSnackbarPosition.Top,
+  }) {
+    final isTop = PromptBoxSnackbarPosition.Top == position;
+
+    Get.snackbar(
+      title ?? i18nBook.common.tip.t, // TODO:
+      message,
+      maxWidth: kIsMobile ? Sizer.ins.size.width - 40 : 400,
+      snackPosition: isTop ? SnackPosition.TOP : SnackPosition.BOTTOM,
+      margin: isTop
+          ? const EdgeInsets.only(top: 36)
+          : const EdgeInsets.only(bottom: 48),
+    );
+  }
+
+  static void _setLoadingStyle() {
+    EasyLoading.instance
+      ..userInteractions = false
+      ..backgroundColor = Colors.transparent
+      ..maskColor = Colors.black.withOpacity(0.08)
+      ..boxShadow = <BoxShadow>[];
+  }
+
+  static void _resetStyle() {
+    EasyLoading.instance
+      ..backgroundColor = Colors.black.withOpacity(0.7)
+      ..maskColor = Colors.black.withOpacity(0.6)
+      ..boxShadow = null;
+  }
+}

+ 6 - 2
lib/view/button_group/button_group.dart

@@ -70,9 +70,13 @@ class _ButtonGroupState extends State<ButtonGroup> {
       _buildTitleButton(
         FIcons.fis_share,
         i18nBook.remedical.share.t,
-        () {
+        () async {
           print('分享');
-          print(measureData.itemCurrentImage);
+          var a = await measureData.shareImage.call(
+            measureData.itemCurrentImage,
+          );
+
+          print(a);
           Get.dialog(_buildShareQr(measureData.itemCurrentImage));
         },
       ),

+ 1 - 1
lib/view/measure/measure_tool.dart

@@ -93,7 +93,7 @@ class LeftSiderSelectMeasureState extends FState<LeftSiderSelectMeasure> {
             ItemOutputMeta(
               element.name ?? '',
               element.description ?? '',
-              VidUsUnitMap.getUnit(element.unit.index),
+              VidUsUnitMap.getUnit(element.unit),
             ),
           );
         }

+ 1 - 1
lib/view/measure/tool_chest_title.dart

@@ -206,7 +206,7 @@ class _LeftMeasureToolsState extends State<_LeftMeasureTools> {
             ItemOutputMeta(
               element.name ?? '',
               element.description ?? '',
-              VidUsUnitMap.getUnit(element.unit.index),
+              VidUsUnitMap.getUnit(element.unit),
             ),
           );
         }

+ 6 - 5
lib/view/paint/ai_patint_controller.dart

@@ -196,11 +196,12 @@ class AiPatintController extends GetxController {
           for (int m = 0; m < detectedObjects!.length; m++) {
             final organBoundBox =
                 detectedObjects[m].boundingBox ?? AIDiagnosisRect();
-
-            left = organBoundBox.left * widthScale;
-            top = organBoundBox.top * widthScale;
-            width = organBoundBox.width * widthScale;
-            height = organBoundBox.height * widthScale;
+            if (detectedObjects[m].label != 0) {
+              left = organBoundBox.left * widthScale;
+              top = organBoundBox.top * widthScale;
+              width = organBoundBox.width * widthScale;
+              height = organBoundBox.height * widthScale;
+            }
           }
           return true;
         } else {

+ 2 - 1
pubspec.yaml

@@ -63,6 +63,7 @@ dependencies:
   image: 3.1.3
   webviewx: ^0.2.1
   url_launcher: 6.1.5
+  flutter_easyloading: 3.0.3
 
   fis_i18n:
     git:
@@ -95,7 +96,7 @@ dependency_overrides:
   fis_jsonrpc:
     git:
       url: http://git.ius.plus:88/Project-Wing/fis_lib_jsonrpc.git
-      ref: 4a9569e
+      ref: a2f6096
   fis_lib_business_components:
     git:
       url: http://git.ius.plus/bakamaka.guan/fis_lib_business_components.git