|
@@ -27,6 +27,8 @@ import 'package:fis_measure/view/measure/measure_result.dart';
|
|
|
import 'package:fis_measure/view/paint/ai_patint.dart';
|
|
|
import 'package:fis_measure/view/paint/ai_patint_controller.dart';
|
|
|
import 'package:fis_measure/view/paint/ai_patint_result.dart';
|
|
|
+import 'package:fis_measure/view/player/enums.dart';
|
|
|
+import 'package:fis_measure/view/player/events.dart';
|
|
|
import 'package:fis_measure/view/result/results_panel.dart';
|
|
|
import 'package:fis_measure/view/standard_line/calibration_canvas.dart';
|
|
|
import 'package:fis_measure/view/standard_line/calibration_gesture.dart';
|
|
@@ -127,6 +129,8 @@ class _MeasureMainViewState extends State<MeasureMainView> {
|
|
|
});
|
|
|
vidPlayerController.errorOccured.addListener(_onErrorOccured);
|
|
|
playerController.frameLoadStateChanged.addListener(_onLoadStateChanged);
|
|
|
+ playerController.eventHandler.addListener(_onHandlePlayerEvent);
|
|
|
+
|
|
|
measureHandler.canMeasureDrawingChanged
|
|
|
.addListener(_onCanMeasureDrawingChanged);
|
|
|
}
|
|
@@ -137,6 +141,7 @@ class _MeasureMainViewState extends State<MeasureMainView> {
|
|
|
application.operateTypeChanged.removeListener(onOperateTypeChanged);
|
|
|
measure3DViewController.updatePlayerMode.removeListener(_onModeChanged);
|
|
|
playerController.frameLoadStateChanged.removeListener(_onLoadStateChanged);
|
|
|
+ playerController.eventHandler.removeListener(_onHandlePlayerEvent);
|
|
|
measureHandler.canMeasureDrawingChanged
|
|
|
.removeListener(_onCanMeasureDrawingChanged);
|
|
|
uninstallStandardLine();
|
|
@@ -165,6 +170,8 @@ class _MeasureMainViewState extends State<MeasureMainView> {
|
|
|
|
|
|
/// 流式加载出错
|
|
|
void _onErrorOccured(Object s, String? error) {
|
|
|
+ final isShowTips = error?.isNotEmpty ?? false;
|
|
|
+
|
|
|
/// 第一次收到加载出错,不显示错误信息,直接重新加载一次,如果再次收到加载出错,显示错误信息
|
|
|
if (isNewVid) {
|
|
|
/// 如果不重新加载,在生产环境下会由于流式加载出错而导致无法播放
|
|
@@ -175,14 +182,9 @@ class _MeasureMainViewState extends State<MeasureMainView> {
|
|
|
playerController.locateTo(0);
|
|
|
playerController.play();
|
|
|
});
|
|
|
- setState(() {
|
|
|
- _ifShowLoadingTips = error?.isNotEmpty ?? false;
|
|
|
- });
|
|
|
+ _updateLoadingTips(isShowTips, '');
|
|
|
} else {
|
|
|
- setState(() {
|
|
|
- _ifShowLoadingTips = error?.isNotEmpty ?? false;
|
|
|
- _loadingTipsText = error ?? '';
|
|
|
- });
|
|
|
+ _updateLoadingTips(isShowTips, error ?? '');
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -191,21 +193,25 @@ class _MeasureMainViewState extends State<MeasureMainView> {
|
|
|
if (e) {
|
|
|
_streamLoadingTimer?.cancel();
|
|
|
_streamLoadingTimer = Timer(const Duration(milliseconds: 100), () {
|
|
|
- setState(() {
|
|
|
- _ifShowLoadingTips = true;
|
|
|
- _loadingTipsText = i18nBook.common.loading.t;
|
|
|
- });
|
|
|
+ _updateLoadingTips(true, i18nBook.common.loading.t);
|
|
|
});
|
|
|
} else {
|
|
|
_streamLoadingTimer?.cancel();
|
|
|
if (_ifShowLoadingTips) {
|
|
|
- setState(() {
|
|
|
- _ifShowLoadingTips = false;
|
|
|
- });
|
|
|
+ _updateLoadingTips(false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ void _updateLoadingTips(bool isShow, [String? text]) {
|
|
|
+ setState(() {
|
|
|
+ _ifShowLoadingTips = isShow;
|
|
|
+ if (text != null) {
|
|
|
+ _loadingTipsText = text;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/// 模式改变触发更新
|
|
|
/// [Carotid] ✅组件不销毁的情况下,切换模式的时候,可以触发
|
|
|
void _onModeChanged(Object s, MeasureMode mode) {
|
|
@@ -228,6 +234,15 @@ class _MeasureMainViewState extends State<MeasureMainView> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ void _onHandlePlayerEvent(Object sender, VidPlayerEvent e) {
|
|
|
+ if (e is VidPlayerStatusChangeEvent) {
|
|
|
+ if (e.status == VidPlayStatus.pause) {
|
|
|
+ // 暂停则关闭 loading tips
|
|
|
+ _updateLoadingTips(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// 保存图片
|
|
|
void capturePng() async {
|
|
|
setState(() {
|