2024-08-21 18:31:19 +08:00
|
|
|
|
|
2024-01-08 11:28:22 +08:00
|
|
|
|
import 'dart:async';
|
2024-01-09 11:36:51 +08:00
|
|
|
|
import 'dart:convert';
|
2024-01-08 11:28:22 +08:00
|
|
|
|
|
2024-01-03 15:24:42 +08:00
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
import 'package:get/get.dart';
|
2024-08-21 18:31:19 +08:00
|
|
|
|
import 'package:star_lock/main/lockDetail/realTimePicture/realTimePicture_state.dart';
|
2024-01-12 11:59:47 +08:00
|
|
|
|
import 'package:star_lock/talk/call/callTalk.dart';
|
2024-01-03 15:24:42 +08:00
|
|
|
|
|
|
|
|
|
|
import '../../../../app_settings/app_colors.dart';
|
|
|
|
|
|
import '../../../../tools/showTFView.dart';
|
2024-04-26 15:38:59 +08:00
|
|
|
|
import '../../../app_settings/app_settings.dart';
|
2024-01-09 13:51:35 +08:00
|
|
|
|
import 'realTimePicture_logic.dart';
|
2024-01-03 15:24:42 +08:00
|
|
|
|
|
|
|
|
|
|
class RealTimePicturePage extends StatefulWidget {
|
|
|
|
|
|
const RealTimePicturePage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
State<RealTimePicturePage> createState() => _RealTimePicturePageState();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-21 18:31:19 +08:00
|
|
|
|
class _RealTimePicturePageState extends State<RealTimePicturePage> with TickerProviderStateMixin {
|
|
|
|
|
|
final RealTimePictureLogic logic = Get.put(RealTimePictureLogic());
|
|
|
|
|
|
final RealTimePictureState state = Get.find<RealTimePictureLogic>().state;
|
2024-01-03 15:24:42 +08:00
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
void initState() {
|
|
|
|
|
|
super.initState();
|
|
|
|
|
|
|
2024-01-11 09:41:19 +08:00
|
|
|
|
//写一个定时器,三十秒后页面自动返回
|
2024-08-21 18:31:19 +08:00
|
|
|
|
state.autoBackTimer = Timer(const Duration(seconds: 30), Get.back);
|
2024-01-11 09:41:19 +08:00
|
|
|
|
|
2024-01-12 11:59:47 +08:00
|
|
|
|
state.animationController = AnimationController(
|
|
|
|
|
|
vsync: this, // 确保使用的TickerProvider是当前Widget
|
|
|
|
|
|
duration: const Duration(seconds: 1),
|
|
|
|
|
|
);
|
|
|
|
|
|
;
|
2024-01-03 15:24:42 +08:00
|
|
|
|
state.animationController.repeat();
|
|
|
|
|
|
//动画开始、结束、向前移动或向后移动时会调用StatusListener
|
2024-08-21 18:31:19 +08:00
|
|
|
|
state.animationController.addStatusListener((AnimationStatus status) {
|
2024-04-26 15:38:59 +08:00
|
|
|
|
// AppLog.log("AnimationStatus:$status");
|
2024-01-03 15:24:42 +08:00
|
|
|
|
if (status == AnimationStatus.completed) {
|
|
|
|
|
|
state.animationController.reset();
|
|
|
|
|
|
state.animationController.forward();
|
|
|
|
|
|
} else if (status == AnimationStatus.dismissed) {
|
|
|
|
|
|
state.animationController.reset();
|
|
|
|
|
|
state.animationController.forward();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2024-01-05 09:26:12 +08:00
|
|
|
|
|
2024-01-08 11:28:22 +08:00
|
|
|
|
initiateUdpMonitorAction();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//发起监视命令,每隔一秒钟发一次,三十秒无应答则失败
|
|
|
|
|
|
void initiateUdpMonitorAction() {
|
|
|
|
|
|
// 每隔一秒调用一次 udpMonitorAction 方法
|
|
|
|
|
|
state.realTimePicTimer =
|
2024-08-21 18:31:19 +08:00
|
|
|
|
Timer.periodic(const Duration(seconds: 1), (Timer timer) {
|
2024-01-08 11:28:22 +08:00
|
|
|
|
state.elapsedSeconds++;
|
|
|
|
|
|
logic.udpMonitorAction();
|
2024-01-05 14:48:13 +08:00
|
|
|
|
|
2024-01-08 11:28:22 +08:00
|
|
|
|
// 检查条件,如果达到30秒且未得到应答,则认为失败
|
|
|
|
|
|
if (state.elapsedSeconds >= 30) {
|
|
|
|
|
|
state.realTimePicTimer.cancel(); // 取消定时器
|
|
|
|
|
|
|
|
|
|
|
|
_handleFailure();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2024-01-03 15:24:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
return SizedBox(
|
|
|
|
|
|
width: 1.sw,
|
|
|
|
|
|
height: 1.sh,
|
|
|
|
|
|
child: Stack(
|
2024-01-05 09:26:12 +08:00
|
|
|
|
alignment: Alignment.center,
|
2024-08-21 18:31:19 +08:00
|
|
|
|
children: <Widget>[
|
2024-01-08 17:56:12 +08:00
|
|
|
|
Obx(
|
2024-03-06 17:19:52 +08:00
|
|
|
|
() => state.listData.value.isEmpty || state.listData.value.isEmpty
|
|
|
|
|
|
? Image.asset(
|
|
|
|
|
|
'images/main/monitorBg.png',
|
|
|
|
|
|
width: ScreenUtil().screenWidth,
|
|
|
|
|
|
height: ScreenUtil().screenHeight,
|
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
|
)
|
|
|
|
|
|
: Builder(
|
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
return Image.memory(
|
|
|
|
|
|
state.listData.value,
|
|
|
|
|
|
gaplessPlayback: true,
|
|
|
|
|
|
width: 1.sw,
|
|
|
|
|
|
height: 1.sh,
|
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
|
);
|
|
|
|
|
|
} catch (e, stackTrace) {
|
2024-04-26 15:38:59 +08:00
|
|
|
|
AppLog.log('Error loading image: $e');
|
|
|
|
|
|
AppLog.log('Stack trace: $stackTrace');
|
2024-03-06 17:19:52 +08:00
|
|
|
|
return Container();
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
2024-01-08 17:56:12 +08:00
|
|
|
|
),
|
2024-01-08 11:28:22 +08:00
|
|
|
|
Obx(() => state.listData.value.isEmpty
|
|
|
|
|
|
? Positioned(
|
|
|
|
|
|
bottom: 300.h,
|
|
|
|
|
|
child: Text(
|
2024-08-21 18:31:19 +08:00
|
|
|
|
'正在创建安全连接...'.tr,
|
2024-01-08 11:28:22 +08:00
|
|
|
|
style: TextStyle(color: Colors.black, fontSize: 26.sp),
|
|
|
|
|
|
))
|
|
|
|
|
|
: Container()),
|
2024-01-03 15:24:42 +08:00
|
|
|
|
Positioned(
|
|
|
|
|
|
bottom: 10.w,
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
width: 1.sw - 30.w * 2,
|
|
|
|
|
|
// height: 300.h,
|
|
|
|
|
|
margin: EdgeInsets.all(30.w),
|
|
|
|
|
|
decoration: BoxDecoration(
|
2024-01-05 09:26:12 +08:00
|
|
|
|
color: Colors.black.withOpacity(0.2),
|
2024-01-03 15:24:42 +08:00
|
|
|
|
borderRadius: BorderRadius.circular(20.h)),
|
|
|
|
|
|
child: Column(
|
2024-08-21 18:31:19 +08:00
|
|
|
|
children: <Widget>[
|
2024-01-03 15:24:42 +08:00
|
|
|
|
SizedBox(height: 20.h),
|
|
|
|
|
|
bottomTopBtnWidget(),
|
|
|
|
|
|
SizedBox(height: 20.h),
|
|
|
|
|
|
bottomBottomBtnWidget(),
|
|
|
|
|
|
SizedBox(height: 20.h),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
)),
|
2024-01-08 11:28:22 +08:00
|
|
|
|
Obx(() => state.listData.value.isEmpty
|
|
|
|
|
|
? buildRotationTransition()
|
|
|
|
|
|
: Container())
|
2024-01-03 15:24:42 +08:00
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget bottomTopBtnWidget() {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
return Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
2024-01-03 15:24:42 +08:00
|
|
|
|
// 打开关闭声音
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
state.isOpenVoice.value = !state.isOpenVoice.value;
|
|
|
|
|
|
},
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
width: 50.w,
|
|
|
|
|
|
height: 50.w,
|
|
|
|
|
|
padding: EdgeInsets.all(5.w),
|
|
|
|
|
|
child: Obx(() => Image(
|
|
|
|
|
|
width: 40.w,
|
|
|
|
|
|
height: 40.w,
|
|
|
|
|
|
image: state.isOpenVoice.value
|
|
|
|
|
|
? const AssetImage(
|
2024-08-21 18:31:19 +08:00
|
|
|
|
'images/main/icon_lockDetail_monitoringCloseVoice.png')
|
2024-01-03 15:24:42 +08:00
|
|
|
|
: const AssetImage(
|
2024-08-21 18:31:19 +08:00
|
|
|
|
'images/main/icon_lockDetail_monitoringOpenVoice.png'))),
|
2024-01-03 15:24:42 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
2024-03-06 19:12:58 +08:00
|
|
|
|
SizedBox(width: 50.w),
|
2024-01-03 15:24:42 +08:00
|
|
|
|
// 截图
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
// Get.toNamed(Routers.monitoringRealTimeScreenPage);
|
|
|
|
|
|
},
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
width: 50.w,
|
|
|
|
|
|
height: 50.w,
|
|
|
|
|
|
padding: EdgeInsets.all(5.w),
|
|
|
|
|
|
child: Image(
|
|
|
|
|
|
width: 40.w,
|
|
|
|
|
|
height: 40.w,
|
|
|
|
|
|
image: const AssetImage(
|
2024-08-21 18:31:19 +08:00
|
|
|
|
'images/main/icon_lockDetail_monitoringScreenshot.png')),
|
2024-01-03 15:24:42 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
2024-03-06 19:12:58 +08:00
|
|
|
|
SizedBox(width: 50.w),
|
2024-01-03 15:24:42 +08:00
|
|
|
|
// 录制
|
|
|
|
|
|
GestureDetector(
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
// Get.toNamed(Routers.monitoringRealTimeScreenPage);
|
|
|
|
|
|
},
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
width: 50.w,
|
|
|
|
|
|
height: 50.w,
|
|
|
|
|
|
padding: EdgeInsets.all(5.w),
|
|
|
|
|
|
child: Image(
|
|
|
|
|
|
width: 40.w,
|
|
|
|
|
|
height: 40.w,
|
2024-03-06 17:19:52 +08:00
|
|
|
|
fit: BoxFit.fill,
|
2024-01-03 15:24:42 +08:00
|
|
|
|
image: const AssetImage(
|
2024-08-21 18:31:19 +08:00
|
|
|
|
'images/main/icon_lockDetail_monitoringScreenRecording.png')),
|
2024-01-03 15:24:42 +08:00
|
|
|
|
),
|
|
|
|
|
|
),
|
2024-03-06 19:12:58 +08:00
|
|
|
|
SizedBox(width: 50.w),
|
2024-03-06 17:19:52 +08:00
|
|
|
|
GestureDetector(
|
|
|
|
|
|
onTap: () {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
logic.showToast('功能暂未开放'.tr);
|
2024-03-06 17:19:52 +08:00
|
|
|
|
},
|
|
|
|
|
|
child: Image(
|
|
|
|
|
|
width: 28.w,
|
|
|
|
|
|
height: 28.w,
|
|
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
|
|
image:
|
2024-08-21 18:31:19 +08:00
|
|
|
|
const AssetImage('images/main/icon_lockDetail_rectangle.png'))
|
2024-03-06 17:19:52 +08:00
|
|
|
|
// child: Container(
|
|
|
|
|
|
// width: 50.w,
|
|
|
|
|
|
// height: 50.w,
|
|
|
|
|
|
// padding: EdgeInsets.all(5.w),
|
|
|
|
|
|
// child: Image(
|
|
|
|
|
|
// width: 40.w,
|
|
|
|
|
|
// height: 40.w,
|
|
|
|
|
|
// fit: BoxFit.fill,
|
|
|
|
|
|
// image: const AssetImage(
|
|
|
|
|
|
// "images/main/icon_lockDetail_rectangle.png")),
|
|
|
|
|
|
// ),
|
|
|
|
|
|
)
|
2024-01-03 15:24:42 +08:00
|
|
|
|
]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget bottomBottomBtnWidget() {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: <Widget>[
|
2024-01-03 15:24:42 +08:00
|
|
|
|
// 接听
|
|
|
|
|
|
Obx(() => bottomBtnItemWidget(
|
|
|
|
|
|
getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
|
2024-01-12 11:59:47 +08:00
|
|
|
|
//监视状态下不能发送录音
|
2024-08-21 18:31:19 +08:00
|
|
|
|
logic.showToast('监视状态下不能发送录音'.tr);
|
2024-01-12 11:59:47 +08:00
|
|
|
|
}, longPress: () async {
|
2024-01-09 11:36:51 +08:00
|
|
|
|
/*
|
2024-01-12 11:59:47 +08:00
|
|
|
|
// 开始长按
|
2024-04-26 15:38:59 +08:00
|
|
|
|
AppLog.log("onLongPress");
|
2024-01-03 15:24:42 +08:00
|
|
|
|
//获取麦克风权限
|
|
|
|
|
|
await logic.getPermissionStatus().then((value) async {
|
|
|
|
|
|
if (!value) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// state.isSenderAudioData.value = false;
|
|
|
|
|
|
});
|
2024-01-12 11:59:47 +08:00
|
|
|
|
|
2024-01-03 15:24:42 +08:00
|
|
|
|
state.listAudioData.value = <int>[];
|
|
|
|
|
|
if (state.udpStatus.value == 8) {
|
|
|
|
|
|
state.udpStatus.value = 9;
|
|
|
|
|
|
}
|
|
|
|
|
|
// logic.readG711Data();
|
|
|
|
|
|
logic.startProcessing();
|
2024-01-09 11:36:51 +08:00
|
|
|
|
*/
|
2024-01-03 15:24:42 +08:00
|
|
|
|
}, longPressUp: () async {
|
2024-01-09 11:36:51 +08:00
|
|
|
|
/*
|
2024-01-03 15:24:42 +08:00
|
|
|
|
// 长按结束
|
2024-04-26 15:38:59 +08:00
|
|
|
|
AppLog.log("onLongPressUp");
|
2024-01-03 15:24:42 +08:00
|
|
|
|
if (state.udpStatus.value == 9) {
|
|
|
|
|
|
state.udpStatus.value = 8;
|
|
|
|
|
|
}
|
2024-01-09 11:36:51 +08:00
|
|
|
|
*/
|
2024-01-03 15:24:42 +08:00
|
|
|
|
})),
|
|
|
|
|
|
bottomBtnItemWidget(
|
2024-08-29 18:13:00 +08:00
|
|
|
|
'images/main/icon_lockDetail_hangUp.png', '挂断'.tr, Colors.red, () async {
|
2024-01-03 15:24:42 +08:00
|
|
|
|
// 挂断
|
|
|
|
|
|
logic.udpHangUpAction();
|
2024-04-15 14:53:14 +08:00
|
|
|
|
CallTalk().finishAVData();
|
2024-01-08 11:28:22 +08:00
|
|
|
|
Get.back();
|
2024-01-03 15:24:42 +08:00
|
|
|
|
}),
|
2024-08-21 18:31:19 +08:00
|
|
|
|
bottomBtnItemWidget('images/main/icon_lockDetail_monitoringUnlock.png',
|
|
|
|
|
|
'开锁', AppColors.mainColor, () {
|
|
|
|
|
|
logic.showToast('监视中暂不能开锁'.tr);
|
2024-01-09 11:36:51 +08:00
|
|
|
|
/*
|
2024-01-03 15:24:42 +08:00
|
|
|
|
showDeletPasswordAlertDialog(context);
|
2024-01-09 11:36:51 +08:00
|
|
|
|
*/
|
2024-01-03 15:24:42 +08:00
|
|
|
|
})
|
|
|
|
|
|
]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String getAnswerBtnImg() {
|
|
|
|
|
|
switch (state.udpStatus.value) {
|
|
|
|
|
|
case 8:
|
2024-08-21 18:31:19 +08:00
|
|
|
|
return 'images/main/icon_lockDetail_monitoringUnTalkback.png';
|
2024-01-03 15:24:42 +08:00
|
|
|
|
case 9:
|
2024-08-21 18:31:19 +08:00
|
|
|
|
return 'images/main/icon_lockDetail_monitoringTalkback.png';
|
2024-01-03 15:24:42 +08:00
|
|
|
|
default:
|
2024-08-21 18:31:19 +08:00
|
|
|
|
return 'images/main/icon_lockDetail_monitoringUnTalkback.png';
|
2024-01-03 15:24:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String getAnswerBtnName() {
|
|
|
|
|
|
switch (state.udpStatus.value) {
|
|
|
|
|
|
case 8:
|
2024-08-21 18:31:19 +08:00
|
|
|
|
return '长按说话'.tr;
|
2024-01-03 15:24:42 +08:00
|
|
|
|
case 9:
|
2024-08-21 18:31:19 +08:00
|
|
|
|
return '松开发送'.tr;
|
2024-01-03 15:24:42 +08:00
|
|
|
|
default:
|
2024-08-21 18:31:19 +08:00
|
|
|
|
return '长按说话'.tr;
|
2024-01-03 15:24:42 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget bottomBtnItemWidget(
|
|
|
|
|
|
String iconUrl, String name, Color backgroundColor, Function() onClick,
|
|
|
|
|
|
{Function()? longPress, Function()? longPressUp}) {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
double wh = 80.w;
|
2024-01-03 15:24:42 +08:00
|
|
|
|
return GestureDetector(
|
|
|
|
|
|
onTap: onClick,
|
|
|
|
|
|
onLongPress: longPress,
|
|
|
|
|
|
onLongPressUp: longPressUp,
|
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
|
height: 140.h,
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
2024-08-21 18:31:19 +08:00
|
|
|
|
children: <Widget>[
|
2024-01-03 15:24:42 +08:00
|
|
|
|
Container(
|
|
|
|
|
|
width: wh,
|
|
|
|
|
|
height: wh,
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
color: backgroundColor,
|
|
|
|
|
|
borderRadius: BorderRadius.circular((wh + 10.w * 2) / 2)),
|
|
|
|
|
|
padding: EdgeInsets.all(20.w),
|
|
|
|
|
|
child: Image.asset(iconUrl, fit: BoxFit.fitWidth),
|
|
|
|
|
|
),
|
|
|
|
|
|
SizedBox(height: 20.w),
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
child: Text(name,
|
|
|
|
|
|
style: TextStyle(fontSize: 20.sp, color: Colors.white),
|
|
|
|
|
|
textAlign: TextAlign.center))
|
|
|
|
|
|
],
|
|
|
|
|
|
)),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void showDeletPasswordAlertDialog(BuildContext context) {
|
|
|
|
|
|
showDialog(
|
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
|
context: context,
|
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
|
return ShowTFView(
|
2024-08-21 18:31:19 +08:00
|
|
|
|
title: '请输入六位数字开锁密码'.tr,
|
|
|
|
|
|
tipTitle: '',
|
2024-01-03 15:24:42 +08:00
|
|
|
|
controller: state.passwordTF,
|
2024-08-21 18:31:19 +08:00
|
|
|
|
inputFormatters: <TextInputFormatter>[
|
2024-01-03 15:24:42 +08:00
|
|
|
|
LengthLimitingTextInputFormatter(6), //限制长度
|
2024-08-21 18:31:19 +08:00
|
|
|
|
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
2024-01-03 15:24:42 +08:00
|
|
|
|
],
|
|
|
|
|
|
sureClick: () async {
|
|
|
|
|
|
//发送删除锁请求
|
|
|
|
|
|
if (state.passwordTF.text.isEmpty) {
|
2024-08-21 18:31:19 +08:00
|
|
|
|
logic.showToast('请输入开锁密码'.tr);
|
2024-01-03 15:24:42 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-09 11:36:51 +08:00
|
|
|
|
// List<int> numbers = state.passwordTF.text.split('').map((char) => int.parse(char)).toList();
|
2024-01-03 15:24:42 +08:00
|
|
|
|
// 开锁
|
2024-01-09 11:36:51 +08:00
|
|
|
|
// lockID
|
2024-08-21 18:31:19 +08:00
|
|
|
|
List<int> numbers = <int>[];
|
2024-01-09 11:36:51 +08:00
|
|
|
|
List<int> lockIDData = utf8.encode(state.passwordTF.text);
|
|
|
|
|
|
numbers.addAll(lockIDData);
|
|
|
|
|
|
// topBytes = getFixedLengthList(lockIDData, 20 - lockIDData.length);
|
|
|
|
|
|
for (int i = 0; i < 6 - lockIDData.length; i++) {
|
|
|
|
|
|
numbers.add(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
logic.udpOpenDoorAction(numbers);
|
2024-01-03 15:24:42 +08:00
|
|
|
|
},
|
|
|
|
|
|
cancelClick: () {
|
|
|
|
|
|
Get.back();
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//旋转动画
|
|
|
|
|
|
Widget buildRotationTransition() {
|
|
|
|
|
|
return Positioned(
|
|
|
|
|
|
left: ScreenUtil().screenWidth / 2 - 220.w / 2,
|
|
|
|
|
|
top: ScreenUtil().screenHeight / 2 - 220.w / 2 - 150.h,
|
2024-01-05 09:26:12 +08:00
|
|
|
|
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,
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
2024-01-03 15:24:42 +08:00
|
|
|
|
),
|
2024-01-05 09:26:12 +08:00
|
|
|
|
onTap: () {
|
2024-01-05 14:48:13 +08:00
|
|
|
|
state.animationController.forward();
|
2024-01-08 11:28:22 +08:00
|
|
|
|
initiateUdpMonitorAction();
|
2024-01-05 09:26:12 +08:00
|
|
|
|
},
|
2024-01-03 15:24:42 +08:00
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-08 11:28:22 +08:00
|
|
|
|
void _handleFailure() {
|
|
|
|
|
|
// 在这里处理失败的逻辑
|
2024-04-15 14:53:14 +08:00
|
|
|
|
CallTalk().finishAVData();
|
2024-01-11 09:41:19 +08:00
|
|
|
|
state.realTimePicTimer.cancel();
|
2024-01-24 18:51:18 +08:00
|
|
|
|
state.autoBackTimer.cancel();
|
2024-01-12 11:59:47 +08:00
|
|
|
|
if (state.animationController != null) {
|
|
|
|
|
|
state.animationController.stop();
|
|
|
|
|
|
}
|
2024-01-08 11:28:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-03 15:24:42 +08:00
|
|
|
|
@override
|
|
|
|
|
|
void dispose() {
|
|
|
|
|
|
state.animationController.dispose();
|
2024-01-24 18:51:18 +08:00
|
|
|
|
state.realTimePicTimer.cancel();
|
|
|
|
|
|
state.autoBackTimer.cancel();
|
2024-04-15 14:53:14 +08:00
|
|
|
|
CallTalk().finishAVData();
|
2024-01-03 15:24:42 +08:00
|
|
|
|
super.dispose();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|