Browse Source

update Measurement operation UI

bakamaka.guan 2 years ago
parent
commit
196787ee55

+ 4 - 5
lib/vid.dart

@@ -1,6 +1,5 @@
 import 'dart:math';
 import 'dart:math' as math;
-import 'dart:typed_data';
 import 'dart:ui' as ui;
 
 import 'package:fis_vid/processors/processor.dart';
@@ -680,13 +679,13 @@ class VidMeasurePlayer extends StatelessWidget {
                   onPressed: () {
                     c.processor.brightness -= 50;
                   },
-                  icon: Icon(Icons.remove),
+                  icon: const Icon(Icons.remove),
                 ),
                 IconButton(
                   onPressed: () {
                     c.processor.brightness += 50;
                   },
-                  icon: Icon(Icons.add),
+                  icon: const Icon(Icons.add),
                 ),
               ],
             ),
@@ -816,8 +815,8 @@ class _DrawRecordPainter extends CustomPainter {
   void paint(Canvas canvas, Size size) {
     print("draw at ${DateTime.now()}");
     canvas.drawLine(
-      Offset(100, 100),
-      Offset(200, 200),
+      const Offset(100, 100),
+      const Offset(200, 200),
       pen,
     );
   }

+ 1 - 1
lib/vid_player_mtest.dart

@@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
 import 'package:fis_vid/data_host/data_host.dart';
 
 class VidPlayerMobilePage extends StatefulWidget {
-  VidPlayerMobilePage(this.url, {Key? key}) : super(key: key);
+  const VidPlayerMobilePage(this.url, {Key? key}) : super(key: key);
 
   final String url;
 

+ 1 - 1
lib/vid_player_test.dart

@@ -6,7 +6,7 @@ import 'index.dart';
 import 'view/main/desktop.dart';
 
 class VidPlayerPage extends StatefulWidget {
-  VidPlayerPage(this.url, {Key? key}) : super(key: key);
+  const VidPlayerPage(this.url, {Key? key}) : super(key: key);
 
   final String url;
 

+ 104 - 9
lib/view/player/control_board/control_board.dart

@@ -1,9 +1,9 @@
-import 'package:fis_common/env/env.dart';
+import 'package:fis_common/index.dart';
 import 'package:fis_measure/interfaces/process/player/play_controller.dart';
 import 'package:fis_vid/processors/index.dart';
 import 'package:flutter/material.dart';
 import 'package:get/get.dart';
-
+import 'package:fis_i18n/i18n.dart';
 import '../controller.dart';
 import '../events.dart';
 
@@ -13,24 +13,29 @@ part 'next_btn.dart';
 part 'progress_bar.dart';
 part 'tone_bar.dart';
 
-class VidPlayerControlBoard extends StatelessWidget {
+class VidPlayerControlBoard extends StatefulWidget {
   const VidPlayerControlBoard(this.controller, {Key? key}) : super(key: key);
 
   final VidPlayerController controller;
 
+  @override
+  State<VidPlayerControlBoard> createState() => _VidPlayerControlBoardState();
+}
+
+class _VidPlayerControlBoardState extends State<VidPlayerControlBoard> {
+  String selectStuta = '';
+
   @override
   Widget build(BuildContext context) {
     return _SharedWidget(
-      controller: controller,
+      controller: widget.controller,
       child: Container(
-        padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 18),
+        padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
         child: Column(
           mainAxisAlignment: MainAxisAlignment.center,
           children: [
-            if (!FPlatform.isPureWeb) ...[
-              _BrightnessToneBar(),
-              _ContrastToneBar(),
-            ],
+            _buildPlayOperateBar(),
+            _buildOperateBar(),
             _buildPlayStatusBar(),
           ],
         ),
@@ -55,6 +60,96 @@ class VidPlayerControlBoard extends StatelessWidget {
       ),
     );
   }
+
+  Widget _buildPlayOperateBar() {
+    return Center(
+      child: Row(
+        mainAxisSize: MainAxisSize.min,
+        crossAxisAlignment: CrossAxisAlignment.center,
+        children: [
+          _buildOperateButton(
+              Icons.call_made_outlined, i18nBook.measure.arrow.t),
+          if (!FPlatform.isPureWeb) ...[
+            _buildOperateButton(Icons.wb_sunny, i18nBook.measure.brightness.t),
+            _buildOperateButton(Icons.contrast, i18nBook.measure.contrast.t),
+          ],
+          _buildOperateButton(Icons.undo_rounded, i18nBook.common.revoke.t),
+          _buildOperateButton(
+              Icons.cleaning_services_rounded, i18nBook.measure.clear.t),
+          _buildOperateButton(Icons.fullscreen, i18nBook.measure.fullScreen.t),
+          _buildOperateButton(Icons.save_outlined, i18nBook.common.save.t),
+          _buildOperateButton(Icons.share, i18nBook.remedical.share.t, true),
+        ],
+      ),
+    );
+  }
+
+  Widget _buildOperateButton(IconData icons, String text,
+      [bool isLast = false]) {
+    const BorderSide borderSide = BorderSide(
+      color: Color.fromRGBO(
+        155,
+        155,
+        155,
+        1,
+      ),
+    );
+    return InkWell(
+      onTap: () {
+        selectStuta = text;
+        setState(() {});
+      },
+      child: Container(
+        padding: const EdgeInsets.all(8.0),
+        decoration: BoxDecoration(
+          color: selectStuta == text ? Colors.blue : Colors.white,
+          border: Border(
+            top: borderSide,
+            bottom: borderSide,
+            left: borderSide,
+            right: isLast
+                ? borderSide
+                : const BorderSide(color: Colors.transparent),
+          ),
+        ),
+        child: Column(
+          children: [
+            if (selectStuta == text) ...[
+              Icon(
+                icons,
+                color: Colors.white,
+              ),
+              Text(
+                text,
+                style: const TextStyle(
+                  color: Colors.white,
+                ),
+              ),
+            ] else ...[
+              Icon(icons),
+              Text(text),
+            ]
+          ],
+        ),
+      ),
+    );
+  }
+
+  Widget _buildOperateBar() {
+    return Container(
+      margin: const EdgeInsets.only(
+        top: 15,
+      ),
+      child: Row(
+        mainAxisAlignment: MainAxisAlignment.center,
+        children: [
+          if (selectStuta == i18nBook.measure.brightness.t)
+            _BrightnessToneBar(),
+          if (selectStuta == i18nBook.measure.contrast.t) _ContrastToneBar(),
+        ],
+      ),
+    );
+  }
 }
 
 class _SharedWidget extends InheritedWidget {

+ 94 - 10
lib/view/player/control_board/progress_bar.dart

@@ -30,19 +30,44 @@ class _ProgressBarState extends State<_ProgressBar> {
     }
     return SliderTheme(
       data: const SliderThemeData(
-        trackHeight: 18,
-        // activeTrackColor: Colors.red,
+        trackHeight: 12,
         thumbColor: Colors.white,
         trackShape: _FullWidthTrackShape(),
       ),
-      child: Slider(
-        max: max,
-        value: index,
-        onChanged: (v) {
-          controller.pause();
-          controller.gotoFrame(v.toInt());
-        },
-      ),
+      child: LayoutBuilder(builder:
+          (BuildContext layoutBuilderContext, BoxConstraints constraints) {
+        return Stack(
+          alignment: Alignment.center,
+          children: [
+            Slider(
+              max: max,
+              value: index,
+              onChanged: (v) {
+                controller.pause();
+                controller.gotoFrame(v.toInt());
+              },
+            ),
+            _PanelPoint(
+                max: max,
+                index: index,
+                constraints: constraints,
+                currentIndex: 20,
+                onChanged: () {
+                  controller.pause();
+                  controller.gotoFrame(22);
+                }),
+            _PanelPoint(
+                max: max,
+                index: index,
+                constraints: constraints,
+                currentIndex: 80,
+                onChanged: () {
+                  controller.pause();
+                  controller.gotoFrame(82);
+                }),
+          ],
+        );
+      }),
     );
   }
 
@@ -80,3 +105,62 @@ class _FullWidthTrackShape extends RoundedRectSliderTrackShape {
     return Rect.fromLTWH(trackLeft, trackTop, trackWidth, trackHeight);
   }
 }
+
+/// AI节点
+class _PanelPoint extends StatefulWidget {
+  const _PanelPoint({
+    required this.max,
+    required this.index,
+    required this.constraints,
+    required this.currentIndex,
+    required this.onChanged,
+  });
+  final double max;
+  final double index;
+  final BoxConstraints constraints;
+  final double currentIndex;
+  final VoidCallback onChanged;
+
+  @override
+  State<_PanelPoint> createState() => _PanelPointState();
+}
+
+class _PanelPointState extends State<_PanelPoint> {
+  Widget marker({
+    required double width,
+    required Color color,
+  }) {
+    return InkWell(
+      onTap: widget.onChanged,
+      child: Container(
+        height: 24,
+        width: width,
+        decoration: BoxDecoration(
+          color: color,
+          borderRadius: BorderRadius.circular(24),
+        ),
+      ),
+    );
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Positioned(
+      left: widget.currentIndex / widget.max * widget.constraints.maxWidth,
+      child: Tooltip(
+        preferBelow: false,
+        padding: const EdgeInsets.all(5),
+        message: '甲状腺结节',
+        child: widget.index > widget.currentIndex
+            ? marker(
+                width: 24,
+                color: Colors.blue,
+              )
+            : marker(
+                width: 24,
+                color: Colors.grey,
+              ),
+      ),
+    );
+  }
+}

+ 15 - 6
pubspec.lock

@@ -122,12 +122,21 @@ packages:
       url: "http://git.ius.plus:88/Project-Wing/fis_lib_common.git"
     source: git
     version: "0.0.2"
+  fis_i18n:
+    dependency: "direct overridden"
+    description:
+      path: "."
+      ref: a9ade48f4d
+      resolved-ref: a9ade48f4dab62b4e0499e2d6eccc75f41c2c045
+      url: "http://git.ius.plus:88/Project-Wing/fis_lib_i18n.git"
+    source: git
+    version: "0.0.1"
   fis_jsonrpc:
     dependency: "direct main"
     description:
       path: "."
-      ref: "^1.1.0"
-      resolved-ref: d8221c30448180cbf57d752977c8f8ed8e279782
+      ref: "^1.1.1"
+      resolved-ref: "322d33903c27b3ad9c3a6cd17b4a479f3470135b"
       url: "http://git.ius.plus:88/Project-Wing/fis_lib_jsonrpc.git"
     source: git
     version: "0.0.1"
@@ -135,8 +144,8 @@ packages:
     dependency: "direct main"
     description:
       path: "."
-      ref: "32b0031ea0"
-      resolved-ref: "32b0031ea0ca7f2c0dd1c935e17f5445e9aeff99"
+      ref: "^1.0.2"
+      resolved-ref: d226cb53baf2bd0041f408ad2b8e9c522fec3cd2
       url: "http://git.ius.plus:88/melon.yin/fis_lib_vid.git"
     source: git
     version: "0.0.1"
@@ -254,7 +263,7 @@ packages:
       name: path_provider
       url: "https://pub.flutter-io.cn"
     source: hosted
-    version: "2.0.10"
+    version: "2.0.11"
   path_provider_android:
     dependency: transitive
     description:
@@ -445,5 +454,5 @@ packages:
     source: hosted
     version: "5.3.1"
 sdks:
-  dart: ">=2.16.0-100.0.dev <3.0.0"
+  dart: ">=2.16.2 <3.0.0"
   flutter: ">=2.8.1"

+ 5 - 1
pubspec.yaml

@@ -67,7 +67,11 @@ dependency_overrides:
   # fis_vid:
   #   git:
   #     url: http://git.ius.plus:88/melon.yin/fis_lib_vid.git
-  #     ref: d226cb53ba      
+  #     ref: d226cb53ba   
+  fis_i18n:
+    git:
+      url: http://git.ius.plus:88/Project-Wing/fis_lib_i18n.git
+      ref: a9ade48f4d
 
 dev_dependencies:
   flutter_test: