This commit is contained in:
魏少阳 2024-04-20 17:50:05 +08:00
commit 30384c39ba
15 changed files with 452 additions and 142 deletions

View File

@ -730,5 +730,18 @@
"蓝牙":"Bluetooth",
"需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"Access to Bluetooth permissions is required to use the location information of the add key function",
"请输入Email":"Please enter Email",
"请输入手机号":"Please enter mobile phone number"
"请输入手机号":"Please enter mobile phone number",
"家人到家":"Family gets home",
"添加家人":"Add family",
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择":"If the lock is not connected to the Internet, in addition to the electronic key, the password, card, fingerprint and other door reminders can not be sent in time, please choose according to your actual situation",
"消息提醒":"Message reminder",
"开门通知":"Opening notice",
"N天未开门":"N days without opening the door",
"门未关好":"The door is not closed",
"防拆报警":"Tamper alarm",
"低电量提醒":"Low power reminder",
"胁迫开门":"Forced door opening",
"有人按门铃":"Someone rings the doorbell",
"有人出现在门口":"Someone appears at the door",
"提醒方式":"Reminder mode"
}

View File

@ -729,5 +729,18 @@
"蓝牙":"蓝牙",
"需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"需要访问蓝牙权限才能使用添加钥匙功能的位置信息",
"请输入Email":"请输入Email",
"请输入手机号":"请输入手机号"
"请输入手机号":"请输入手机号",
"家人到家":"家人到家",
"添加家人":"添加家人",
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择":"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择",
"消息提醒":"消息提醒",
"开门通知":"开门通知",
"N天未开门":"N天未开门",
"门未关好":"门未关好",
"防拆报警":"防拆报警",
"低电量提醒":"低电量提醒",
"胁迫开门":"胁迫开门",
"有人按门铃":"有人按门铃",
"有人出现在门口":"有人出现在门口",
"提醒方式":"提醒方式"
}

View File

@ -731,5 +731,19 @@
"蓝牙":"蓝牙",
"需要访问蓝牙权限才能使用添加钥匙功能的位置信息":"需要访问蓝牙权限才能使用添加钥匙功能的位置信息",
"请输入Email":"请输入Email",
"请输入手机号":"请输入手机号"
"请输入手机号":"请输入手机号",
"家人到家":"家人到家",
"添加家人":"添加家人",
"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择":"若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择",
"消息提醒":"消息提醒",
"开门通知":"开门通知",
"N天未开门":"N天未开门",
"门未关好":"门未关好",
"防拆报警":"防拆报警",
"低电量提醒":"低电量提醒",
"胁迫开门":"胁迫开门",
"有人按门铃":"有人按门铃",
"有人出现在门口":"有人出现在门口",
"提醒方式":"提醒方式",
"电子钥匙":"电子钥匙"
}

View File

@ -729,27 +729,27 @@ class _LockDetailPageState extends State<LockDetailPage>
);
}
// if (state.keyInfos.value.lockFeature!.isSupportIris == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_iris.png', '虹膜'.tr,
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.irisListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
}),
);
// }
if (state.keyInfos.value.lockFeature!.isSupportIris == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_iris.png', '虹膜'.tr,
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.irisListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
}),
);
}
// if (state.keyInfos.value.lockFeature!.palmVein == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_palm.png', '手掌'.tr,
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.palmListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
}),
);
// }
if (state.keyInfos.value.lockFeature!.palmVein == 1) {
showWidgetArr.add(
bottomItem('images/main/icon_palm.png', '手掌'.tr,
state.openDoorBtnisUneable.value, state.bottomBtnisEable.value, () {
Get.toNamed(Routers.palmListPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
}),
);
}
//->
if (state.keyInfos.value.lockFeature!.videoIntercom == 1) {

View File

@ -32,24 +32,32 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
padding: EdgeInsets.all(30.w),
child: Column(
children: [
CommonItem(
Obx(() => CommonItem(
leftTitel: '开门方式',
rightTitle: '请选择',
rightTitle: state.lockUserKeys.value.currentKeyTypeStr ?? '请选择',
isHaveLine: true,
isHaveDirection: true,
action: () {
//
Get.toNamed(Routers.lockUserPage,
arguments: {'getLockId': state.getLockId.value});
}),
CommonItem(
leftTitel: '家人',
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
isHaveDirection: false,
rightWidget: getFamilyWidget('请输入'),
),
arguments: {'getLockId': state.getLockId.value})
?.then((val) {
if (val != null) {
state.lockUserKeys.value = val;
}
});
})),
Obx(() => CommonItem(
leftTitel: '家人',
rightTitle: state.lockUserKeys.value.currentKeyName ?? '',
isHaveLine: true,
isHaveRightWidget:
state.lockUserKeys.value.currentKeyName == null
? true
: false,
isHaveDirection: false,
rightWidget: getFamilyWidget('请输入'),
)),
SizedBox(
height: 20.h,
),

View File

@ -1,7 +1,9 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
class AddFamilyState {
var getLockId = 0.obs;
var lockUserKeys = LockUserListKeys().obs;
AddFamilyState() {
Map map = Get.arguments;

View File

@ -60,13 +60,13 @@ class LockUserData {
}
class LockUserListKeys {
int? id;
// int? id;
String? clientId;
int? lockOwnerId;
int? apiUserId;
int? lockId;
int? senderUserId;
int? receiverUsernameType;
// int? senderUserId;
// int? receiverUsernameType;
String? keyName;
int? keyType;
int? startDate;
@ -90,8 +90,14 @@ class LockUserListKeys {
UserInfo? userInfo;
UserInfo? userSender;
int? keyboardPwdType;
int? fingerprintType;
int? cardType;
int? faceType;
int? keyboardPwdStatus;
String? keyboardPwdName;
String? fingerprintName;
String? cardName;
String? faceName;
String? keyboardPwd;
String? keyboardPwdHash;
int? addType;
@ -104,15 +110,22 @@ class LockUserListKeys {
String? senderUsername;
int? keyboardPwdId;
int? sendDate;
int? currentKeyType; // 1: 2: 3: 4: 5:
String? currentKeyTypeStr; //
String? currentTypeImg; //
String? currentKeyName; //
bool? isCurrentSelect; //
int? currentDateType; // 1: 2: 3: 4:
LockUserListKeys(
{this.id,
{
// this.id,
this.clientId,
this.lockOwnerId,
this.apiUserId,
this.lockId,
this.senderUserId,
this.receiverUsernameType,
// this.senderUserId,
// this.receiverUsernameType,
this.keyName,
this.keyType,
this.startDate,
@ -136,8 +149,14 @@ class LockUserListKeys {
this.userInfo,
this.userSender,
this.keyboardPwdType,
this.fingerprintType,
this.cardType,
this.faceType,
this.keyboardPwdStatus,
this.keyboardPwdName,
this.fingerprintName,
this.cardName,
this.faceName,
this.keyboardPwd,
this.keyboardPwdHash,
this.addType,
@ -149,16 +168,21 @@ class LockUserListKeys {
this.pwdUserNo,
this.senderUsername,
this.keyboardPwdId,
this.sendDate});
this.sendDate,
this.currentKeyType,
this.currentTypeImg,
this.currentKeyName,
this.isCurrentSelect,
this.currentDateType});
LockUserListKeys.fromJson(Map<String, dynamic> json) {
id = json['id'];
// id = json['id'];
clientId = json['clientId'];
lockOwnerId = json['lockOwnerId'];
apiUserId = json['apiUserId'];
lockId = json['lockId'];
senderUserId = json['senderUserId'];
receiverUsernameType = json['receiverUsernameType'];
// senderUserId = json['senderUserId'];
// receiverUsernameType = json['receiverUsernameType'];
keyName = json['keyName'];
keyType = json['keyType'];
startDate = json['startDate'];
@ -190,8 +214,14 @@ class LockUserListKeys {
? UserInfo.fromJson(json['user_sender'])
: null;
keyboardPwdType = json['keyboardPwdType'];
fingerprintType = json['fingerprintType'];
cardType = json['cardType'];
faceType = json['faceType'];
keyboardPwdStatus = json['keyboardPwdStatus'];
keyboardPwdName = json['keyboardPwdName'];
fingerprintName = json['fingerprintName'];
cardName = json['cardName'];
faceName = json['faceName'];
keyboardPwd = json['keyboardPwd'];
keyboardPwdHash = json['keyboardPwdHash'];
addType = json['addType'];
@ -204,17 +234,22 @@ class LockUserListKeys {
senderUsername = json['senderUsername'];
keyboardPwdId = json['keyboardPwdId'];
sendDate = json['sendDate'];
currentKeyType = json['currentKeyType'];
currentTypeImg = json['currentTypeImg'];
currentKeyName = json['currentKeyName'];
isCurrentSelect = json['isCurrentSelect'];
currentDateType = json['currentDateType'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
// data['id'] = id;
data['clientId'] = clientId;
data['lockOwnerId'] = lockOwnerId;
data['apiUserId'] = apiUserId;
data['lockId'] = lockId;
data['senderUserId'] = senderUserId;
data['receiverUsernameType'] = receiverUsernameType;
// data['senderUserId'] = senderUserId;
// data['receiverUsernameType'] = receiverUsernameType;
data['keyName'] = keyName;
data['keyType'] = keyType;
data['startDate'] = startDate;
@ -244,8 +279,14 @@ class LockUserListKeys {
data['user_sender'] = userSender!.toJson();
}
data['keyboardPwdType'] = keyboardPwdType;
data['fingerprintType'] = fingerprintType;
data['cardType'] = cardType;
data['faceType'] = faceType;
data['keyboardPwdStatus'] = keyboardPwdStatus;
data['keyboardPwdName'] = keyboardPwdName;
data['fingerprintName'] = fingerprintName;
data['cardName'] = cardName;
data['faceName'] = faceName;
data['keyboardPwd'] = keyboardPwd;
data['keyboardPwdHash'] = keyboardPwdHash;
data['addType'] = addType;
@ -258,6 +299,12 @@ class LockUserListKeys {
data['senderUsername'] = senderUsername;
data['keyboardPwdId'] = keyboardPwdId;
data['sendDate'] = sendDate;
data['currentKeyType'] = currentKeyType;
data['currentTypeImg'] = currentTypeImg;
data['currentKeyName'] = currentKeyName;
data['isCurrentSelect'] = isCurrentSelect;
data['currentDateType'] = currentDateType;
return data;
}
}

View File

@ -1,16 +1,242 @@
import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/dateTool.dart';
class LockUserLogic extends BaseGetXController {
final LockUserState state = LockUserState();
//
void getLockNoticeSetting() async {
void getLockKeysList() async {
LockUserEntity entity = await ApiRepository.to.getLockKeysList(
lockId: state.getLockId.value,
);
if (entity.errorCode!.codeIsSuccessful) {}
if (entity.errorCode!.codeIsSuccessful) {
// 1: 2: 3: 4: 5:
LockUserData data1 = entity.data![0];
data1.lockUserList?.forEach((element) {
element.currentKeyType = 1;
element.currentKeyTypeStr = '电子钥匙'.tr;
element.currentTypeImg = 'images/controls_user.png';
element.currentKeyName = element.keyName;
element.isCurrentSelect = false;
element.currentDateType = element.keyType;
});
LockUserData data2 = entity.data![1];
data2.lockUserList?.forEach((element) {
element.currentKeyType = 2;
element.currentKeyTypeStr = '密码'.tr;
element.currentTypeImg = 'images/icon_password.png';
element.currentKeyName = element.keyboardPwdName;
element.isCurrentSelect = false;
element.currentDateType = element.keyboardPwdType;
});
LockUserData data3 = entity.data![2];
data3.lockUserList?.forEach((element) {
element.currentKeyType = 3;
element.currentKeyTypeStr = '指纹'.tr;
element.currentTypeImg = 'images/icon_fingerprint.png';
element.currentKeyName = element.fingerprintName;
element.isCurrentSelect = false;
element.currentDateType = element.fingerprintType;
});
LockUserData data4 = entity.data![3];
data4.lockUserList?.forEach((element) {
element.currentKeyType = 4;
element.currentKeyTypeStr = ''.tr;
element.currentTypeImg = 'images/icon_card.png';
element.currentKeyName = element.cardName;
element.isCurrentSelect = false;
element.currentDateType = element.cardType;
});
LockUserData data5 = entity.data![4];
data5.lockUserList?.forEach((element) {
element.currentKeyType = 5;
element.currentKeyTypeStr = '人脸'.tr;
element.currentTypeImg = 'images/icon_face.png';
element.currentKeyName = element.faceName;
element.isCurrentSelect = false;
element.currentDateType = element.faceType;
});
state.lockUserList.value.addAll(data1.lockUserList!);
state.lockUserList.value.addAll(data2.lockUserList!);
state.lockUserList.value.addAll(data3.lockUserList!);
state.lockUserList.value.addAll(data4.lockUserList!);
state.lockUserList.value.addAll(data5.lockUserList!);
state.lockUserList.refresh();
}
}
String getKeyUseDateStr(LockUserListKeys itemData) {
var keyDateTypeStr = "";
switch (itemData.currentKeyType) {
case 1: //
keyDateTypeStr = getElectronicKeyUseDateStr(itemData);
break;
case 2: //
keyDateTypeStr = getPasswordUseDateStr(itemData);
break;
case 3: //
keyDateTypeStr = getfingerprintUseDateStr(itemData);
break;
case 4: //
case 5: //
keyDateTypeStr = getCardAndFaceDateType(itemData);
break;
default:
keyDateTypeStr = "".tr;
break;
}
return keyDateTypeStr;
}
//使
String getElectronicKeyUseDateStr(LockUserListKeys indexEntity) {
String useDateStr = '';
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
//
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
//
useDateStr = "永久".tr;
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
//
useDateStr = "单次".tr;
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
//
useDateStr = '循环'.tr;
}
return useDateStr;
}
//
String getPasswordUseDateStr(LockUserListKeys itemData) {
int? getPwdType = itemData.keyboardPwdType;
String useDateStr = '';
DateTime sendDateStr =
DateTime.fromMillisecondsSinceEpoch(itemData.sendDate!);
DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(itemData.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(itemData.endDate!);
int starHour = startDateStr.hour;
int endHour = endDateStr.hour;
// print("sendDateStr.toLocal().toString():${sendDateStr.toLocal().toString()}");
switch (getPwdType) {
case 1:
// 1 6使
useDateStr = "单次".tr;
break;
case 2:
// 2 24使
useDateStr = "永久".tr;
break;
case 3:
// 3 24使
useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} ${"限时".tr} ${itemData.isCustom! == 1 ? "自定义".tr : ""}';
break;
case 4:
// 4 使使
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
break;
case 5:
// 5
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 6:
// 6
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
break;
case 7:
// 7
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 8:
// 8
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 9:
// 9
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 10:
// 10
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 11:
// 11
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 12:
// 12
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 13:
// 13
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
case 14:
// 14
useDateStr =
'${endDateStr.toLocal().toString().substring(0, 16)} ${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break;
default:
}
return useDateStr;
}
//
String getfingerprintUseDateStr(LockUserListKeys fingerprintItemData) {
var keyDateTypeStr = ""; // :1;23:4
if (fingerprintItemData.fingerprintType! == 1) {
keyDateTypeStr = "永久".tr;
} else if (fingerprintItemData.fingerprintType! == 2) {
keyDateTypeStr =
"${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
} else if (fingerprintItemData.fingerprintType! == 4) {
keyDateTypeStr =
"${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环";
}
return keyDateTypeStr;
}
///
String getCardAndFaceDateType(LockUserListKeys fingerprintItemData) {
var keyDateTypeStr = ""; // :1;23:4
if (fingerprintItemData.cardType! == 1) {
keyDateTypeStr = "永久".tr;
} else if (fingerprintItemData.cardType! == 2) {
keyDateTypeStr =
"${DateTool().dateToYMDHNString(fingerprintItemData.startDate.toString())} - ${DateTool().dateToYMDHNString(fingerprintItemData.endDate.toString())} 限时";
} else if (fingerprintItemData.cardType! == 4) {
keyDateTypeStr =
"${DateTool().dateToYMDString(fingerprintItemData.startDate.toString())}-${DateTool().dateToYMDString(fingerprintItemData.endDate.toString())} 循环";
}
return keyDateTypeStr;
}
}

View File

@ -1,11 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart';
import 'package:star_lock/tools/keySearchWidget.dart';
import '../../../../app_settings/app_colors.dart';
import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart';
import '../../../../translations/trans_lib.dart';
class LockUserPage extends StatefulWidget {
const LockUserPage({Key? key}) : super(key: key);
@ -22,7 +23,7 @@ class _LockUserPageState extends State<LockUserPage> {
initState() {
super.initState();
logic.getLockNoticeSetting();
logic.getLockKeysList();
}
@override
@ -36,14 +37,24 @@ class _LockUserPageState extends State<LockUserPage> {
),
body: Column(
children: [
_searchWidget(),
KeySearchWidget(
editingController: state.searchController,
onSubmittedAction: () {
logic.pageNo = 1;
logic.getLockKeysList();
},
),
SizedBox(
height: 20.h,
),
Expanded(child: _buildMainUI()),
SubmitBtn(
btnName: '确定'.tr,
onClick: () {},
onClick: () {
Get.back(
result:
state.lockUserList.value[state.isSelectIndex.value]);
},
),
SizedBox(
height: 64.h,
@ -52,66 +63,40 @@ class _LockUserPageState extends State<LockUserPage> {
));
}
Widget _searchWidget() {
return Container(
height: 60.h,
margin: EdgeInsets.only(top: 20.w, left: 20.w, right: 10.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: TextField(
//
maxLines: 1,
// controller: _controller,
autofocus: false,
controller: state.searchController,
onSubmitted: (value) {},
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(
top: 12.0, left: -19.0, right: -15.0, bottom: 8.0),
hintText: TranslationLoader.lanKeys!.pleaseEnter!.tr,
hintStyle: TextStyle(fontSize: 22.sp, height: 3.0),
//线
border: InputBorder.none,
//
icon: Padding(
padding: EdgeInsets.only(
top: 20.h, bottom: 20.h, right: 20.w, left: 10.w),
child: Image.asset(
'images/main/icon_main_search.png',
width: 40.w,
height: 40.w,
),
),
),
),
);
Widget _buildMainUI() {
return Obx(() => ListView.separated(
shrinkWrap: true,
itemCount: state.lockUserList.value.length,
itemBuilder: (c, index) {
return _electronicKeyItem(state.lockUserList.value[index], index);
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
));
}
Widget _buildMainUI() {
return ListView.separated(
shrinkWrap: true,
itemCount: 3,
itemBuilder: (c, index) {
return _electronicKeyItem('images/controls_user.png', '', '永久', () {
state.isCheck.value = !state.isCheck.value;
Widget _electronicKeyItem(LockUserListKeys lockUserKeys, int selectIndex) {
return GestureDetector(
onTap: () {
for (int i = 0; i < state.lockUserList.value.length; i++) {
LockUserListKeys item = state.lockUserList.value[i];
if (selectIndex == i) {
item.isCurrentSelect = true;
} else {
item.isCurrentSelect = true;
}
}
setState(() {
state.isSelectIndex.value = selectIndex;
});
},
separatorBuilder: (BuildContext context, int index) {
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
},
);
}
Widget _electronicKeyItem(
String avatarURL, String receiveUser, String useDate, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
color: Colors.white,
width: 1.sw,
height: 90.h,
child: Row(
children: [
@ -119,7 +104,7 @@ class _LockUserPageState extends State<LockUserPage> {
width: 30.w,
),
Image.asset(
avatarURL,
lockUserKeys.currentTypeImg ?? 'images/controls_user.png',
width: 60.w,
height: 60.w,
),
@ -134,7 +119,7 @@ class _LockUserPageState extends State<LockUserPage> {
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
receiveUser,
lockUserKeys.currentKeyName ?? '未知',
style: TextStyle(
fontSize: 24.sp, color: AppColors.blackColor),
),
@ -150,7 +135,7 @@ class _LockUserPageState extends State<LockUserPage> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
useDate,
logic.getKeyUseDateStr(lockUserKeys),
style: TextStyle(
fontSize: 18.sp,
color: AppColors.placeholderTextColor),
@ -161,13 +146,13 @@ class _LockUserPageState extends State<LockUserPage> {
],
),
),
Obx(() => Image.asset(
state.isCheck.value == true
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
)),
Image.asset(
state.isSelectIndex.value == selectIndex
? 'images/icon_round_select.png'
: 'images/icon_round_unSelect.png',
width: 30.w,
height: 30.w,
),
SizedBox(width: 20.h),
],
),

View File

@ -1,10 +1,14 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
class LockUserState {
TextEditingController searchController = TextEditingController(); ///
var isCheck = false.obs;
var isSelectUser = false.obs;
var isSelectIndex = 0.obs;
var getLockId = 0.obs;
var lockUserList = <LockUserListKeys>[].obs; //
LockUserState() {
Map map = Get.arguments;

View File

@ -26,7 +26,7 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '低电量提醒',
barTitle: '低电量提醒'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Container(
@ -48,7 +48,7 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
height: 20.h,
),
CommonItem(
leftTitel: '低电量提醒',
leftTitel: '低电量提醒'.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: false,
@ -68,7 +68,7 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
child: Column(
children: [
CommonItem(
leftTitel: '提醒方式',
leftTitel: '提醒方式'.tr,
rightTitle: "",
isHaveLine: false,
isHaveRightWidget: false,
@ -104,7 +104,7 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
height: 20.h,
)),
SubmitBtn(
btnName: '保存',
btnName: '保存'.tr,
onClick: () {},
),
SizedBox(

View File

@ -46,7 +46,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '消息提醒',
barTitle: '消息提醒'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: SingleChildScrollView(
@ -72,7 +72,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
// height: 1,
// ),
CommonItem(
leftTitel: '开门通知',
leftTitel: '开门通知'.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
@ -84,7 +84,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
},
),
Obx(() => CommonItem(
leftTitel: 'N天未开门',
leftTitel: 'N天未开门'.tr,
rightTitle: state.nDaysNotOpenDoor.value,
isHaveLine: true,
isHaveDirection: true,
@ -103,14 +103,14 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
// rightWidget:
// SizedBox(width: 60.w, height: 50.h, child: _switch(1)))),
Obx(() => CommonItem(
leftTitel: '门未关好',
leftTitel: '门未关好'.tr,
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,
rightWidget:
SizedBox(width: 60.w, height: 50.h, child: _switch(2)))),
Obx(() => CommonItem(
leftTitel: '防拆报警',
leftTitel: '防拆报警'.tr,
rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true,
@ -120,7 +120,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
child: _switch(5),
))),
Obx(() => CommonItem(
leftTitel: '低电量提醒',
leftTitel: '低电量提醒'.tr,
rightTitle: state.isLowBattery.value,
isHaveLine: true,
isHaveDirection: true,
@ -129,7 +129,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
},
)),
CommonItem(
leftTitel: '胁迫开门',
leftTitel: '胁迫开门'.tr,
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
@ -149,7 +149,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
height: 10.h,
),
Obx(() => CommonItem(
leftTitel: '有人按门铃',
leftTitel: '有人按门铃'.tr,
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,
@ -167,7 +167,7 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
height: 10.h,
),
Obx(() => CommonItem(
leftTitel: '有人出现在门口',
leftTitel: '有人出现在门口'.tr,
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,

View File

@ -29,7 +29,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: '家人到家',
barTitle: '家人到家'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
@ -41,7 +41,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
),
Expanded(child: _buildMainUI()),
AddBottomWhiteBtn(
btnName: '添加家人',
btnName: '添加家人'.tr,
onClick: () {
Get.toNamed(Routers.addFamilyPage,
arguments: {'getLockId': state.getLockId.value});
@ -59,7 +59,7 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
child: Text(
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择',
'若锁没有联网,除电子钥匙外,密码、卡、指纹等开门提醒无法及时发送,请根据你的实际情况选择'.tr,
style: TextStyle(color: AppColors.darkGrayTextColor, fontSize: 20.sp),
));
}

View File

@ -58,7 +58,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
gaplessPlayback: true,
width: 1.sw,
height: 1.sh,
fit: BoxFit.none,
fit: BoxFit.cover, //contain- none-
filterQuality: FilterQuality.high,
errorBuilder: (context, error, stackTrace) {
return Container(color: Colors.transparent);

View File

@ -42,7 +42,6 @@ class UDPManage {
int remoteUnlock = 0; // 1 0
void initUdp() async {
// if (host != '') {
var listAddress = InternetAddress.lookup(host);
listAddress.then((list) {
list.forEach((element) {
@ -50,17 +49,16 @@ class UDPManage {
host = element.address;
});
});
// }
await _initUdp();
}
Future<Null> _initUdp() async {
Future<void> _initUdp() async {
if (port == 0) {
print('❌ Udp ----> _port == 0');
// print('❌ Udp ----> _port == 0');
return;
}
print('Udp ----> host:$host port:$port');
// print('Udp ----> host:$host port:$port');
var addressIListenFrom = InternetAddress.anyIPv4;
int portIListenOn = 62288;
RawDatagramSocket.bind(addressIListenFrom, portIListenOn)
@ -91,7 +89,7 @@ class UDPManage {
void sendData(List<int> data) {
if (null == _udpSocket || null == data || data.isEmpty || host == '') {
if (null == _udpSocket) {
print('❌ Udp ----> null == _udpSocket');
// print('❌ Udp ----> null == _udpSocket');
initUdp();
}
return;