对讲页面部分定时器的安全处理
This commit is contained in:
parent
49633dc766
commit
af07226c6d
@ -463,13 +463,13 @@ class LockMonitoringLogic extends BaseGetXController {
|
||||
// TODO: implement onClose
|
||||
print("锁详情界面销毁了");
|
||||
CallTalk().stopPcmSound();
|
||||
stopProcessing();
|
||||
_getTVDataRefreshUIEvent!.cancel();
|
||||
_getUDPStatusRefreshUIEvent!.cancel();
|
||||
if (state.oneMinuteTimeTimer != null) {
|
||||
state.oneMinuteTimeTimer.cancel();
|
||||
state.oneMinuteTime.value = 0;
|
||||
}
|
||||
stopProcessing();
|
||||
state.listPhotoData.value = Uint8List(0);
|
||||
if (state.answerTimer != null) {
|
||||
state.answerTimer.cancel();
|
||||
|
||||
@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.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 '../../../../login/selectCountryRegion/common/index.dart';
|
||||
@ -35,83 +34,89 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
child: Stack(
|
||||
children: [
|
||||
Obx(() {
|
||||
if (state.listPhotoData.value.isEmpty ||
|
||||
state.listPhotoData.value.length < 10) {
|
||||
return Container(color: Colors.transparent);
|
||||
} else {
|
||||
return Image.memory(
|
||||
state.listPhotoData.value,
|
||||
gaplessPlayback: true,
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: Container(
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
color: Colors.white,
|
||||
child: Stack(
|
||||
children: [
|
||||
Obx(() {
|
||||
if (state.listPhotoData.value.isEmpty ||
|
||||
state.listPhotoData.value.length < 10) {
|
||||
return Container(color: Colors.transparent);
|
||||
},
|
||||
);
|
||||
}
|
||||
}),
|
||||
Positioned(
|
||||
top: ScreenUtil().statusBarHeight + 30.h,
|
||||
width: 1.sw,
|
||||
child: Obx(() {
|
||||
var sec =
|
||||
(state.oneMinuteTime.value % 60).toString().padLeft(2, '0');
|
||||
var min =
|
||||
(state.oneMinuteTime.value ~/ 60).toString().padLeft(2, '0');
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("$min:$sec",
|
||||
style: TextStyle(fontSize: 26.sp, color: Colors.white)),
|
||||
// SizedBox(width: 30.w),
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: BorderRadius.circular(25.h)),
|
||||
// padding: EdgeInsets.all(10.w),
|
||||
// child: Image(
|
||||
// width: 40.w,
|
||||
// height: 40.w,
|
||||
// image: const AssetImage("images/icon_left_black.png"),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
]);
|
||||
}),
|
||||
} else {
|
||||
return Image.memory(
|
||||
state.listPhotoData.value,
|
||||
gaplessPlayback: true,
|
||||
width: 1.sw,
|
||||
height: 1.sh,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return Container(color: Colors.transparent);
|
||||
},
|
||||
);
|
||||
}
|
||||
}),
|
||||
Positioned(
|
||||
top: ScreenUtil().statusBarHeight + 30.h,
|
||||
width: 1.sw,
|
||||
child: Obx(() {
|
||||
var sec = (state.oneMinuteTime.value % 60)
|
||||
.toString()
|
||||
.padLeft(2, '0');
|
||||
var min = (state.oneMinuteTime.value ~/ 60)
|
||||
.toString()
|
||||
.padLeft(2, '0');
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("$min:$sec",
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp, color: Colors.white)),
|
||||
// SizedBox(width: 30.w),
|
||||
// GestureDetector(
|
||||
// onTap: () {
|
||||
// Get.back();
|
||||
// },
|
||||
// child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.white,
|
||||
// borderRadius: BorderRadius.circular(25.h)),
|
||||
// padding: EdgeInsets.all(10.w),
|
||||
// child: Image(
|
||||
// width: 40.w,
|
||||
// height: 40.w,
|
||||
// image: const AssetImage("images/icon_left_black.png"),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
]);
|
||||
}),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 10.w,
|
||||
child: Container(
|
||||
width: 1.sw - 30.w * 2,
|
||||
// height: 300.h,
|
||||
margin: EdgeInsets.all(30.w),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xC83C3F41),
|
||||
borderRadius: BorderRadius.circular(20.h)),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 20.h),
|
||||
bottomTopBtnWidget(),
|
||||
SizedBox(height: 20.h),
|
||||
bottomBottomBtnWidget(),
|
||||
SizedBox(height: 20.h),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: 10.w,
|
||||
child: Container(
|
||||
width: 1.sw - 30.w * 2,
|
||||
// height: 300.h,
|
||||
margin: EdgeInsets.all(30.w),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xC83C3F41),
|
||||
borderRadius: BorderRadius.circular(20.h)),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(height: 20.h),
|
||||
bottomTopBtnWidget(),
|
||||
SizedBox(height: 20.h),
|
||||
bottomBottomBtnWidget(),
|
||||
SizedBox(height: 20.h),
|
||||
],
|
||||
),
|
||||
))
|
||||
],
|
||||
),
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
Widget bottomTopBtnWidget() {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/talk/udp/udp_manage.dart';
|
||||
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
import 'dart:async';
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:fast_gbk/fast_gbk.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.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/tools/eventBusEventManage.dart';
|
||||
import '../../appRouters.dart';
|
||||
@ -183,6 +185,8 @@ class UDPTalkClass {
|
||||
// LockMonitoringState().isClickHangUp.value = false;
|
||||
CallTalk().stopPcmSound();
|
||||
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
|
||||
Get.back();
|
||||
|
||||
if (talkTimer != null) {
|
||||
talkTimer.cancel();
|
||||
}
|
||||
@ -191,6 +195,25 @@ class UDPTalkClass {
|
||||
playLocalAudioTimer.cancel();
|
||||
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