|
@@ -14,6 +14,7 @@ import 'package:fis_measure/view/player/control_board/operate_bar.dart';
|
|
|
import 'package:fis_measure/view/player/controller.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
+import 'package:vid/us/vid_us_image.dart';
|
|
|
|
|
|
class MobileBottomMenu extends StatefulWidget {
|
|
|
const MobileBottomMenu({
|
|
@@ -31,6 +32,8 @@ class _MobileBottomMenuState extends State<MobileBottomMenu> {
|
|
|
Get.find<MobileMeasureViewStateController>();
|
|
|
late final playerController = Get.find<IPlayerController>();
|
|
|
|
|
|
+ bool isCanMeasure = true;
|
|
|
+
|
|
|
@override
|
|
|
void initState() {
|
|
|
mobileMeasureStateController.onModeChanged.addListener(_onViewModeChanged);
|
|
@@ -40,6 +43,7 @@ class _MobileBottomMenuState extends State<MobileBottomMenu> {
|
|
|
ifShowProgressBar = true;
|
|
|
});
|
|
|
}
|
|
|
+ playerController.firstFrameLoaded.addListener(_onFrameLoadedAfterFirst);
|
|
|
super.initState();
|
|
|
}
|
|
|
|
|
@@ -47,9 +51,31 @@ class _MobileBottomMenuState extends State<MobileBottomMenu> {
|
|
|
void dispose() {
|
|
|
mobileMeasureStateController.onModeChanged
|
|
|
.removeListener(_onViewModeChanged);
|
|
|
+ playerController.firstFrameLoaded.removeListener(_onFrameLoadedAfterFirst);
|
|
|
+
|
|
|
super.dispose();
|
|
|
}
|
|
|
|
|
|
+ void _onFrameLoadedAfterFirst(Object sender, VidUsImage? e) {
|
|
|
+ if (!mounted) return;
|
|
|
+ _initModeBtns();
|
|
|
+ }
|
|
|
+
|
|
|
+ void _initModeBtns() {
|
|
|
+ /// 是否允许测量(多幅vid屏蔽测量)
|
|
|
+ if (application.isSingleFrame && application.visuals.length > 1) {
|
|
|
+ isCanMeasure = false;
|
|
|
+ setState(() {
|
|
|
+ ifShowMeasureBtn = false;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ isCanMeasure = true;
|
|
|
+ setState(() {
|
|
|
+ ifShowMeasureBtn = true;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
bool singleFrame = true;
|
|
|
bool ifShowProgressBar = false;
|
|
|
bool ifShowMeasureBtn = true;
|
|
@@ -61,7 +87,7 @@ class _MobileBottomMenuState extends State<MobileBottomMenu> {
|
|
|
case MobileMeasureMode.playerMode:
|
|
|
setState(() {
|
|
|
ifShowProgressBar = !singleFrame;
|
|
|
- ifShowMeasureBtn = true;
|
|
|
+ ifShowMeasureBtn = isCanMeasure;
|
|
|
ifShowAnnotationBtn = true;
|
|
|
});
|
|
|
break;
|
|
@@ -75,7 +101,7 @@ class _MobileBottomMenuState extends State<MobileBottomMenu> {
|
|
|
case MobileMeasureMode.annotationMode:
|
|
|
setState(() {
|
|
|
ifShowProgressBar = false;
|
|
|
- ifShowMeasureBtn = true;
|
|
|
+ ifShowMeasureBtn = isCanMeasure;
|
|
|
ifShowAnnotationBtn = false;
|
|
|
});
|
|
|
break;
|
|
@@ -126,7 +152,7 @@ class _MobileBottomMenuState extends State<MobileBottomMenu> {
|
|
|
? SingleIconButton(
|
|
|
icon: Icons.straighten,
|
|
|
onPressed: () {
|
|
|
- mobileMeasureStateController.currentMode =
|
|
|
+ mobileMeasureStateController.currentMeasureMode =
|
|
|
MobileMeasureMode.measureMode;
|
|
|
},
|
|
|
)
|
|
@@ -138,7 +164,7 @@ class _MobileBottomMenuState extends State<MobileBottomMenu> {
|
|
|
measureHandler.changedAnnotationType =
|
|
|
AnnotationType.label;
|
|
|
application.switchAnnotation(AnnotationType.label);
|
|
|
- mobileMeasureStateController.currentMode =
|
|
|
+ mobileMeasureStateController.currentMeasureMode =
|
|
|
MobileMeasureMode.annotationMode;
|
|
|
},
|
|
|
)
|