This commit is contained in:
魏少阳 2024-01-05 14:00:43 +08:00
commit 8f519adede
5 changed files with 112 additions and 16 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

View File

@ -126,4 +126,5 @@ class AppColors {
static const blueViewBgColor =
Color.fromRGBO(223, 237, 254, 1); // 139 148 176
static const msgNoticeTextColor = Color.fromRGBO(139, 148, 176, 1); //
static const alphaBgViewColor = Color.fromRGBO(0, 0, 0, 0.2); //
}

View File

@ -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 {
UDPSenderManage.sendMainProtocol(
@ -52,7 +113,7 @@ class RealTimePictureLogic extends BaseGetXController {
///
udpHangUpAction() async {
UDPSenderManage.sendMainProtocol(
command: 150,
command: 152,
commandTypeIsCalling: 1,
subCommand: 30,
lockID: UDPManage().lockId,
@ -65,7 +126,7 @@ class RealTimePictureLogic extends BaseGetXController {
///
udpOpenDoorAction() async {
UDPSenderManage.sendMainProtocol(
command: 150,
command: 152,
commandTypeIsCalling: 1,
subCommand: 10,
lockID: UDPManage().lockId,
@ -348,6 +409,7 @@ class RealTimePictureLogic extends BaseGetXController {
print("onReady()");
_getTVDataRefreshUIAction();
_getUDPStatusRefreshUIAction();
initRecorder();
}
@ -363,6 +425,10 @@ class RealTimePictureLogic extends BaseGetXController {
// TODO: implement onClose
print("锁详情界面销毁了");
_getTVDataRefreshUIEvent!.cancel();
_getUDPStatusRefreshUIEvent!.cancel();
if (state.oneMinuteTimeTimer != null) {
state.oneMinuteTimeTimer.cancel();
}
stopProcessing();
}
}

View File

@ -24,7 +24,6 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
void initState() {
super.initState();
// listeningAnimations();
state.animationController =
AnimationController(duration: const Duration(seconds: 1), vsync: this);
state.animationController.repeat();
@ -39,6 +38,8 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
state.animationController.forward();
}
});
logic.udpMonitorAction();
}
@override
@ -47,17 +48,28 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
width: 1.sw,
height: 1.sh,
child: Stack(
alignment: Alignment.center,
children: [
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(
state.listData.value,
// key: ValueKey<int>(state.listData.value.hashCode),
gaplessPlayback: true,
width: 1.sw,
height: 1.sh,
fit: BoxFit.cover,
)),
Positioned(
bottom: 300.h,
child: Text(
'正在创建安全连接...',
style: TextStyle(color: Colors.black, fontSize: 26.sp),
)),
Positioned(
bottom: 10.w,
child: Container(
@ -65,7 +77,7 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
// height: 300.h,
margin: EdgeInsets.all(30.w),
decoration: BoxDecoration(
color: const Color(0xC83C3F41),
color: Colors.black.withOpacity(0.2),
borderRadius: BorderRadius.circular(20.h)),
child: Column(
children: [
@ -277,17 +289,26 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
return Positioned(
left: ScreenUtil().screenWidth / 2 - 220.w / 2,
top: ScreenUtil().screenHeight / 2 - 220.w / 2 - 150.h,
child: RotationTransition(
//
alignment: Alignment.center,
//
turns: state.animationController,
//view
child: Image.asset(
'images/main/realTime_connecting.png',
width: 220.w,
height: 220.w,
child: GestureDetector(
child: RotationTransition(
//
alignment: Alignment.center,
//
turns: state.animationController,
//view
child: AnimatedOpacity(
opacity: 0.5,
duration: const Duration(seconds: 2),
child: Image.asset(
'images/main/realTime_connecting.png',
width: 220.w,
height: 220.w,
),
),
),
onTap: () {
print('点击重新连接');
},
),
);
}

View File

@ -25,11 +25,19 @@ class RealTimePictureState {
late final VoiceProcessor? voiceProcessor;
late Timer oneMinuteTimeTimer =
Timer(const Duration(seconds: 1), () {}); // 60
var oneMinuteTime = 0.obs; //
var getLockID = ''.obs; //lockID
// 10
late Timer answerTimer;
late Timer hangUpTimer;
late Timer openDoorTimer;
late AnimationController animationController;
RealTimePictureState() {
getLockID.value = Get.arguments["lockId"].toString();
}
}