对讲页面部分定时器的安全处理
This commit is contained in:
parent
49633dc766
commit
af07226c6d
@ -463,13 +463,13 @@ class LockMonitoringLogic extends BaseGetXController {
|
|||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
print("锁详情界面销毁了");
|
print("锁详情界面销毁了");
|
||||||
CallTalk().stopPcmSound();
|
CallTalk().stopPcmSound();
|
||||||
|
stopProcessing();
|
||||||
_getTVDataRefreshUIEvent!.cancel();
|
_getTVDataRefreshUIEvent!.cancel();
|
||||||
_getUDPStatusRefreshUIEvent!.cancel();
|
_getUDPStatusRefreshUIEvent!.cancel();
|
||||||
if (state.oneMinuteTimeTimer != null) {
|
if (state.oneMinuteTimeTimer != null) {
|
||||||
state.oneMinuteTimeTimer.cancel();
|
state.oneMinuteTimeTimer.cancel();
|
||||||
state.oneMinuteTime.value = 0;
|
state.oneMinuteTime.value = 0;
|
||||||
}
|
}
|
||||||
stopProcessing();
|
|
||||||
state.listPhotoData.value = Uint8List(0);
|
state.listPhotoData.value = Uint8List(0);
|
||||||
if (state.answerTimer != null) {
|
if (state.answerTimer != null) {
|
||||||
state.answerTimer.cancel();
|
state.answerTimer.cancel();
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/talk/call/callTalk.dart';
|
import 'package:star_lock/talk/call/callTalk.dart';
|
||||||
import 'package:star_lock/talk/udp/udp_talkClass.dart';
|
|
||||||
|
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
import '../../../../login/selectCountryRegion/common/index.dart';
|
import '../../../../login/selectCountryRegion/common/index.dart';
|
||||||
@ -35,9 +34,12 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return PopScope(
|
||||||
|
canPop: false,
|
||||||
|
child: Container(
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
height: 1.sh,
|
height: 1.sh,
|
||||||
|
color: Colors.white,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
Obx(() {
|
Obx(() {
|
||||||
@ -61,15 +63,18 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
top: ScreenUtil().statusBarHeight + 30.h,
|
top: ScreenUtil().statusBarHeight + 30.h,
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
child: Obx(() {
|
child: Obx(() {
|
||||||
var sec =
|
var sec = (state.oneMinuteTime.value % 60)
|
||||||
(state.oneMinuteTime.value % 60).toString().padLeft(2, '0');
|
.toString()
|
||||||
var min =
|
.padLeft(2, '0');
|
||||||
(state.oneMinuteTime.value ~/ 60).toString().padLeft(2, '0');
|
var min = (state.oneMinuteTime.value ~/ 60)
|
||||||
|
.toString()
|
||||||
|
.padLeft(2, '0');
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text("$min:$sec",
|
Text("$min:$sec",
|
||||||
style: TextStyle(fontSize: 26.sp, color: Colors.white)),
|
style: TextStyle(
|
||||||
|
fontSize: 26.sp, color: Colors.white)),
|
||||||
// SizedBox(width: 30.w),
|
// SizedBox(width: 30.w),
|
||||||
// GestureDetector(
|
// GestureDetector(
|
||||||
// onTap: () {
|
// onTap: () {
|
||||||
@ -111,7 +116,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
))
|
))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bottomTopBtnWidget() {
|
Widget bottomTopBtnWidget() {
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/talk/udp/udp_manage.dart';
|
import 'package:star_lock/talk/udp/udp_manage.dart';
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:audioplayers/audioplayers.dart';
|
import 'package:audioplayers/audioplayers.dart';
|
||||||
import 'package:fast_gbk/fast_gbk.dart';
|
import 'package:fast_gbk/fast_gbk.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_state.dart';
|
||||||
import 'package:star_lock/talk/call/callTalk.dart';
|
import 'package:star_lock/talk/call/callTalk.dart';
|
||||||
import 'package:star_lock/tools/eventBusEventManage.dart';
|
import 'package:star_lock/tools/eventBusEventManage.dart';
|
||||||
import '../../appRouters.dart';
|
import '../../appRouters.dart';
|
||||||
@ -183,6 +185,8 @@ class UDPTalkClass {
|
|||||||
// LockMonitoringState().isClickHangUp.value = false;
|
// LockMonitoringState().isClickHangUp.value = false;
|
||||||
CallTalk().stopPcmSound();
|
CallTalk().stopPcmSound();
|
||||||
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||||
|
Get.back();
|
||||||
|
|
||||||
if (talkTimer != null) {
|
if (talkTimer != null) {
|
||||||
talkTimer.cancel();
|
talkTimer.cancel();
|
||||||
}
|
}
|
||||||
@ -191,6 +195,25 @@ class UDPTalkClass {
|
|||||||
playLocalAudioTimer.cancel();
|
playLocalAudioTimer.cancel();
|
||||||
playLocalAudioSecond = 0;
|
playLocalAudioSecond = 0;
|
||||||
}
|
}
|
||||||
Get.back();
|
|
||||||
|
if (LockMonitoringState().oneMinuteTimeTimer != null) {
|
||||||
|
LockMonitoringState().oneMinuteTimeTimer.cancel();
|
||||||
|
LockMonitoringState().oneMinuteTime.value = 0;
|
||||||
|
}
|
||||||
|
LockMonitoringState().listPhotoData.value = Uint8List(0);
|
||||||
|
if (LockMonitoringState().answerTimer != null) {
|
||||||
|
LockMonitoringState().answerTimer.cancel();
|
||||||
|
LockMonitoringState().answerSeconds.value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LockMonitoringState().hangUpTimer != null) {
|
||||||
|
LockMonitoringState().hangUpTimer.cancel();
|
||||||
|
LockMonitoringState().hangUpSeconds.value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LockMonitoringState().openDoorTimer != null) {
|
||||||
|
LockMonitoringState().openDoorTimer.cancel();
|
||||||
|
LockMonitoringState().openDoorSeconds.value = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user