监控页面优化
This commit is contained in:
parent
cf92d6d34c
commit
99dfa84b55
BIN
star_lock/images/main/monitorBg.png
Normal file
BIN
star_lock/images/main/monitorBg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 217 KiB |
@ -126,4 +126,5 @@ class AppColors {
|
|||||||
static const blueViewBgColor =
|
static const blueViewBgColor =
|
||||||
Color.fromRGBO(223, 237, 254, 1); //蓝色背景板 139 148 176
|
Color.fromRGBO(223, 237, 254, 1); //蓝色背景板 139 148 176
|
||||||
static const msgNoticeTextColor = Color.fromRGBO(139, 148, 176, 1); //消息提醒字体颜色
|
static const msgNoticeTextColor = Color.fromRGBO(139, 148, 176, 1); //消息提醒字体颜色
|
||||||
|
static const alphaBgViewColor = Color.fromRGBO(0, 0, 0, 0.2); //透明度背景
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,6 +36,67 @@ class RealTimePictureLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 收到UDP发送的状态
|
||||||
|
StreamSubscription? _getUDPStatusRefreshUIEvent;
|
||||||
|
void _getUDPStatusRefreshUIAction() {
|
||||||
|
_getUDPStatusRefreshUIEvent =
|
||||||
|
eventBus.on<GetUDPStatusRefreshUI>().listen((event) {
|
||||||
|
state.udpStatus.value = event.udpStatus;
|
||||||
|
if (state.udpStatus.value == 8) {
|
||||||
|
// 接听成功了,然后刷新界面的时间 60秒以后自动挂断
|
||||||
|
state.oneMinuteTimeTimer =
|
||||||
|
Timer.periodic(const Duration(seconds: 1), (Timer t) async {
|
||||||
|
state.oneMinuteTime.value++;
|
||||||
|
// Get.log('state.oneMinuteTime.value:${state.oneMinuteTime.value}');
|
||||||
|
if (state.oneMinuteTime.value >= 60) {
|
||||||
|
// 超过60秒了
|
||||||
|
state.oneMinuteTimeTimer.cancel();
|
||||||
|
state.oneMinuteTime.value = 0;
|
||||||
|
// 挂断
|
||||||
|
UDPSenderManage.sendMainProtocol(
|
||||||
|
command: 150,
|
||||||
|
commandTypeIsCalling: 1,
|
||||||
|
subCommand: 30,
|
||||||
|
lockID: state.getLockID.value,
|
||||||
|
lockIP: UDPManage().host,
|
||||||
|
userMobile: await state.userMobile,
|
||||||
|
userMobileIP: await state.userMobileIP,
|
||||||
|
endData: []);
|
||||||
|
|
||||||
|
// 关闭当前界面
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询监视状态
|
||||||
|
udpQueryMonitoringStatusAction() async {
|
||||||
|
UDPSenderManage.sendMainProtocol(
|
||||||
|
command: 152,
|
||||||
|
commandTypeIsCalling: 1,
|
||||||
|
subCommand: 20,
|
||||||
|
lockID: state.getLockID.value,
|
||||||
|
lockIP: UDPManage().host,
|
||||||
|
userMobile: await state.userMobile,
|
||||||
|
userMobileIP: await state.userMobileIP,
|
||||||
|
endData: []);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 监视
|
||||||
|
udpMonitorAction() async {
|
||||||
|
UDPSenderManage.sendMainProtocol(
|
||||||
|
command: 152,
|
||||||
|
commandTypeIsCalling: 1,
|
||||||
|
subCommand: 1,
|
||||||
|
lockID: state.getLockID.value,
|
||||||
|
lockIP: UDPManage().host,
|
||||||
|
userMobile: await state.userMobile,
|
||||||
|
userMobileIP: await state.userMobileIP,
|
||||||
|
endData: []);
|
||||||
|
}
|
||||||
|
|
||||||
/// 接听
|
/// 接听
|
||||||
udpAnswerAction() async {
|
udpAnswerAction() async {
|
||||||
UDPSenderManage.sendMainProtocol(
|
UDPSenderManage.sendMainProtocol(
|
||||||
@ -52,7 +113,7 @@ class RealTimePictureLogic extends BaseGetXController {
|
|||||||
/// 挂断
|
/// 挂断
|
||||||
udpHangUpAction() async {
|
udpHangUpAction() async {
|
||||||
UDPSenderManage.sendMainProtocol(
|
UDPSenderManage.sendMainProtocol(
|
||||||
command: 150,
|
command: 152,
|
||||||
commandTypeIsCalling: 1,
|
commandTypeIsCalling: 1,
|
||||||
subCommand: 30,
|
subCommand: 30,
|
||||||
lockID: UDPManage().lockId,
|
lockID: UDPManage().lockId,
|
||||||
@ -65,7 +126,7 @@ class RealTimePictureLogic extends BaseGetXController {
|
|||||||
/// 开门
|
/// 开门
|
||||||
udpOpenDoorAction() async {
|
udpOpenDoorAction() async {
|
||||||
UDPSenderManage.sendMainProtocol(
|
UDPSenderManage.sendMainProtocol(
|
||||||
command: 150,
|
command: 152,
|
||||||
commandTypeIsCalling: 1,
|
commandTypeIsCalling: 1,
|
||||||
subCommand: 10,
|
subCommand: 10,
|
||||||
lockID: UDPManage().lockId,
|
lockID: UDPManage().lockId,
|
||||||
@ -348,6 +409,7 @@ class RealTimePictureLogic extends BaseGetXController {
|
|||||||
print("onReady()");
|
print("onReady()");
|
||||||
|
|
||||||
_getTVDataRefreshUIAction();
|
_getTVDataRefreshUIAction();
|
||||||
|
_getUDPStatusRefreshUIAction();
|
||||||
|
|
||||||
initRecorder();
|
initRecorder();
|
||||||
}
|
}
|
||||||
@ -363,6 +425,10 @@ class RealTimePictureLogic extends BaseGetXController {
|
|||||||
// TODO: implement onClose
|
// TODO: implement onClose
|
||||||
print("锁详情界面销毁了");
|
print("锁详情界面销毁了");
|
||||||
_getTVDataRefreshUIEvent!.cancel();
|
_getTVDataRefreshUIEvent!.cancel();
|
||||||
|
_getUDPStatusRefreshUIEvent!.cancel();
|
||||||
|
if (state.oneMinuteTimeTimer != null) {
|
||||||
|
state.oneMinuteTimeTimer.cancel();
|
||||||
|
}
|
||||||
stopProcessing();
|
stopProcessing();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,6 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
// listeningAnimations();
|
|
||||||
state.animationController =
|
state.animationController =
|
||||||
AnimationController(duration: const Duration(seconds: 1), vsync: this);
|
AnimationController(duration: const Duration(seconds: 1), vsync: this);
|
||||||
state.animationController.repeat();
|
state.animationController.repeat();
|
||||||
@ -39,6 +38,8 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
|||||||
state.animationController.forward();
|
state.animationController.forward();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
logic.udpMonitorAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -47,17 +48,28 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
|||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
height: 1.sh,
|
height: 1.sh,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
Obx(() => state.listData.value.isEmpty
|
Obx(() => state.listData.value.isEmpty
|
||||||
? Container(color: Colors.black)
|
? Image.asset(
|
||||||
|
'images/main/monitorBg.png',
|
||||||
|
width: ScreenUtil().screenWidth,
|
||||||
|
height: ScreenUtil().screenHeight,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
)
|
||||||
: Image.memory(
|
: Image.memory(
|
||||||
state.listData.value,
|
state.listData.value,
|
||||||
// key: ValueKey<int>(state.listData.value.hashCode),
|
|
||||||
gaplessPlayback: true,
|
gaplessPlayback: true,
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
height: 1.sh,
|
height: 1.sh,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
)),
|
)),
|
||||||
|
Positioned(
|
||||||
|
bottom: 300.h,
|
||||||
|
child: Text(
|
||||||
|
'正在创建安全连接...',
|
||||||
|
style: TextStyle(color: Colors.black, fontSize: 26.sp),
|
||||||
|
)),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 10.w,
|
bottom: 10.w,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -65,7 +77,7 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
|||||||
// height: 300.h,
|
// height: 300.h,
|
||||||
margin: EdgeInsets.all(30.w),
|
margin: EdgeInsets.all(30.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: const Color(0xC83C3F41),
|
color: Colors.black.withOpacity(0.2),
|
||||||
borderRadius: BorderRadius.circular(20.h)),
|
borderRadius: BorderRadius.circular(20.h)),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
@ -277,17 +289,26 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
|
|||||||
return Positioned(
|
return Positioned(
|
||||||
left: ScreenUtil().screenWidth / 2 - 220.w / 2,
|
left: ScreenUtil().screenWidth / 2 - 220.w / 2,
|
||||||
top: ScreenUtil().screenHeight / 2 - 220.w / 2 - 150.h,
|
top: ScreenUtil().screenHeight / 2 - 220.w / 2 - 150.h,
|
||||||
child: RotationTransition(
|
child: GestureDetector(
|
||||||
//设置动画的旋转中心
|
child: RotationTransition(
|
||||||
alignment: Alignment.center,
|
//设置动画的旋转中心
|
||||||
//动画控制器
|
alignment: Alignment.center,
|
||||||
turns: state.animationController,
|
//动画控制器
|
||||||
//将要执行动画的子view
|
turns: state.animationController,
|
||||||
child: Image.asset(
|
//将要执行动画的子view
|
||||||
'images/main/realTime_connecting.png',
|
child: AnimatedOpacity(
|
||||||
width: 220.w,
|
opacity: 0.5,
|
||||||
height: 220.w,
|
duration: const Duration(seconds: 2),
|
||||||
|
child: Image.asset(
|
||||||
|
'images/main/realTime_connecting.png',
|
||||||
|
width: 220.w,
|
||||||
|
height: 220.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
onTap: () {
|
||||||
|
print('点击重新连接');
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,11 +25,19 @@ class RealTimePictureState {
|
|||||||
|
|
||||||
late final VoiceProcessor? voiceProcessor;
|
late final VoiceProcessor? voiceProcessor;
|
||||||
|
|
||||||
|
late Timer oneMinuteTimeTimer =
|
||||||
|
Timer(const Duration(seconds: 1), () {}); // 定时器超过60秒关闭当前界面
|
||||||
var oneMinuteTime = 0.obs; // 定时器秒数
|
var oneMinuteTime = 0.obs; // 定时器秒数
|
||||||
|
|
||||||
|
var getLockID = ''.obs; //lockID
|
||||||
|
|
||||||
// 定时器如果发送了接听的命令 而没收到回复就每秒重复发送10次
|
// 定时器如果发送了接听的命令 而没收到回复就每秒重复发送10次
|
||||||
late Timer answerTimer;
|
late Timer answerTimer;
|
||||||
late Timer hangUpTimer;
|
late Timer hangUpTimer;
|
||||||
late Timer openDoorTimer;
|
late Timer openDoorTimer;
|
||||||
late AnimationController animationController;
|
late AnimationController animationController;
|
||||||
|
|
||||||
|
RealTimePictureState() {
|
||||||
|
getLockID.value = Get.arguments["lockId"].toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user