对讲页面部分定时器的安全处理
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,83 +34,89 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return PopScope(
|
||||||
width: 1.sw,
|
canPop: false,
|
||||||
height: 1.sh,
|
child: Container(
|
||||||
child: Stack(
|
width: 1.sw,
|
||||||
children: [
|
height: 1.sh,
|
||||||
Obx(() {
|
color: Colors.white,
|
||||||
if (state.listPhotoData.value.isEmpty ||
|
child: Stack(
|
||||||
state.listPhotoData.value.length < 10) {
|
children: [
|
||||||
return Container(color: Colors.transparent);
|
Obx(() {
|
||||||
} else {
|
if (state.listPhotoData.value.isEmpty ||
|
||||||
return Image.memory(
|
state.listPhotoData.value.length < 10) {
|
||||||
state.listPhotoData.value,
|
|
||||||
gaplessPlayback: true,
|
|
||||||
width: 1.sw,
|
|
||||||
height: 1.sh,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
errorBuilder: (context, error, stackTrace) {
|
|
||||||
return Container(color: Colors.transparent);
|
return Container(color: Colors.transparent);
|
||||||
},
|
} else {
|
||||||
);
|
return Image.memory(
|
||||||
}
|
state.listPhotoData.value,
|
||||||
}),
|
gaplessPlayback: true,
|
||||||
Positioned(
|
width: 1.sw,
|
||||||
top: ScreenUtil().statusBarHeight + 30.h,
|
height: 1.sh,
|
||||||
width: 1.sw,
|
fit: BoxFit.cover,
|
||||||
child: Obx(() {
|
errorBuilder: (context, error, stackTrace) {
|
||||||
var sec =
|
return Container(color: Colors.transparent);
|
||||||
(state.oneMinuteTime.value % 60).toString().padLeft(2, '0');
|
},
|
||||||
var min =
|
);
|
||||||
(state.oneMinuteTime.value ~/ 60).toString().padLeft(2, '0');
|
}
|
||||||
return Row(
|
}),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
Positioned(
|
||||||
children: [
|
top: ScreenUtil().statusBarHeight + 30.h,
|
||||||
Text("$min:$sec",
|
width: 1.sw,
|
||||||
style: TextStyle(fontSize: 26.sp, color: Colors.white)),
|
child: Obx(() {
|
||||||
// SizedBox(width: 30.w),
|
var sec = (state.oneMinuteTime.value % 60)
|
||||||
// GestureDetector(
|
.toString()
|
||||||
// onTap: () {
|
.padLeft(2, '0');
|
||||||
// Get.back();
|
var min = (state.oneMinuteTime.value ~/ 60)
|
||||||
// },
|
.toString()
|
||||||
// child: Container(
|
.padLeft(2, '0');
|
||||||
// decoration: BoxDecoration(
|
return Row(
|
||||||
// color: Colors.white,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
// borderRadius: BorderRadius.circular(25.h)),
|
children: [
|
||||||
// padding: EdgeInsets.all(10.w),
|
Text("$min:$sec",
|
||||||
// child: Image(
|
style: TextStyle(
|
||||||
// width: 40.w,
|
fontSize: 26.sp, color: Colors.white)),
|
||||||
// height: 40.w,
|
// SizedBox(width: 30.w),
|
||||||
// image: const AssetImage("images/icon_left_black.png"),
|
// 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() {
|
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