This commit is contained in:
魏少阳 2024-01-06 16:26:19 +08:00
commit 396c750e47
15 changed files with 170 additions and 128 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -9,6 +9,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_sound/flutter_sound.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/talk/udp/udp_talkClass.dart';
import 'package:star_lock/tools/app_manager.dart';
import 'package:star_lock/tools/bindings/app_binding.dart';
import 'package:star_lock/tools/device_info_service.dart';
@ -175,6 +176,9 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
} else if (state == AppLifecycleState.paused) {
//
print("应用进入后台");
if (UDPTalkClass().isBeCall == true) {
UDPTalkClass().playLocalAudio();
}
}
}
}
@ -233,4 +237,3 @@ Future<bool> getMicrophonePermission() async {
}
return false;
}

View File

@ -24,7 +24,8 @@ class _AddICCardPageState extends State<AddICCardPage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: "${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}",
barTitle:
"${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.card!.tr}",
haveBack: true,
backgroundColor: AppColors.mainColor,
),
@ -32,22 +33,35 @@ class _AddICCardPageState extends State<AddICCardPage> {
crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 420.h),
CupertinoActivityIndicator(radius: 25.h,),
SizedBox(height: 200.h),
Image.asset(
'images/main/icon_addCard.png',
width: 234.w,
height: 211.h,
fit: BoxFit.cover,
),
SizedBox(height: 90.h),
CupertinoActivityIndicator(
radius: 25.h,
),
SizedBox(height: 120.h),
Container(
width: 1.sw,
height: 50.h,
// padding: EdgeInsets.only(left: 30.w, right: 30.w, top: 10.h, bottom: 10.h),
margin: EdgeInsets.only(left: 15.w, right: 15.w, top: 10.h, bottom: 10.h),
margin: EdgeInsets.only(
left: 15.w, right: 15.w, top: 10.h, bottom: 10.h),
// color: AppColors.blackColor,
decoration: BoxDecoration(
color: AppColors.blackColor,
borderRadius: BorderRadius.circular(10.w),
),
child: Center(
child: Obx(() => Text(state.ifConnectScuess.value ? "已连接到锁,请将卡靠近锁的读卡区" : "尝试连接设备...", style:TextStyle(color: Colors.white, fontSize: 24.sp)))
),
child: Obx(() => Text(
state.ifConnectScuess.value
? "已连接到锁,请将卡靠近锁的读卡区"
: "尝试连接设备...",
style: TextStyle(color: Colors.white, fontSize: 24.sp)))),
),
],
),

View File

@ -6,6 +6,7 @@ import 'package:flutter_voice_processor/flutter_voice_processor.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/main/lockDetail/lockDetail/realTimePicture/realTimePicture_state.dart';
import 'package:star_lock/talk/call/callTalk.dart';
import '../../../../talk/call/g711.dart';
import '../../../../talk/udp/udp_manage.dart';
@ -62,6 +63,7 @@ class RealTimePictureLogic extends BaseGetXController {
userMobile: await state.userMobile,
userMobileIP: await state.userMobileIP,
endData: []);
CallTalk().stopPcmSound();
//
Get.back();

View File

@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockDetail/realTimePicture/realTimePicture_logic.dart';
import 'package:star_lock/talk/call/callTalk.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/showTFView.dart';
@ -39,6 +40,11 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
}
});
// 10
Future.delayed(const Duration(seconds: 10), () {
state.animationController.stop();
});
logic.udpMonitorAction();
}
@ -188,7 +194,7 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
bottomBtnItemWidget(
"images/main/icon_lockDetail_hangUp.png", "挂断", Colors.red, () async {
logic.stopProcessing();
CallTalk().stopPcmSound();
//
logic.udpHangUpAction();
}),
@ -307,7 +313,7 @@ class _RealTimePicturePageState extends State<RealTimePicturePage>
),
),
onTap: () {
print('点击重新连接');
state.animationController.forward();
},
),
);

View File

@ -1,4 +1,3 @@
import 'dart:async';
import 'dart:convert';
import 'dart:math';
@ -7,6 +6,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_voice_processor/flutter_voice_processor.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/talk/call/callTalk.dart';
import '../../../../talk/call/g711.dart';
import '../../../../talk/udp/udp_manage.dart';
@ -41,14 +41,16 @@ class LockMonitoringLogic extends BaseGetXController {
/// UDP发送的状态
StreamSubscription? _getUDPStatusRefreshUIEvent;
void _getUDPStatusRefreshUIAction() {
_getUDPStatusRefreshUIEvent = eventBus.on<GetUDPStatusRefreshUI>().listen((event) {
_getUDPStatusRefreshUIEvent =
eventBus.on<GetUDPStatusRefreshUI>().listen((event) {
state.udpStatus.value = event.udpStatus;
if(state.udpStatus.value == 8){
if (state.udpStatus.value == 8) {
// 60
state.oneMinuteTimeTimer = Timer.periodic(const Duration(seconds:1), (Timer t) async {
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){
if (state.oneMinuteTime.value >= 60) {
// 60
state.oneMinuteTimeTimer.cancel();
state.oneMinuteTime.value = 0;
@ -63,6 +65,7 @@ class LockMonitoringLogic extends BaseGetXController {
userMobileIP: await state.userMobileIP,
endData: []);
CallTalk().stopPcmSound();
//
Get.back();
}
@ -81,8 +84,7 @@ class LockMonitoringLogic extends BaseGetXController {
lockIP: UDPManage().host,
userMobile: await state.userMobile,
userMobileIP: await state.userMobileIP,
endData: []
);
endData: []);
}
///
@ -128,7 +130,9 @@ class LockMonitoringLogic extends BaseGetXController {
while (start < audioData.length) {
// await Future.delayed(const Duration(milliseconds: 50));
int end = (start + length > audioData.length) ? audioData.length : start + length;
int end = (start + length > audioData.length)
? audioData.length
: start + length;
List<int> sublist = audioData.sublist(start, end);
sendRecordData({
"bytes": sublist,
@ -165,7 +169,9 @@ class LockMonitoringLogic extends BaseGetXController {
errorListener(VoiceProcessorException error) {
print("VoiceProcessorException: $error");
};
}
;
state.voiceProcessor?.addFrameListener(frameListener);
state.voiceProcessor?.addErrorListener(errorListener);
@ -173,15 +179,10 @@ class LockMonitoringLogic extends BaseGetXController {
if (await state.voiceProcessor?.hasRecordAudioPermission() ?? false) {
await state.voiceProcessor?.start(320, 8000);
bool? isRecording = await state.voiceProcessor?.isRecording();
} else {
}
} else {}
} on PlatformException catch (ex) {
Get.log("PlatformException: $ex");
} finally {
}
} finally {}
}
Future<void> stopProcessing() async {
@ -189,9 +190,7 @@ class LockMonitoringLogic extends BaseGetXController {
await state.voiceProcessor?.stop();
} on PlatformException catch (ex) {
Get.log("PlatformException: $ex");
} finally {
}
} finally {}
}
void onError(Object e) {
@ -199,7 +198,6 @@ class LockMonitoringLogic extends BaseGetXController {
}
sendRecordData(Map<String, dynamic> args) async {
List<int> bytes = args["bytes"];
// int udpSendDataFrameNumber = args["udpSendDataFrameNumber"];
String? lockID = args["lockID"];
@ -218,7 +216,7 @@ class LockMonitoringLogic extends BaseGetXController {
// while(list.isNotEmpty) {
state.udpSendDataFrameNumber++;
if (state.udpSendDataFrameNumber >= 65536) state.udpSendDataFrameNumber=1;
if (state.udpSendDataFrameNumber >= 65536) state.udpSendDataFrameNumber = 1;
// 57
List<int> topBytes = [];
@ -281,7 +279,8 @@ class LockMonitoringLogic extends BaseGetXController {
topBytes[6] = (state.udpSendDataFrameNumber & 0x000000FF);
topBytes[7] = ((state.udpSendDataFrameNumber & 0x0000FF00) >> 8);
print("udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}");
print(
"udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}");
topBytes.addAll(bytes);
Get.log("setVoiceBytes:$topBytes");
@ -293,8 +292,7 @@ class LockMonitoringLogic extends BaseGetXController {
lockIP: lockIP,
userMobile: userMobile,
userMobileIP: userMobileIP,
endData: topBytes
);
endData: topBytes);
// UDPManage().sendData(topBytes);
}
@ -324,7 +322,16 @@ class LockMonitoringLogic extends BaseGetXController {
}
int search(int val) {
List<int> table = [0xFF, 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF];
List<int> table = [
0xFF,
0x1FF,
0x3FF,
0x7FF,
0xFFF,
0x1FFF,
0x3FFF,
0x7FFF
];
int size = 8;
for (int i = 0; i < size; i++) {
if (val <= table[i]) {
@ -392,9 +399,10 @@ class LockMonitoringLogic extends BaseGetXController {
void onClose() {
// TODO: implement onClose
print("锁详情界面销毁了");
CallTalk().stopPcmSound();
_getTVDataRefreshUIEvent!.cancel();
_getUDPStatusRefreshUIEvent!.cancel();
if(state.oneMinuteTimeTimer != null){
if (state.oneMinuteTimeTimer != null) {
state.oneMinuteTimeTimer.cancel();
}
stopProcessing();

View File

@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
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 '../../../../app_settings/app_colors.dart';
import '../../../../talk/udp/udp_manage.dart';
@ -43,12 +43,15 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
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');
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)),
Text("$min:$sec",
style: TextStyle(fontSize: 26.sp, color: Colors.white)),
// SizedBox(width: 30.w),
// GestureDetector(
// onTap: () {
@ -66,8 +69,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
// ),
// ),
// ),
]
);
]);
}),
),
Positioned(
@ -155,45 +157,44 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
Widget bottomBottomBtnWidget() {
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
//
Obx(() => bottomBtnItemWidget(getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
//
await logic.getPermissionStatus().then((value) async {
if (!value) {
return;
}
Obx(() => bottomBtnItemWidget(
getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
//
await logic.getPermissionStatus().then((value) async {
if (!value) {
return;
}
// state.isSenderAudioData.value = false;
print("发送接听了");
//
logic.udpAnswerAction();
});
},
longPress: (){
//
print("onLongPress");
state.listAudioData.value = <int>[];
if (state.udpStatus.value == 8) {
state.udpStatus.value = 9;
}
// logic.readG711Data();
logic.startProcessing();
},
longPressUp: () async {
//
print("onLongPressUp");
if (state.udpStatus.value == 9) {
state.udpStatus.value = 8;
}
// state.isSenderAudioData.value = false;
print("发送接听了");
//
logic.udpAnswerAction();
});
}, longPress: () {
//
print("onLongPress");
state.listAudioData.value = <int>[];
if (state.udpStatus.value == 8) {
state.udpStatus.value = 9;
}
)
),
bottomBtnItemWidget("images/main/icon_lockDetail_hangUp.png", "挂断", Colors.red, () async {
// logic.readG711Data();
logic.startProcessing();
}, longPressUp: () async {
//
print("onLongPressUp");
if (state.udpStatus.value == 9) {
state.udpStatus.value = 8;
}
})),
bottomBtnItemWidget(
"images/main/icon_lockDetail_hangUp.png", "挂断", Colors.red, () async {
logic.stopProcessing();
CallTalk().stopPcmSound();
//
logic.udpHangUpAction();
}),
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png", "开锁", AppColors.mainColor, () {
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
"开锁", AppColors.mainColor, () {
showDeletPasswordAlertDialog(context);
})
]);
@ -202,26 +203,28 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
String getAnswerBtnImg() {
switch (state.udpStatus.value) {
case 8:
return "images/main/icon_lockDetail_monitoringUnTalkback.png";
return "images/main/icon_lockDetail_monitoringUnTalkback.png";
case 9:
return "images/main/icon_lockDetail_monitoringTalkback.png";
return "images/main/icon_lockDetail_monitoringTalkback.png";
default:
return "images/main/icon_lockDetail_monitoringAnswerCalls.png";
return "images/main/icon_lockDetail_monitoringAnswerCalls.png";
}
}
String getAnswerBtnName() {
switch (state.udpStatus.value) {
case 8:
return "长按说话";
return "长按说话";
case 9:
return "松开发送";
return "松开发送";
default:
return "接听";
return "接听";
}
}
Widget bottomBtnItemWidget(String iconUrl, String name, Color backgroundColor, Function() onClick, {Function()? longPress, Function()? longPressUp}) {
Widget bottomBtnItemWidget(
String iconUrl, String name, Color backgroundColor, Function() onClick,
{Function()? longPress, Function()? longPressUp}) {
var wh = 80.w;
return GestureDetector(
onTap: onClick,
@ -285,6 +288,5 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
@override
void dispose() {
super.dispose();
}
}

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/CustomUnderlineTabIndicator.dart';
@ -13,9 +14,7 @@ class PasswordKeyManageTabbarPage extends StatefulWidget {
final LockListInfoItemEntity keyInfo;
PasswordKeyManageTabbarPage(
{Key? key,
required this.initialIndex,
required this.keyInfo})
{Key? key, required this.initialIndex, required this.keyInfo})
: super(key: key);
@override
State<PasswordKeyManageTabbarPage> createState() =>
@ -44,6 +43,15 @@ class _PasswordKeyManageTabbarPageState
vsync: this,
length: _itemTabs.length,
initialIndex: widget.initialIndex);
_tabController.addListener(handleTabIndex);
}
int handleTabIndex() {
//
int currentIndex = _tabController.index;
// item
eventBus.fire(GetPasswordTypeUpdateIndex(currentIndex));
return currentIndex;
}
@override
@ -102,7 +110,7 @@ class _PasswordKeyManageTabbarPageState
controller: _tabController,
children: _itemTabs
.map((ItemView item) => PasswordKeyPerpetualPage(
type: item.type,
type: _tabController.index.toString(),
getKeyInfo: widget.keyInfo,
))
.toList(),

View File

@ -4,6 +4,7 @@ import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
import 'package:star_lock/blue/io_type.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
import 'package:star_lock/tools/toast.dart';
import '../../../../blue/blue_manage.dart';
@ -18,6 +19,15 @@ import '../../../../tools/storage.dart';
class PasswordKeyPerpetualLogic extends BaseGetXController {
final PasswordKeyPerpetualState state = PasswordKeyPerpetualState();
///
StreamSubscription? getPasswordTypeUpdateIndexEvent;
void getPasswordTypeUpdateIndexAction() {
getPasswordTypeUpdateIndexEvent =
eventBus.on<GetPasswordTypeUpdateIndex>().listen((event) {
state.widgetType.value = event.passwordType;
});
}
/**
1 6使
2 24使
@ -39,20 +49,19 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
String getFailureDateTime = '0';
String getEffectiveDateTime = '0';
String lockId = state.keyInfo.value.lockId.toString();
int passwordType = int.parse(state.widgetType.value);
String getKeyType = passwordType.toString();
if (passwordType == 0) {
String getKeyType = state.widgetType.value.toString();
if (state.widgetType.value == 0) {
//
getKeyType = '2';
} else if (passwordType == 1) {
} else if (state.widgetType.value == 1) {
//
getKeyType = '3';
} else if (passwordType == 2) {
} else if (state.widgetType.value == 2) {
//
getKeyType = '1';
} else if (passwordType == 3) {
} else if (state.widgetType.value == 3) {
//
} else if (passwordType == 4) {
} else if (state.widgetType.value == 4) {
//
if (state.loopModeStr.value == '周末') {
getKeyType = '5';
@ -75,15 +84,14 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
} else if (state.loopModeStr.value == '星期日') {
getKeyType = '14';
}
} else if (passwordType == 5) {
} else if (state.widgetType.value == 5) {
//
getKeyType = '4';
}
print('得到的类型为getKeyType$getKeyType');
if (state.widgetType.value != '0' &&
state.widgetType.value != '2' &&
state.widgetType.value != '5') {
if (state.widgetType.value != 0 &&
state.widgetType.value != 2 &&
state.widgetType.value != 5) {
getFailureDateTime =
state.failureDateTime.value.millisecondsSinceEpoch.toString();
getEffectiveDateTime =
@ -223,7 +231,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
//
Future<void> senderCustomPasswords() async {
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState state) async {
BlueManage().bludSendData(BlueManage().connectDeviceName,
(DeviceConnectionState state) async {
if (state == DeviceConnectionState.connected) {
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
@ -257,6 +266,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
super.onReady();
_initReplySubscription();
getPasswordTypeUpdateIndexAction();
}
@override

View File

@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_tabbar.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/style/default_style.dart';
@ -54,8 +55,6 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
@override
Widget build(BuildContext context) {
state.widgetType.value = widget.type;
return SingleChildScrollView(
child: Obx(() => indexChangeWidget()),
);
@ -65,7 +64,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
if (state.isSendSuccess.value == true) {
return sendElectronicKeySucceed();
} else {
switch (int.parse(widget.type)) {
switch (state.widgetType.value) {
case 0:
{
//
@ -186,7 +185,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDH,
onConfirm: (p) {
if (int.parse(widget.type) == 3) {
if (state.widgetType.value == 3) {
//
state.effectiveDateTime.value = DateTime.parse(
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}');
@ -216,7 +215,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
action: () {
Pickers.showDatePicker(context, mode: DateMode.YMDH,
onConfirm: (p) {
if (int.parse(widget.type) == 3) {
if (state.widgetType.value == 3) {
//
state.failureDateTime.value = DateTime.parse(
'${p.year}-${intToStr(p.month!)}-${intToStr(p.day!)} ${intToStr(p.hour!)}:${intToStr(p.minute!)}');
@ -400,7 +399,6 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
onClick: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
int getWidgetNumber = int.parse(widget.type);
DateTime startDateTime = DateTime(
state.effectiveDateTime.value.year,
state.effectiveDateTime.value.month,
@ -413,7 +411,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
state.failureDateTime.value.hour);
//
if (getWidgetNumber == 3) {
if (state.widgetType.value == 3) {
logic.getStartDate(state.effectiveDateTime.value);
if (state.nameController.text.isEmpty) {
Toast.show(msg: '请输入姓名');
@ -440,7 +438,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
}
//
if (getWidgetNumber == 1) {
if (state.widgetType.value == 1) {
if (!startDateTime.isBefore(endDateTime) ||
startDateTime.isAtSameMomentAs(endDateTime)) {
Toast.show(msg: '失效时间需大于生效时间');
@ -448,7 +446,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
}
}
//
if (getWidgetNumber == 4) {
if (state.widgetType.value == 4) {
if (!startDateTime.isBefore(endDateTime) ||
startDateTime.isAtSameMomentAs(endDateTime)) {
Toast.show(msg: '结束时间需大于当前时间');

View File

@ -43,6 +43,6 @@ class PasswordKeyPerpetualState {
var loopEndHours = DateTime.now().hour.obs;
var loopModeStr = '周末'.obs; //
final widgetType = ''.obs;
final widgetType = 0.obs;
final keyInfo = LockListInfoItemEntity().obs;
}

View File

@ -153,6 +153,9 @@ class CallTalk {
//
void stopPcmSound() {
FlutterPcmSound.setup(sampleRate: 8000, channelCount: 1);
FlutterPcmSound.pause();
FlutterPcmSound.clear();
FlutterPcmSound.stop();
}
}

View File

@ -1,5 +1,4 @@
import 'dart:async';
import 'package:audioplayers/audioplayers.dart';
import 'package:fast_gbk/fast_gbk.dart';
import 'package:flutter/material.dart';
@ -71,11 +70,7 @@ class UDPTalkClass {
UDPManage().sendData(data);
});
// _getFirstFrameGoPushAction();
// Future.delayed(const Duration(seconds: 1), () {
//
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
// });
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
}
playLocalAudio();
@ -84,19 +79,6 @@ class UDPTalkClass {
}
}
void _getFirstFrameGoPushAction() {
// eventBus
StreamSubscription _GetFirstFrameGoPushEvent =
eventBus.on<GetFirstFrameGoPush>().listen((event) {
if (event.isFirstFrame == true) {
Future.delayed(const Duration(seconds: 1), () {
//
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
});
}
});
}
// call的本人
Future<bool> isCallMe(List<int>? data) async {
final loginData = await Storage.getLoginData();

View File

@ -67,3 +67,9 @@ class GetFirstFrameGoPush {
bool isFirstFrame;
GetFirstFrameGoPush(this.isFirstFrame);
}
/// typeIndex
class GetPasswordTypeUpdateIndex {
int passwordType;
GetPasswordTypeUpdateIndex(this.passwordType);
}