Merge branch 'master' of gitee.com:starlock-cn/app-starlock
This commit is contained in:
commit
65403b64c5
@ -107,7 +107,7 @@ android {
|
|||||||
dimension "flavor-type"
|
dimension "flavor-type"
|
||||||
applicationId "com.xhjcn.lock"
|
applicationId "com.xhjcn.lock"
|
||||||
signingConfig signingConfigs.xhj
|
signingConfig signingConfigs.xhj
|
||||||
resValue "string", "app_name", "星星锁"
|
resValue "string", "app_name", "鑫锁"
|
||||||
manifestPlaceholders.JPUSH_PKGNAME = "com.xhjcn.lock"
|
manifestPlaceholders.JPUSH_PKGNAME = "com.xhjcn.lock"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ flavors:
|
|||||||
bundleId: "com.skychip.lock"
|
bundleId: "com.skychip.lock"
|
||||||
xhj:
|
xhj:
|
||||||
app:
|
app:
|
||||||
name: "星星锁"
|
name: "鑫锁"
|
||||||
icon: "assets/icon/xhj.png"
|
icon: "assets/icon/xhj.png"
|
||||||
android:
|
android:
|
||||||
applicationId: "com.xhjcn.lock"
|
applicationId: "com.xhjcn.lock"
|
||||||
|
|||||||
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
FLUTTER_TARGET=lib/main_xhj_full.dart
|
FLUTTER_TARGET=lib/main_xhj_full.dart
|
||||||
ASSET_PREFIX=xhj
|
ASSET_PREFIX=xhj
|
||||||
BUNDLE_NAME=星星锁
|
BUNDLE_NAME=鑫锁
|
||||||
BUNDLE_DISPLAY_NAME=星星锁
|
BUNDLE_DISPLAY_NAME=鑫锁
|
||||||
|
|||||||
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
FLUTTER_TARGET=lib/main_xhj_full.dart
|
FLUTTER_TARGET=lib/main_xhj_full.dart
|
||||||
ASSET_PREFIX=xhj
|
ASSET_PREFIX=xhj
|
||||||
BUNDLE_NAME=星星锁
|
BUNDLE_NAME=鑫锁
|
||||||
BUNDLE_DISPLAY_NAME=星星锁
|
BUNDLE_DISPLAY_NAME=鑫锁
|
||||||
|
|||||||
@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
FLUTTER_TARGET=lib/main_xhj_lite.dart
|
FLUTTER_TARGET=lib/main_xhj_lite.dart
|
||||||
ASSET_PREFIX=xhj
|
ASSET_PREFIX=xhj
|
||||||
BUNDLE_NAME=星星锁
|
BUNDLE_NAME=鑫锁
|
||||||
BUNDLE_DISPLAY_NAME=星星锁
|
BUNDLE_DISPLAY_NAME=鑫锁
|
||||||
|
|||||||
@ -76,7 +76,7 @@ import 'main/lockDetail/checkingIn/checkingInStaff/checkingInStaffDetail/checkin
|
|||||||
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart';
|
import 'main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyPeriodValidity/electronicKeyPeriodValidity_page.dart';
|
||||||
import 'main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicManageKey/massSendElectronicKeyManage_page.dart';
|
import 'main/lockDetail/electronicKey/massSendElectronicKey/massSendElectronicKey/massSendElectronicManageKey/massSendElectronicKeyManage_page.dart';
|
||||||
import 'main/lockDetail/face/addFace/addFace_page.dart';
|
import 'main/lockDetail/face/addFace/addFace_page.dart';
|
||||||
import 'main/lockDetail/face/addFaceType/addFaceTypeManage/addFaceTypeManage_page.dart';
|
import 'main/lockDetail/face/addFaceType/addFaceType_page.dart';
|
||||||
import 'main/lockDetail/face/faceList/faceList_page.dart';
|
import 'main/lockDetail/face/faceList/faceList_page.dart';
|
||||||
import 'main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart';
|
import 'main/lockDetail/fingerprint/addFingerprint/addFingerprint_page.dart';
|
||||||
import 'main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart';
|
import 'main/lockDetail/fingerprint/addFingerprintSelectType/addFingerprintType_page.dart';
|
||||||
@ -115,9 +115,9 @@ import 'main/lockDetail/lockSet/wirelessKeyboard/selectWirelessKeyboard/selectWi
|
|||||||
import 'main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart';
|
import 'main/lockDetail/lockSet/wirelessKeyboard/wirelessKeyboardList/wirelessKeyboard_page.dart';
|
||||||
import 'main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
import 'main/lockDetail/monitoring/monitoring/lockMonitoring_page.dart';
|
||||||
import 'main/lockDetail/monitoring/monitoringRealTimeScreen/monitoringRealTimeScreen_page.dart';
|
import 'main/lockDetail/monitoring/monitoringRealTimeScreen/monitoringRealTimeScreen_page.dart';
|
||||||
import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKeyManage/passwordKeyManage_page.dart';
|
import 'main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart';
|
||||||
import 'main/lockDetail/realTimePicture/realTimePicture_page.dart';
|
import 'main/lockDetail/realTimePicture/realTimePicture_page.dart';
|
||||||
import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControlManage/addRemoteControlManage_page.dart';
|
import 'main/lockDetail/remoteControl/addRemoteControl/addRemoteControl_page.dart';
|
||||||
import 'main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart';
|
import 'main/lockDetail/remoteControl/remoteControlList/remoteControlList_page.dart';
|
||||||
import 'main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart';
|
import 'main/lockDetail/videoLog/editVideoLog/editVideoLog_page.dart';
|
||||||
import 'main/lockDetail/videoLog/videoLog/videoLog_page.dart';
|
import 'main/lockDetail/videoLog/videoLog/videoLog_page.dart';
|
||||||
@ -214,7 +214,7 @@ abstract class Routers {
|
|||||||
'/ElectronicKeyPeriodValidityPage'; // 电子钥匙有效期
|
'/ElectronicKeyPeriodValidityPage'; // 电子钥匙有效期
|
||||||
static const sendEmailNotificationPage = '/SendEmailNotificationPage'; // 邮件通知
|
static const sendEmailNotificationPage = '/SendEmailNotificationPage'; // 邮件通知
|
||||||
static const passwordKeyListPage = '/PasswordKeyListPage'; // 密码钥匙列表
|
static const passwordKeyListPage = '/PasswordKeyListPage'; // 密码钥匙列表
|
||||||
static const passwordKeyManagePage = '/PasswordKeyManagePage'; // 密码钥匙
|
static const passwordKeyPerpetualPage = '/PasswordKeyPerpetualPage'; // 密码钥匙
|
||||||
static const passwordKeyDetailPage = '/PasswordKeyDetailPage'; // 密码钥匙详情
|
static const passwordKeyDetailPage = '/PasswordKeyDetailPage'; // 密码钥匙详情
|
||||||
// static const otherTypeKeyListPage = '/OtherTypeKeyListPage'; // 卡、指纹、遥控钥匙列表
|
// static const otherTypeKeyListPage = '/OtherTypeKeyListPage'; // 卡、指纹、遥控钥匙列表
|
||||||
// static const otherTypeKeyDetailPage = '/OtherTypeKeyDetailPage'; // 卡、指纹、遥控钥匙详情
|
// static const otherTypeKeyDetailPage = '/OtherTypeKeyDetailPage'; // 卡、指纹、遥控钥匙详情
|
||||||
@ -412,8 +412,7 @@ abstract class Routers {
|
|||||||
static const videoLogDownLoadPage = '/VideoLogDownLoadPage'; // 视频下载列表
|
static const videoLogDownLoadPage = '/VideoLogDownLoadPage'; // 视频下载列表
|
||||||
|
|
||||||
static const remoteControlListPage = '/RemoteControlListPage'; // 遥控列表
|
static const remoteControlListPage = '/RemoteControlListPage'; // 遥控列表
|
||||||
static const addRemoteControlManagePage =
|
static const addRemoteControlPage = '/AddRemoteControlPage'; // 添加遥控
|
||||||
'/AddRemoteControlManagePage'; // 添加遥控
|
|
||||||
|
|
||||||
static const cardListPage = '/CardListPage'; // 卡列表
|
static const cardListPage = '/CardListPage'; // 卡列表
|
||||||
// static const addCardTypeManagePage = '/AddCardTypeManagePage'; // 添加卡
|
// static const addCardTypeManagePage = '/AddCardTypeManagePage'; // 添加卡
|
||||||
@ -423,7 +422,7 @@ abstract class Routers {
|
|||||||
static const addFingerprintTypePage = '/AddFingerprintTypePage'; // 添加指纹
|
static const addFingerprintTypePage = '/AddFingerprintTypePage'; // 添加指纹
|
||||||
static const fingerprintDetailPage = '/FingerprintDetailPage'; // 指纹详情
|
static const fingerprintDetailPage = '/FingerprintDetailPage'; // 指纹详情
|
||||||
static const faceListPage = '/FaceListPage'; // 人脸列表
|
static const faceListPage = '/FaceListPage'; // 人脸列表
|
||||||
static const addFaceTypeManagePage = '/AddFaceTypeManagePage'; // 添加人脸
|
static const addFaceTypePage = '/AddFaceTypePage'; // 添加人脸
|
||||||
static const faceDetailPage = '/faceDetailPage'; // 人脸详情
|
static const faceDetailPage = '/faceDetailPage'; // 人脸详情
|
||||||
|
|
||||||
static const irisListPage = '/IrisListPage'; // 虹膜列表
|
static const irisListPage = '/IrisListPage'; // 虹膜列表
|
||||||
@ -520,8 +519,8 @@ abstract class AppRouters {
|
|||||||
page: () => const PasswordKeyListPage(),
|
page: () => const PasswordKeyListPage(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.passwordKeyManagePage,
|
name: Routers.passwordKeyPerpetualPage,
|
||||||
page: () => const PasswordKeyManagePage(),
|
page: () => const PasswordKeyPerpetualPage(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.passwordKeyDetailPage,
|
name: Routers.passwordKeyDetailPage,
|
||||||
@ -1006,8 +1005,8 @@ abstract class AppRouters {
|
|||||||
name: Routers.remoteControlListPage,
|
name: Routers.remoteControlListPage,
|
||||||
page: () => const RemoteControlListPage()),
|
page: () => const RemoteControlListPage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.addRemoteControlManagePage,
|
name: Routers.addRemoteControlPage,
|
||||||
page: () => const AddRemoteControlManagePage()),
|
page: () => const AddRemoteControlPage()),
|
||||||
GetPage(name: Routers.cardListPage, page: () => const CardListPage()),
|
GetPage(name: Routers.cardListPage, page: () => const CardListPage()),
|
||||||
// GetPage(
|
// GetPage(
|
||||||
// name: Routers.addCardTypeManagePage,
|
// name: Routers.addCardTypeManagePage,
|
||||||
@ -1027,8 +1026,8 @@ abstract class AppRouters {
|
|||||||
page: () => const FingerprintDetailPage()),
|
page: () => const FingerprintDetailPage()),
|
||||||
GetPage(name: Routers.faceListPage, page: () => const FaceListPage()),
|
GetPage(name: Routers.faceListPage, page: () => const FaceListPage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.addFaceTypeManagePage,
|
name: Routers.addFaceTypePage,
|
||||||
page: () => const AddFaceTypeManagePage()),
|
page: () => const AddFaceTypePage()),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: Routers.passwordKeyDetailChangeDatePage,
|
name: Routers.passwordKeyDetailChangeDatePage,
|
||||||
page: () => const PasswordKeyDetailChangeDatePage()),
|
page: () => const PasswordKeyDetailChangeDatePage()),
|
||||||
|
|||||||
@ -55,53 +55,78 @@ class OTAUpgradeCommand extends SenderProtocol {
|
|||||||
data.add(type1);
|
data.add(type1);
|
||||||
data.add(type2);
|
data.add(type2);
|
||||||
|
|
||||||
|
print('---> 指令 : $type1 $type2' );
|
||||||
|
|
||||||
// 锁id 40
|
// 锁id 40
|
||||||
int lockIDLength = utf8.encode(lockID!).length;
|
int lockIDLength = utf8.encode(lockID!).length;
|
||||||
data.addAll(utf8.encode(lockID!));
|
data.addAll(utf8.encode(lockID!));
|
||||||
data = getFixedLengthList(data, 40 - lockIDLength);
|
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||||
|
|
||||||
|
print('---> 锁id :' + utf8.encode(lockID!).toString());
|
||||||
|
|
||||||
//userID 20
|
//userID 20
|
||||||
int userIDLength = utf8.encode(userID!).length;
|
int userIDLength = utf8.encode(userID!).length;
|
||||||
data.addAll(utf8.encode(userID!));
|
data.addAll(utf8.encode(userID!));
|
||||||
data = getFixedLengthList(data, 20 - userIDLength);
|
data = getFixedLengthList(data, 20 - userIDLength);
|
||||||
|
|
||||||
|
print('---> userID :' + utf8.encode(userID!).toString());
|
||||||
|
|
||||||
//platform 2
|
//platform 2
|
||||||
int platform0 = (platform! & 0xFF00) >> 8;
|
int platform0 = (platform! & 0xFF00) >> 8;
|
||||||
int platform1 = platform! & 0xFF;
|
int platform1 = platform! & 0xFF;
|
||||||
data.add(platform0);
|
data.add(platform0);
|
||||||
data.add(platform1);
|
data.add(platform1);
|
||||||
|
|
||||||
|
print('---> platform : $platform0 $platform1');
|
||||||
|
|
||||||
//product 2
|
//product 2
|
||||||
int product0 = (product! & 0xFF00) >> 8;
|
// int product0 = (product! & 0xFF00) >> 8;
|
||||||
int product1 = product! & 0xFF;
|
// int product1 = product! & 0xFF;
|
||||||
data.add(product0);
|
// data.add(product0);
|
||||||
data.add(product1);
|
// data.add(product1);
|
||||||
|
data.addAll([0,1]);//先默认是 01
|
||||||
|
|
||||||
|
print('---> platform : ${[0,1]}');
|
||||||
|
|
||||||
//HwVersion 20
|
//HwVersion 20
|
||||||
int hwVersionLength = utf8.encode(hwVersion!).length;
|
int hwVersionLength = utf8.encode(hwVersion!).length;
|
||||||
data.addAll(utf8.encode(hwVersion!));
|
data.addAll(utf8.encode(hwVersion!));
|
||||||
data = getFixedLengthList(data, 20 - hwVersionLength);
|
data = getFixedLengthList(data, 20 - hwVersionLength);
|
||||||
|
|
||||||
|
print('---> hwVersion : ${utf8.encode(hwVersion!)}');
|
||||||
|
|
||||||
//FwVersion 20
|
//FwVersion 20
|
||||||
int fwVersionLength = utf8.encode(fwVersion!).length;
|
int fwVersionLength = utf8.encode(fwVersion!).length;
|
||||||
data.addAll(utf8.encode(fwVersion!));
|
data.addAll(utf8.encode(fwVersion!));
|
||||||
data = getFixedLengthList(data, 20 - fwVersionLength);
|
data = getFixedLengthList(data, 20 - fwVersionLength);
|
||||||
|
|
||||||
|
print('---> FwVersion : ${utf8.encode(fwVersion!)}');
|
||||||
|
|
||||||
//fwSize 4
|
//fwSize 4
|
||||||
ByteData bytes = ByteData(4); // 创建一个长度为4的字节数据
|
ByteData bytes = ByteData(4); // 创建一个长度为4的字节数据
|
||||||
bytes.setInt32(0, fwSize!);
|
bytes.setInt32(0, fwSize!);
|
||||||
List<int> byteList = bytes.buffer.asUint8List();
|
List<int> byteList = bytes.buffer.asUint8List();
|
||||||
data.addAll(byteList);
|
data.addAll(byteList);
|
||||||
|
|
||||||
//fwMD5 16
|
print('---> fwSize : ${byteList}');
|
||||||
int fwMD5Length = utf8.encode(fwMD5!).length;
|
|
||||||
data.addAll(utf8.encode(fwMD5!));
|
// 创建一个16字节的字节数组
|
||||||
data = getFixedLengthList(data, 16 - fwMD5Length);
|
Uint8List result = Uint8List(16);
|
||||||
|
// 将每个十六进制字符转换为4位二进制数据,并将其存储到结果字节数组中
|
||||||
|
for (int i = 0; i < fwMD5!.length; i += 2) {
|
||||||
|
String hex = fwMD5!.substring(i, i + 2);
|
||||||
|
int byteValue = int.parse(hex, radix: 16);
|
||||||
|
result[i ~/ 2] = byteValue;
|
||||||
|
}
|
||||||
|
data.addAll(result);
|
||||||
|
print('---> fwMD5 : ${result}');
|
||||||
|
|
||||||
// token 长度4 首次请求 Token 填 0,如果锁需要鉴权 操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 当token失效或者第一次发送的时候token为0
|
// token 长度4 首次请求 Token 填 0,如果锁需要鉴权 操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。 当token失效或者第一次发送的时候token为0
|
||||||
data.addAll(token!);
|
data.addAll(token!);
|
||||||
|
|
||||||
print('--->1'+data.toString());
|
print('---> token : ${token}');
|
||||||
|
|
||||||
|
print('--->1' + data.toString());
|
||||||
|
|
||||||
if (needAuthor == 0) {
|
if (needAuthor == 0) {
|
||||||
//AuthCodeLen 1
|
//AuthCodeLen 1
|
||||||
@ -120,6 +145,8 @@ class OTAUpgradeCommand extends SenderProtocol {
|
|||||||
|
|
||||||
authCodeData.addAll(signKey!);
|
authCodeData.addAll(signKey!);
|
||||||
|
|
||||||
|
print('---> ${utf8.encode(keyID!)} ${utf8.encode(userID!)} $token $signKey');
|
||||||
|
|
||||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||||
var authCode = crypto.md5.convert(authCodeData);
|
var authCode = crypto.md5.convert(authCodeData);
|
||||||
|
|
||||||
@ -149,7 +176,7 @@ class OTAUpgradeReply extends Reply {
|
|||||||
data = dataDetail;
|
data = dataDetail;
|
||||||
token = data.sublist(2, 6);
|
token = data.sublist(2, 6);
|
||||||
status = data[6];
|
status = data[6];
|
||||||
print('--->2'+data.toString());
|
print('--->2' + data.toString());
|
||||||
errorWithStstus(status);
|
errorWithStstus(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,8 +13,8 @@ enum CommandType {
|
|||||||
calibrationTime, // 校时 = 0x30f0
|
calibrationTime, // 校时 = 0x30f0
|
||||||
readStarLockStatusInfo, //读星锁状态信息 0x3040
|
readStarLockStatusInfo, //读星锁状态信息 0x3040
|
||||||
startOATUpgrade, //OTA升级开始 0x30E0
|
startOATUpgrade, //OTA升级开始 0x30E0
|
||||||
confirmationOTAUpgrade, //OTA升级开始 0x30E1
|
confirmationOTAUpgrade, //OTA升级开始 0x30E2
|
||||||
processOTAUpgrade, //OTA升级过程 0x30E2
|
processOTAUpgrade, //OTA升级过程 0x30E1
|
||||||
|
|
||||||
generalExtendedCommond, // 通用扩展指令 = 0x3030
|
generalExtendedCommond, // 通用扩展指令 = 0x3030
|
||||||
gecChangeAdministratorPassword, // 通用扩展指令子命令-修改管理员密码 = 2
|
gecChangeAdministratorPassword, // 通用扩展指令子命令-修改管理员密码 = 2
|
||||||
|
|||||||
@ -114,7 +114,7 @@ class CommandReciverManager {
|
|||||||
oriDataList = SM4.decrypt(getDataList,
|
oriDataList = SM4.decrypt(getDataList,
|
||||||
key: getPrivateKeyList, mode: SM4CryptoMode.ECB);
|
key: getPrivateKeyList, mode: SM4CryptoMode.ECB);
|
||||||
oriDataList = oriDataList.sublist(0, oriLen);
|
oriDataList = oriDataList.sublist(0, oriLen);
|
||||||
// print("SM4 oriDataList:$oriDataList");
|
print("SM4 oriDataList:$oriDataList");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
parseData(oriDataList).then((value) async {
|
parseData(oriDataList).then((value) async {
|
||||||
|
|||||||
@ -86,6 +86,7 @@ class IoSenderManage {
|
|||||||
List<int>? publicKey,
|
List<int>? publicKey,
|
||||||
List<int>? privateKey,
|
List<int>? privateKey,
|
||||||
List<int>? token,
|
List<int>? token,
|
||||||
|
bool? isBeforeAddUser,
|
||||||
CommandSendCallBack? callBack}) {
|
CommandSendCallBack? callBack}) {
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: AddUserCommand(
|
command: AddUserCommand(
|
||||||
@ -103,7 +104,7 @@ class IoSenderManage {
|
|||||||
publicKey: publicKey,
|
publicKey: publicKey,
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
token: token),
|
token: token),
|
||||||
isBeforeAddUser: true,
|
isBeforeAddUser: isBeforeAddUser!,
|
||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,6 +215,7 @@ class IoSenderManage {
|
|||||||
{String? lockID,
|
{String? lockID,
|
||||||
String? userID,
|
String? userID,
|
||||||
List<int>? privateKey,
|
List<int>? privateKey,
|
||||||
|
bool? isBeforeAddUser,
|
||||||
CommandSendCallBack? callBack}) {
|
CommandSendCallBack? callBack}) {
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: GetStarLockStatuInfoCommand(
|
command: GetStarLockStatuInfoCommand(
|
||||||
@ -221,6 +223,7 @@ class IoSenderManage {
|
|||||||
userID: userID,
|
userID: userID,
|
||||||
privateKey: privateKey,
|
privateKey: privateKey,
|
||||||
),
|
),
|
||||||
|
isBeforeAddUser: isBeforeAddUser!,
|
||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ class F {
|
|||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
return '锁通通';
|
return '锁通通';
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
return '星星锁';
|
return '鑫锁';
|
||||||
default:
|
default:
|
||||||
throw Exception('flavor[$name] title not found');
|
throw Exception('flavor[$name] title not found');
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ class F {
|
|||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
return '锁通通';
|
return '锁通通';
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
return '星星锁';
|
return '鑫锁';
|
||||||
default:
|
default:
|
||||||
throw Exception('flavor[$name] title not found');
|
throw Exception('flavor[$name] title not found');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../../../translations/trans_lib.dart';
|
|
||||||
import 'addCardTypeManage_tabbar.dart';
|
|
||||||
|
|
||||||
class AddCardTypeManagePage extends StatefulWidget {
|
|
||||||
const AddCardTypeManagePage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<AddCardTypeManagePage> createState() => _AddCardTypeManagePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddCardTypeManagePageState extends State<AddCardTypeManagePage> {
|
|
||||||
var index = 0;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
Map map = Get.arguments;
|
|
||||||
var lockId = map["lockId"];
|
|
||||||
var fromType = map["fromType"]??1; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
var fromTypeTwoStaffName = "";
|
|
||||||
if(fromType == 2){
|
|
||||||
fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle:
|
|
||||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.card!.tr}",
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
AddCardManageTabbar(initialIndex: index, lockId: lockId, fromType: fromType, fromTypeTwoStaffName:fromTypeTwoStaffName),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,123 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
|
||||||
import '../../../../../translations/trans_lib.dart';
|
|
||||||
import '../addCardType_page.dart';
|
|
||||||
|
|
||||||
class AddCardManageTabbar extends StatefulWidget {
|
|
||||||
var initialIndex = 1;
|
|
||||||
var lockId = 0;
|
|
||||||
var fromType = 0; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
var fromTypeTwoStaffName = ""; // 从添加员工进入 传入员工名字
|
|
||||||
|
|
||||||
AddCardManageTabbar(
|
|
||||||
{Key? key,
|
|
||||||
required this.initialIndex,
|
|
||||||
required this.lockId,
|
|
||||||
required this.fromType,
|
|
||||||
required this.fromTypeTwoStaffName})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<AddCardManageTabbar> createState() => _AddCardManageTabbarState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddCardManageTabbarState extends State<AddCardManageTabbar>
|
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
late TabController _tabController;
|
|
||||||
|
|
||||||
final List<ItemView> _itemTabs = <ItemView>[
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
|
||||||
];
|
|
||||||
|
|
||||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
_tabController = TabController(
|
|
||||||
vsync: this,
|
|
||||||
length: widget.fromType == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
|
|
||||||
initialIndex: widget.initialIndex);
|
|
||||||
_tabController.addListener(() {
|
|
||||||
print("_tabController.indexIsChanging:${_tabController.indexIsChanging} _tabController.index:${_tabController.index}");
|
|
||||||
if (_tabController.animation!.value == _tabController.index) {
|
|
||||||
FocusScope.of(context).requestFocus(FocusNode());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Expanded(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
_tabBar(),
|
|
||||||
_pageWidget(),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
TabBar _tabBar() {
|
|
||||||
return TabBar(
|
|
||||||
controller: _tabController,
|
|
||||||
onTap: (index) {
|
|
||||||
FocusScope.of(context).requestFocus(FocusNode());
|
|
||||||
},
|
|
||||||
tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
|
|
||||||
isScrollable: true,
|
|
||||||
indicatorColor: Colors.red,
|
|
||||||
unselectedLabelColor: Colors.black,
|
|
||||||
unselectedLabelStyle: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
),
|
|
||||||
automaticIndicatorColorAdjustment: true,
|
|
||||||
labelColor: AppColors.mainColor,
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
indicator: CustomUnderlineTabIndicator(
|
|
||||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
|
||||||
strokeCap: StrokeCap.round,
|
|
||||||
width: 30.w),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Tab _tab(ItemView item) {
|
|
||||||
return Tab(
|
|
||||||
child: SizedBox(
|
|
||||||
width: 1.sw / 5,
|
|
||||||
child: Text(item.title, textAlign: TextAlign.center)));
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _pageWidget() {
|
|
||||||
return Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
controller: _tabController,
|
|
||||||
children:
|
|
||||||
widget.fromType == 1
|
|
||||||
? _itemTabs.map((ItemView item) => AddCardPage()).toList()
|
|
||||||
: _fromCheckInTypeItemTabs.map((ItemView item) => AddCardPage()).toList(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ItemView {
|
|
||||||
const ItemView({required this.title, required this.selectType});
|
|
||||||
|
|
||||||
final String title;
|
|
||||||
final String selectType;
|
|
||||||
}
|
|
||||||
@ -81,7 +81,7 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
keyID:"1",
|
keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
cardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
cardNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||||
useCountLimit:0xff,
|
useCountLimit:0xff,
|
||||||
isForce:state.isCoerced.value == "1" ? 0 : 1, // 是否是胁迫
|
isForce:state.isCoerced.value == "1" ? 0 : 1, // 是否是胁迫
|
||||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||||
@ -229,7 +229,7 @@ class AddICCardLogic extends BaseGetXController{
|
|||||||
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddCardWithTimeCycleCoercionCommand(
|
||||||
keyID:"1",
|
keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
cardNo:state.isAdministrator.value == "2" ? 254 : 1,
|
cardNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||||
useCountLimit:0xff,
|
useCountLimit:0xff,
|
||||||
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
||||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||||
|
|||||||
@ -180,7 +180,7 @@ class _CheckingInAddStaffPageState extends State<CheckingInAddStaffPage> {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
|
Get.toNamed(Routers.addFaceTypePage, arguments: {
|
||||||
"lockId": state.getKeyInfosData.value.lockId,
|
"lockId": state.getKeyInfosData.value.lockId,
|
||||||
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
"fromType": 2, // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
"fromTypeTwoStaffName": state.staffNameController.text
|
"fromTypeTwoStaffName": state.staffNameController.text
|
||||||
|
|||||||
@ -83,7 +83,7 @@ class AddFaceLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderAddFaceCommand(
|
IoSenderManage.senderAddFaceCommand(
|
||||||
keyID:"1",
|
keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
faceNo:state.isAdministrator.value == "2" ? 254 : 1,
|
faceNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||||
useCountLimit:0xff,
|
useCountLimit:0xff,
|
||||||
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
||||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||||
@ -232,7 +232,7 @@ class AddFaceLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderAddFaceCommand(
|
IoSenderManage.senderAddFaceCommand(
|
||||||
keyID:"1",
|
keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
faceNo:state.isAdministrator.value == "2" ? 254 : 1,
|
faceNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||||
useCountLimit:0xff,
|
useCountLimit:0xff,
|
||||||
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
||||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||||
|
|||||||
@ -1,44 +0,0 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../../../translations/trans_lib.dart';
|
|
||||||
import 'addFaceTypeManage_tabbar.dart';
|
|
||||||
|
|
||||||
class AddFaceTypeManagePage extends StatefulWidget {
|
|
||||||
const AddFaceTypeManagePage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<AddFaceTypeManagePage> createState() => _AddFaceTypeManagePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddFaceTypeManagePageState extends State<AddFaceTypeManagePage> {
|
|
||||||
var index = 0;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
Map map = Get.arguments;
|
|
||||||
var lockId = map["lockId"];
|
|
||||||
var fromType = map["fromType"]; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
var fromTypeTwoStaffName = "";
|
|
||||||
if(fromType == 2){
|
|
||||||
fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
|
||||||
}
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle:
|
|
||||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.face!.tr}",
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
AddFaceTypeManageTabbar(lockId: lockId, fromType: fromType, fromTypeTwoStaffName: fromTypeTwoStaffName, initialIndex: index),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,114 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
|
||||||
import '../../../../../translations/trans_lib.dart';
|
|
||||||
import '../addFaceType_page.dart';
|
|
||||||
|
|
||||||
class AddFaceTypeManageTabbar extends StatefulWidget {
|
|
||||||
var initialIndex = 1;
|
|
||||||
var lockId = 0;
|
|
||||||
var fromType = 1; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
var fromTypeTwoStaffName = "";// 从添加员工进入 传入员工名字
|
|
||||||
AddFaceTypeManageTabbar({Key? key, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName, required this.initialIndex}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<AddFaceTypeManageTabbar> createState() => _AddFaceTypeManageTabbarState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddFaceTypeManageTabbarState extends State<AddFaceTypeManageTabbar> with SingleTickerProviderStateMixin {
|
|
||||||
late TabController _tabController;
|
|
||||||
|
|
||||||
final List<ItemView> _itemTabs = <ItemView>[
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
|
||||||
];
|
|
||||||
|
|
||||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
|
||||||
_tabController = TabController(
|
|
||||||
vsync: this,
|
|
||||||
length: _itemTabs.length,
|
|
||||||
initialIndex: widget.initialIndex);
|
|
||||||
|
|
||||||
_tabController.addListener(() {
|
|
||||||
// print("_tabController.animation!.value:${_tabController.animation!.value} _tabController.index:${_tabController.index}");
|
|
||||||
if (_tabController.animation!.value == _tabController.index) {
|
|
||||||
FocusScope.of(context).requestFocus(FocusNode());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Expanded(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
_tabBar(),
|
|
||||||
_pageWidget(),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
TabBar _tabBar() {
|
|
||||||
return TabBar(
|
|
||||||
controller: _tabController,
|
|
||||||
tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
|
|
||||||
isScrollable: true,
|
|
||||||
indicatorColor: Colors.red,
|
|
||||||
unselectedLabelColor: Colors.black,
|
|
||||||
unselectedLabelStyle: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
),
|
|
||||||
automaticIndicatorColorAdjustment: true,
|
|
||||||
labelColor: AppColors.mainColor,
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
indicator: CustomUnderlineTabIndicator(
|
|
||||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
|
||||||
strokeCap: StrokeCap.round,
|
|
||||||
width: 30.w),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Tab _tab(ItemView item) {
|
|
||||||
return Tab(
|
|
||||||
child: SizedBox(
|
|
||||||
width: 1.sw / 5,
|
|
||||||
child: Text(item.title, textAlign: TextAlign.center)));
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _pageWidget() {
|
|
||||||
return Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
controller: _tabController,
|
|
||||||
children:
|
|
||||||
widget.fromType == 1
|
|
||||||
? _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList()
|
|
||||||
:_itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
|
|
||||||
|
|
||||||
// _itemTabs.map((ItemView item) => AddFaceTypePage(selectType: item.selectType, lockId: widget.lockId, fromType: widget.fromType, fromTypeTwoStaffName:widget.fromTypeTwoStaffName)).toList(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ItemView {
|
|
||||||
const ItemView({required this.title, required this.selectType});
|
|
||||||
|
|
||||||
final String title;
|
|
||||||
final String selectType;
|
|
||||||
}
|
|
||||||
@ -16,16 +16,17 @@ class AddFaceTypeLogic extends BaseGetXController {
|
|||||||
var startTime = "";
|
var startTime = "";
|
||||||
var endTime = "";
|
var endTime = "";
|
||||||
if (state.selectType.value == "0") {
|
if (state.selectType.value == "0") {
|
||||||
|
print("永久卡永久卡永久卡");
|
||||||
faceType = 1;
|
faceType = 1;
|
||||||
startDate = "0";
|
startDate = "0";
|
||||||
endDate = "0";
|
endDate = "0";
|
||||||
startTime = "0";
|
startTime = "0";
|
||||||
endTime = "0";
|
endTime = "0";
|
||||||
} else if (state.selectType.value == "1") {
|
} else if (state.selectType.value == "1") {
|
||||||
|
print("限时卡限时卡限时卡");
|
||||||
faceType = 2;
|
faceType = 2;
|
||||||
startDate =
|
startDate = DateTool().dateToTimestamp(state.timeLimitBeginTime.value, 1).toString();
|
||||||
DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
endDate = DateTool().dateToTimestamp(state.timeLimitEndTime.value, 1).toString();
|
||||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
|
||||||
startTime = "0";
|
startTime = "0";
|
||||||
endTime = "0";
|
endTime = "0";
|
||||||
|
|
||||||
@ -48,16 +49,18 @@ class AddFaceTypeLogic extends BaseGetXController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (state.selectType.value == "2") {
|
} else if (state.selectType.value == "2") {
|
||||||
if (state.beginTime.value.isEmpty) {
|
print("循环卡循环卡循环卡");
|
||||||
|
if (state.cycleBeginTime.value.isEmpty) {
|
||||||
showToast("请选择有效期".tr);
|
showToast("请选择有效期".tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
startDate = DateTool().dateToTimestamp(state.beginTime.value, 1).toString();
|
startDate = DateTool().dateToTimestamp(state.cycleBeginTime.value, 1).toString();
|
||||||
endDate = DateTool().dateToTimestamp(state.endTime.value, 1).toString();
|
endDate = DateTool().dateToTimestamp(state.cycleEndTime.value, 1).toString();
|
||||||
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
startTime = DateTool().dateToTimestamp(state.effectiveDateTime.value, 0).toString();
|
||||||
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
endTime = DateTool().dateToTimestamp(state.failureDateTime.value, 0).toString();
|
||||||
faceType = 4;
|
faceType = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 人脸
|
// 人脸
|
||||||
Get.toNamed(Routers.addFacePage, arguments: {
|
Get.toNamed(Routers.addFacePage, arguments: {
|
||||||
"lockId": state.lockId.value,
|
"lockId": state.lockId.value,
|
||||||
|
|||||||
@ -9,106 +9,111 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
|||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
import 'addFaceType_logic.dart';
|
import 'addFaceType_logic.dart';
|
||||||
|
|
||||||
class AddFaceTypePage extends StatefulWidget {
|
class AddFaceTypePage extends StatefulWidget {
|
||||||
final String selectType; // 永久限时循环下标
|
const AddFaceTypePage({Key? key}) : super(key: key);
|
||||||
final int lockId;
|
|
||||||
final int fromType; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
final String fromTypeTwoStaffName; // 从添加员工进入 传入员工名字
|
|
||||||
|
|
||||||
const AddFaceTypePage(
|
|
||||||
{Key? key,
|
|
||||||
required this.selectType,
|
|
||||||
required this.lockId,
|
|
||||||
required this.fromType,
|
|
||||||
required this.fromTypeTwoStaffName})
|
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddFaceTypePage> createState() => _AddFaceTypePageState();
|
State<AddFaceTypePage> createState() => _AddFaceTypePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProviderStateMixin {
|
||||||
final logic = Get.put(AddFaceTypeLogic());
|
final logic = Get.put(AddFaceTypeLogic());
|
||||||
final state = Get.find<AddFaceTypeLogic>().state;
|
final state = Get.find<AddFaceTypeLogic>().state;
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
state.selectType.value = widget.selectType;
|
|
||||||
state.lockId.value = widget.lockId;
|
|
||||||
if (widget.fromTypeTwoStaffName.isNotEmpty) {
|
|
||||||
state.nameController.text = widget.fromTypeTwoStaffName;
|
|
||||||
}
|
|
||||||
state.fromType.value = widget.fromType;
|
|
||||||
|
|
||||||
return indexChangeWidget();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
state.tabController = TabController(
|
||||||
if (state.selectType.value == "1") {
|
vsync: this,
|
||||||
state.beginTime.value = DateTool().dateToYMDHNString(
|
length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
|
||||||
DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
initialIndex: 0);
|
||||||
state.endTime.value = DateTool().dateToYMDHNString(
|
state.tabController.addListener(() {
|
||||||
DateTime.now().millisecondsSinceEpoch.toString()); //默认为当前时间
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
} else {
|
state.selectType.value = state.tabController.index.toString();
|
||||||
state.beginTime.value = ""; //默认为当前时间
|
});
|
||||||
state.endTime.value = ""; //默认为当前时间
|
|
||||||
|
if (state.tabController.animation!.value == state.tabController.index) {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle:
|
||||||
|
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.face!.tr}",
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
_tabBar(),
|
||||||
|
_pageWidget(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
switch (int.parse(widget.selectType)) {
|
switch (int.parse(state.selectType.value)) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// 永久
|
// 永久
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: [
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
keyBottomWidget()
|
state.nameController),
|
||||||
],
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// 限时
|
// 限时
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: [
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
keyTimeLimitWidget(),
|
state.nameController),
|
||||||
keyBottomWidget()
|
keyTimeLimitWidget(),
|
||||||
],
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
// 循环
|
// 循环
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: [
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
keyCyclicDate(),
|
state.nameController),
|
||||||
SizedBox(height: 10.h),
|
keyCyclicDate(),
|
||||||
keyBottomWidget()
|
SizedBox(height: 10.h),
|
||||||
],
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -138,24 +143,24 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: state.beginTime.value,
|
rightTitle: state.timeLimitBeginTime.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: state.endTime.value,
|
rightTitle: state.timeLimitEndTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
@ -168,47 +173,44 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
rightTitle: "${state.beginTime.value}\n${state.endTime.value}",
|
rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||||
'validityValue': state.weekdaysList.value,
|
'validityValue': state.weekdaysList.value,
|
||||||
'starDate': state.beginTime.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'endDate': state.endTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
'starTime': state.effectiveDateTime.value,
|
'starTime': state.effectiveDateTime.value,
|
||||||
'endTime': state.failureDateTime.value
|
'endTime': state.failureDateTime.value
|
||||||
});
|
});
|
||||||
if (result != null && result.isNotEmpty) {
|
if (result != null && result.isNotEmpty) {
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
state.endTime.value = result['endDate'];
|
state.cycleEndTime.value = result['endDate'];
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
state.failureDateTime.value = result['endTime'];
|
state.failureDateTime.value = result['endTime'];
|
||||||
Get.log(
|
|
||||||
'得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
|
||||||
}
|
}
|
||||||
})),
|
})),
|
||||||
Obx(() => Visibility(
|
Obx(() => Visibility(
|
||||||
visible: state.weekdaysList.isNotEmpty ? true : false,
|
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: "有效日",
|
leftTitel: "有效日".tr,
|
||||||
rightTitle: state.weekdaysList.value.join(",").toString(),
|
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||||
arguments: {
|
'validityValue': state.weekdaysList.value,
|
||||||
'validityValue': state.weekdaysList.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'starDate': state.beginTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
'endDate': state.endTime.value,
|
'starTime': state.effectiveDateTime.value,
|
||||||
'starTime': state.effectiveDateTime.value,
|
'endTime': state.failureDateTime.value
|
||||||
'endTime': state.failureDateTime.value
|
});
|
||||||
});
|
|
||||||
if (result != null && result.isNotEmpty) {
|
if (result != null && result.isNotEmpty) {
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
state.endTime.value = result['endDate'];
|
state.cycleEndTime.value = result['endDate'];
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
state.failureDateTime.value = result['endTime'];
|
state.failureDateTime.value = result['endTime'];
|
||||||
}
|
}
|
||||||
@ -217,25 +219,22 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
|||||||
visible: state.effectiveDateTime.value.isNotEmpty,
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
child: CommonItem(
|
child: CommonItem(
|
||||||
leftTitel: "有效时间".tr,
|
leftTitel: "有效时间".tr,
|
||||||
rightTitle:
|
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||||
"${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||||
arguments: {
|
'validityValue': state.weekdaysList.value,
|
||||||
'validityValue': state.weekdaysList.value,
|
'starDate': state.cycleBeginTime.value,
|
||||||
'starDate': state.beginTime.value,
|
'endDate': state.cycleEndTime.value,
|
||||||
'endDate': state.endTime.value,
|
'starTime': state.effectiveDateTime.value,
|
||||||
'starTime': state.effectiveDateTime.value,
|
'endTime': state.failureDateTime.value
|
||||||
'endTime': state.failureDateTime.value
|
});
|
||||||
});
|
|
||||||
if (result != null && result.isNotEmpty) {
|
if (result != null && result.isNotEmpty) {
|
||||||
state.weekdaysList.value = result['validityValue'];
|
state.weekdaysList.value = result['validityValue'];
|
||||||
state.beginTime.value = result['starDate'];
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
state.endTime.value = result['endDate'];
|
state.cycleEndTime.value = result['endDate'];
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
state.failureDateTime.value = result['endTime'];
|
state.failureDateTime.value = result['endTime'];
|
||||||
Get.back(result: result);
|
|
||||||
}
|
}
|
||||||
}))),
|
}))),
|
||||||
],
|
],
|
||||||
@ -338,4 +337,69 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<ItemView> _itemTabs = <ItemView>[
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
||||||
|
];
|
||||||
|
|
||||||
|
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||||
|
];
|
||||||
|
|
||||||
|
TabBar _tabBar() {
|
||||||
|
return TabBar(
|
||||||
|
controller: state.tabController,
|
||||||
|
onTap: (index) {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
},
|
||||||
|
tabs: state.fromType.value == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||||
|
isScrollable: true,
|
||||||
|
indicatorColor: Colors.red,
|
||||||
|
unselectedLabelColor: Colors.black,
|
||||||
|
unselectedLabelStyle: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
),
|
||||||
|
automaticIndicatorColorAdjustment: true,
|
||||||
|
labelColor: AppColors.mainColor,
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
indicator: CustomUnderlineTabIndicator(
|
||||||
|
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||||
|
strokeCap: StrokeCap.round,
|
||||||
|
width: 30.w),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Tab _tab(ItemView item) {
|
||||||
|
return Tab(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 1.sw / 5,
|
||||||
|
child: Text(item.title, textAlign: TextAlign.center)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _pageWidget() {
|
||||||
|
return Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
controller: state.tabController,
|
||||||
|
children:
|
||||||
|
state.fromType.value == 1
|
||||||
|
? _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
|
||||||
|
: _fromCheckInTypeItemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class ItemView {
|
||||||
|
const ItemView({required this.title, required this.selectType});
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
final String selectType;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,30 +1,33 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../tools/dateTool.dart';
|
||||||
|
|
||||||
class AddFaceTypeState {
|
class AddFaceTypeState {
|
||||||
final lockId = 0.obs;
|
final lockId = 0.obs;
|
||||||
final selectType = "0".obs; // 0永久 1显示 2循环
|
final selectType = "0".obs; // 0永久 1显示 2循环
|
||||||
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
var fromTypeTwoStaffName = "".obs; // 考勤添加人脸员工名字
|
|
||||||
final isStressFingerprint = false.obs;
|
final isStressFingerprint = false.obs;
|
||||||
final isAdministrator = false.obs; // 是否是管理员
|
final isAdministrator = false.obs; // 是否是管理员
|
||||||
|
|
||||||
var beginTime = "".obs; // 开始时间
|
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||||
var endTime = "".obs; // 结束时间
|
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||||
var effectiveDateTime = "".obs; // 生效时间
|
var cycleBeginTime = "".obs;// 循环开始时间
|
||||||
var failureDateTime = "".obs; // 失效时间
|
var cycleEndTime = "".obs;// 循环结束时间
|
||||||
|
var effectiveDateTime = "".obs;// 生效时间
|
||||||
|
var failureDateTime = "".obs;// 失效时间
|
||||||
var weekdaysList = [].obs;
|
var weekdaysList = [].obs;
|
||||||
|
var fromTypeTwoStaffName = "".obs; // 从添加员工进入 传入员工名字
|
||||||
|
|
||||||
final TextEditingController nameController = TextEditingController();
|
final TextEditingController nameController = TextEditingController();
|
||||||
|
late TabController tabController;
|
||||||
AddFaceTypeState() {
|
AddFaceTypeState() {
|
||||||
// Map map = Get.arguments;
|
Map map = Get.arguments;
|
||||||
// lockId.value = map["lockId"];
|
lockId.value = map["lockId"];
|
||||||
// fromType.value = map["fromType"];
|
fromType.value = map["fromType"];
|
||||||
// if(fromType.value == 2){
|
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
// fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
if(fromType.value == 2){
|
||||||
// // nameController.text = fromTypeTwoStaffName.value;
|
fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||||
// }
|
}
|
||||||
|
|
||||||
// print("lockId:${lockId.value} fromType:${fromType.value}");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,7 +79,7 @@ class _FaceListPageState extends State<FaceListPage> {
|
|||||||
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}',
|
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.face!.tr}',
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
var data =
|
var data =
|
||||||
await Get.toNamed(Routers.addFaceTypeManagePage, arguments: {
|
await Get.toNamed(Routers.addFaceTypePage, arguments: {
|
||||||
"lockId": state.lockId.value,
|
"lockId": state.lockId.value,
|
||||||
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
});
|
});
|
||||||
|
|||||||
@ -93,7 +93,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
keyID:"1",
|
keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
|
fingerNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||||
useCountLimit:0xff,
|
useCountLimit:0xff,
|
||||||
isForce:state.isCoerced.value == "1" ? 1 : 0, // 是否是胁迫
|
isForce:state.isCoerced.value == "1" ? 1 : 0, // 是否是胁迫
|
||||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||||
@ -283,7 +283,7 @@ class AddFingerprintLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
IoSenderManage.senderAddFingerprintWithTimeCycleCoercionCommand(
|
||||||
keyID:"1",
|
keyID:"1",
|
||||||
userID:await Storage.getUid(),
|
userID:await Storage.getUid(),
|
||||||
fingerNo:state.isAdministrator.value == "2" ? 254 : 1,
|
fingerNo:state.isAdministrator.value == "2" ? 254 : 0,
|
||||||
useCountLimit:0xff,
|
useCountLimit:0xff,
|
||||||
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
isForce:state.isCoerced.value == "2" ? 1 : 0, // 是否是胁迫
|
||||||
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
isRound:state.selectType.value == "2" ? 1: 0, // 是否是循环
|
||||||
|
|||||||
@ -1,45 +0,0 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../../../translations/trans_lib.dart';
|
|
||||||
import 'addFingerprintTypeManage_tabbar.dart';
|
|
||||||
|
|
||||||
class AddFingerprintTypeManagePage extends StatefulWidget {
|
|
||||||
const AddFingerprintTypeManagePage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<AddFingerprintTypeManagePage> createState() => _AddFingerprintTypeManagePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddFingerprintTypeManagePageState extends State<AddFingerprintTypeManagePage> {
|
|
||||||
var index = 0;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
Map map = Get.arguments;
|
|
||||||
var lockId = map["lockId"];
|
|
||||||
var fromType = map["fromType"]; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
var fromTypeTwoStaffName = "";
|
|
||||||
if(fromType == 2){
|
|
||||||
fromTypeTwoStaffName = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
|
||||||
}
|
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle:
|
|
||||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}",
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
AddFingerprintTypeManageTabbar(initialIndex: index, lockId: lockId, fromType: fromType, fromTypeTwoStaffName:fromTypeTwoStaffName),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,117 +0,0 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
|
||||||
import '../../../../../translations/trans_lib.dart';
|
|
||||||
import '../addFingerprintType_page.dart';
|
|
||||||
|
|
||||||
class AddFingerprintTypeManageTabbar extends StatefulWidget {
|
|
||||||
var initialIndex = 1;
|
|
||||||
var lockId = 0;
|
|
||||||
var fromType = 0; // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
|
||||||
var fromTypeTwoStaffName = "";// 从添加员工进入 传入员工名字
|
|
||||||
|
|
||||||
AddFingerprintTypeManageTabbar(
|
|
||||||
{Key? key, required this.initialIndex, required this.lockId, required this.fromType, required this.fromTypeTwoStaffName}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<AddFingerprintTypeManageTabbar> createState() => _AddFingerprintTypeManageTabbarState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddFingerprintTypeManageTabbarState extends State<AddFingerprintTypeManageTabbar> with SingleTickerProviderStateMixin {
|
|
||||||
late TabController _tabController;
|
|
||||||
|
|
||||||
final List<ItemView> _itemTabs = <ItemView>[
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
|
||||||
];
|
|
||||||
|
|
||||||
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
|
||||||
|
|
||||||
_tabController = TabController(
|
|
||||||
vsync: this,
|
|
||||||
length: _itemTabs.length,
|
|
||||||
initialIndex: widget.initialIndex);
|
|
||||||
_tabController.addListener(() {
|
|
||||||
if (_tabController.animation!.value==_tabController.index){
|
|
||||||
FocusScope.of(context).requestFocus(FocusNode());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Expanded(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
_tabBar(),
|
|
||||||
_pageWidget(),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
TabBar _tabBar() {
|
|
||||||
return TabBar(
|
|
||||||
controller: _tabController,
|
|
||||||
onTap: (index){
|
|
||||||
FocusScope.of(context).requestFocus(FocusNode());
|
|
||||||
},
|
|
||||||
tabs: widget.fromType == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
|
|
||||||
isScrollable: true,
|
|
||||||
indicatorColor: Colors.red,
|
|
||||||
unselectedLabelColor: Colors.black,
|
|
||||||
unselectedLabelStyle: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
),
|
|
||||||
automaticIndicatorColorAdjustment: true,
|
|
||||||
labelColor: AppColors.mainColor,
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
indicator: CustomUnderlineTabIndicator(
|
|
||||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
|
||||||
strokeCap: StrokeCap.round,
|
|
||||||
width: 30.w),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Tab _tab(ItemView item) {
|
|
||||||
return Tab(child: SizedBox(
|
|
||||||
width: 1.sw / 5,
|
|
||||||
child: Text(item.title, textAlign: TextAlign.center)));
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _pageWidget() {
|
|
||||||
return Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
controller: _tabController,
|
|
||||||
children:
|
|
||||||
widget.fromType == 1
|
|
||||||
? _itemTabs.map((ItemView item) => const AddFingerprintTypePage()).toList()
|
|
||||||
:_itemTabs.map((ItemView item) => const AddFingerprintTypePage()).toList(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class ItemView {
|
|
||||||
const ItemView({required this.title, required this.selectType});
|
|
||||||
|
|
||||||
final String title;
|
|
||||||
final String selectType;
|
|
||||||
}
|
|
||||||
@ -72,44 +72,50 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
|
|||||||
{
|
{
|
||||||
// 永久
|
// 永久
|
||||||
// return sendElectronicKeySucceed();
|
// return sendElectronicKeySucceed();
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: [
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
keyBottomWidget()
|
state.nameController),
|
||||||
],
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// 限时
|
// 限时
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: [
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
keyTimeLimitWidget(),
|
state.nameController),
|
||||||
SizedBox(height: 10.h),
|
keyTimeLimitWidget(),
|
||||||
keyBottomWidget()
|
SizedBox(height: 10.h),
|
||||||
],
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
// 循环
|
// 循环
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: [
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
keyCyclicDate(),
|
state.nameController),
|
||||||
SizedBox(height: 10.h),
|
keyCyclicDate(),
|
||||||
keyBottomWidget()
|
SizedBox(height: 10.h),
|
||||||
],
|
keyBottomWidget()
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -14,6 +14,8 @@ import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
|||||||
import 'package:star_lock/blue/io_reply.dart';
|
import 'package:star_lock/blue/io_reply.dart';
|
||||||
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
||||||
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
|
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
|
||||||
|
import 'package:star_lock/blue/sender_manage.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSet_logic.dart';
|
||||||
import 'package:star_lock/permission/permission_dialog.dart';
|
import 'package:star_lock/permission/permission_dialog.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/commonDataManage.dart';
|
import 'package:star_lock/tools/commonDataManage.dart';
|
||||||
@ -64,7 +66,7 @@ class LockEscalationLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
String md5Str = md5.convert(otaBin!).toString();
|
String md5Str = md5.convert(otaBin!).toString();
|
||||||
headJson!['fwMd5'] = md5Str;
|
headJson!['fwMd5'] = md5Str;
|
||||||
blueOTAUpgrade(headJson!, [0,0,0,0]);
|
blueOTAUpgrade(headJson!, [0, 0, 0, 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//蓝牙操作 ota 升级
|
//蓝牙操作 ota 升级
|
||||||
@ -76,18 +78,11 @@ class LockEscalationLogic extends BaseGetXController {
|
|||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
String lockID = CommonDataManage.shareManager()
|
String uid = await Storage.getUid() ?? '';
|
||||||
?.currentLockSetInfoData
|
|
||||||
.lockId
|
|
||||||
?.toString() ??
|
|
||||||
'';
|
|
||||||
String keyID =
|
|
||||||
CommonDataManage.shareManager()?.currentKeyInfo.keyId?.toString() ??
|
|
||||||
'';
|
|
||||||
BlueManage().writeCharacteristicWithResponse(OTAUpgradeCommand(
|
BlueManage().writeCharacteristicWithResponse(OTAUpgradeCommand(
|
||||||
lockID: lockID,
|
lockID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: uid,
|
||||||
keyID: keyID,
|
keyID: BlueManage().connectDeviceName,
|
||||||
platform: int.tryParse(data['platform']) ?? 0,
|
platform: int.tryParse(data['platform']) ?? 0,
|
||||||
product: int.tryParse(data['product']) ?? 0,
|
product: int.tryParse(data['product']) ?? 0,
|
||||||
hwVersion: data['hwVersion'],
|
hwVersion: data['hwVersion'],
|
||||||
@ -96,7 +91,7 @@ class LockEscalationLogic extends BaseGetXController {
|
|||||||
fwMD5: data['fwMd5'],
|
fwMD5: data['fwMd5'],
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
token: token,
|
token: token,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList)
|
privateKey: getPrivateKeyList)
|
||||||
.packageData());
|
.packageData());
|
||||||
} else if (deviceConnectionState ==
|
} else if (deviceConnectionState ==
|
||||||
@ -119,10 +114,11 @@ class LockEscalationLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
if (otaCount <= otaIndex) {
|
if (otaCount <= otaIndex) {
|
||||||
int now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
int now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||||
String msg = '传输完成 时间:${now - startSecond}秒';
|
String msg =
|
||||||
|
'传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ';
|
||||||
closeOTADAta();
|
closeOTADAta();
|
||||||
print(msg);
|
print(msg);
|
||||||
showToast(msg);
|
// showToast(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int star = otaIndex * 240;
|
int star = otaIndex * 240;
|
||||||
@ -130,10 +126,11 @@ class LockEscalationLogic extends BaseGetXController {
|
|||||||
if (end > length) {
|
if (end > length) {
|
||||||
end = length;
|
end = length;
|
||||||
}
|
}
|
||||||
|
int size = end - star;
|
||||||
List<int> data = otaBin!.sublist(star, end);
|
List<int> data = otaBin!.sublist(star, end);
|
||||||
state.otaProgress.value = otaIndex / otaCount;
|
state.otaProgress.value = otaIndex / otaCount;
|
||||||
await BlueManage().writeCharacteristicWithResponse(
|
await BlueManage().writeCharacteristicWithResponse(
|
||||||
ProcessOtaUpgradeCommand(index: otaIndex, size: length, data: data)
|
ProcessOtaUpgradeCommand(index: otaIndex, size: size, data: data)
|
||||||
.packageData());
|
.packageData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +170,7 @@ class LockEscalationLogic extends BaseGetXController {
|
|||||||
Uint8List metaLenList = data.sublist(12, 16);
|
Uint8List metaLenList = data.sublist(12, 16);
|
||||||
int metaLen = ByteData.sublistView(metaLenList).getUint32(0);
|
int metaLen = ByteData.sublistView(metaLenList).getUint32(0);
|
||||||
if (metaLen < 2 || metaLen > 10240) {
|
if (metaLen < 2 || metaLen > 10240) {
|
||||||
showToast('元数据长度错误');
|
showToast('文件校验失败 0x01');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 读取和解析元数据
|
// 读取和解析元数据
|
||||||
@ -190,13 +187,14 @@ class LockEscalationLogic extends BaseGetXController {
|
|||||||
// 获取固件数据部分
|
// 获取固件数据部分
|
||||||
Uint8List bin = data.sublist(binOffset.toInt(), data.length);
|
Uint8List bin = data.sublist(binOffset.toInt(), data.length);
|
||||||
//md5 校验有问题,暂时不解析
|
//md5 校验有问题,暂时不解析
|
||||||
// String md5Str = md5.convert(bin).toString();
|
String md5Str = md5.convert(bin).toString().toUpperCase();
|
||||||
// if (md5Str != meta['fwMd5']) {
|
print('---> $md5Str ${meta['fwMd5']}');
|
||||||
// showToast('固件MD5校验失败');
|
if (md5Str != meta['fwMd5']) {
|
||||||
// return false;
|
showToast('文件校验失败 0x02');
|
||||||
// }
|
return null;
|
||||||
|
}
|
||||||
if (bin.length != meta['fwSize']) {
|
if (bin.length != meta['fwSize']) {
|
||||||
showToast('固件校验失败');
|
showToast('文件校验失败 0x03');
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return bin;
|
return bin;
|
||||||
@ -216,6 +214,7 @@ class LockEscalationLogic extends BaseGetXController {
|
|||||||
if (reply is OTAUpgradeReply) {
|
if (reply is OTAUpgradeReply) {
|
||||||
if (reply.status == 0x00) {
|
if (reply.status == 0x00) {
|
||||||
//验证通过,开始发送数据包
|
//验证通过,开始发送数据包
|
||||||
|
startOTAData();
|
||||||
processOtaUpgrade();
|
processOtaUpgrade();
|
||||||
} else if (reply.status == 0x06) {
|
} else if (reply.status == 0x06) {
|
||||||
blueOTAUpgrade(headJson!, reply.token);
|
blueOTAUpgrade(headJson!, reply.token);
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
|||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(context, Routers.passwordKeyManagePage,
|
Navigator.pushNamed(context, Routers.passwordKeyPerpetualPage,
|
||||||
arguments: {"keyInfo": state.keyInfo.value}).then((val) {
|
arguments: {"keyInfo": state.keyInfo.value}).then((val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
|
|||||||
@ -115,11 +115,7 @@ class _PasswordKeyManageTabbarPageState extends State<PasswordKeyManageTabbarPag
|
|||||||
return Expanded(
|
return Expanded(
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
children: _itemTabs.map((ItemView item) => PasswordKeyPerpetualPage(
|
children: _itemTabs.map((ItemView item) => PasswordKeyPerpetualPage()).toList(),
|
||||||
type: item.type,
|
|
||||||
getKeyInfo: widget.keyInfo,
|
|
||||||
))
|
|
||||||
.toList(),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,157 +16,178 @@ import 'package:star_lock/tools/storage.dart';
|
|||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../blue/blue_manage.dart';
|
import '../../../../blue/blue_manage.dart';
|
||||||
import '../../../../blue/io_modelVendor.dart';
|
import '../../../../blue/io_modelVendor.dart';
|
||||||
|
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||||
import '../../../../tools/NativeInteractionTool.dart';
|
import '../../../../tools/NativeInteractionTool.dart';
|
||||||
import '../../../../tools/appRouteObserver.dart';
|
import '../../../../tools/appRouteObserver.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
|
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
import '../../../lockMian/entity/lockListInfo_entity.dart';
|
||||||
|
|
||||||
class PasswordKeyPerpetualPage extends StatefulWidget {
|
class PasswordKeyPerpetualPage extends StatefulWidget {
|
||||||
final String type;
|
|
||||||
final LockListInfoItemEntity getKeyInfo;
|
|
||||||
|
|
||||||
const PasswordKeyPerpetualPage(
|
const PasswordKeyPerpetualPage(
|
||||||
{Key? key, required this.type, required this.getKeyInfo})
|
{Key? key}) : super(key: key);
|
||||||
: super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PasswordKeyPerpetualPage> createState() =>
|
State<PasswordKeyPerpetualPage> createState() =>
|
||||||
_PasswordKeyPerpetualPageState();
|
_PasswordKeyPerpetualPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> with RouteAware{
|
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> with RouteAware, SingleTickerProviderStateMixin{
|
||||||
final logic = Get.put(PasswordKeyPerpetualLogic());
|
final logic = Get.put(PasswordKeyPerpetualLogic());
|
||||||
final state = Get.find<PasswordKeyPerpetualLogic>().state;
|
final state = Get.find<PasswordKeyPerpetualLogic>().state;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
initData();
|
state.tabController = TabController(
|
||||||
// state.isSendSuccess.value = false;
|
vsync: this,
|
||||||
}
|
length: _itemTabs.length,
|
||||||
|
initialIndex: 0);
|
||||||
|
state.tabController.addListener(() {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
state.widgetType.value = state.tabController.index;
|
||||||
|
});
|
||||||
|
|
||||||
void initData() {
|
if (state.tabController.animation!.value == state.tabController.index) {
|
||||||
// if (!state.isInitialized.value) {
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
// state.isInitialized.value = true;
|
}
|
||||||
// state.keyInfo.value = widget.getKeyInfo;
|
});
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
state.keyInfo.value = widget.getKeyInfo;
|
return Scaffold(
|
||||||
state.widgetType.value = int.parse(widget.type);
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
print("state.widgetType.value:${state.widgetType.value}");
|
appBar: TitleAppBar(
|
||||||
|
barTitle: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
return SingleChildScrollView(
|
haveBack: true,
|
||||||
child: Obx(() => indexChangeWidget()),
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
_tabBar(),
|
||||||
|
_pageWidget(),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
if (state.isSendSuccess.value == true && state.sendSucceedType.value.toString() == widget.type) {
|
if (state.isSendSuccess.value == true && state.sendSucceedType.value == state.widgetType.value) {
|
||||||
return sendElectronicKeySucceed();
|
return sendElectronicKeySucceed();
|
||||||
} else {
|
} else {
|
||||||
switch (int.parse(widget.type)) {
|
switch (state.widgetType.value) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// 永久
|
// 永久
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: [
|
||||||
false,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
false,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
|
state.nameController),
|
||||||
],
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip1!.tr)
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
// 限时
|
// 限时
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
keyTimeLimitWidget(),
|
children: [
|
||||||
perpetualKeyWidget(
|
keyTimeLimitWidget(),
|
||||||
false,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
false,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
state.nameController),
|
||||||
],
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
// 单次
|
// 单次
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: [
|
||||||
false,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
false,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
|
state.nameController),
|
||||||
],
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip3!.tr)
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 3:
|
case 3:
|
||||||
{
|
{
|
||||||
// 自定义
|
// 自定义
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
keyIfPerpetualWidget(),
|
children: [
|
||||||
state.isPermanent.value == false
|
keyIfPerpetualWidget(),
|
||||||
? keyTimeLimitWidget()
|
state.isPermanent.value == false
|
||||||
: Container(),
|
? keyTimeLimitWidget()
|
||||||
perpetualKeyWidget(
|
: Container(),
|
||||||
false,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
false,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
perpetualKeyWidget(
|
state.nameController),
|
||||||
false,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.password!.tr,
|
false,
|
||||||
"请输入6-9位数字", state.pwdController
|
TranslationLoader.lanKeys!.password!.tr,
|
||||||
),
|
"请输入6-9位数字", state.pwdController
|
||||||
keyIfAdministratorWidget(),
|
),
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
|
keyIfAdministratorWidget(),
|
||||||
],
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip4!.tr)
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 4:
|
case 4:
|
||||||
{
|
{
|
||||||
// 循环
|
// 循环
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
keyCirculationWidget(),
|
children: [
|
||||||
perpetualKeyWidget(
|
keyCirculationWidget(),
|
||||||
true,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
true,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
state.nameController),
|
||||||
],
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip2!.tr)
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
case 5:
|
case 5:
|
||||||
{
|
{
|
||||||
// 清空
|
// 清空
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: [
|
||||||
false,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
false,
|
||||||
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseNameYourPassword!.tr,
|
||||||
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
|
state.nameController),
|
||||||
],
|
keyBottomWidget(TranslationLoader.lanKeys!.getPasswordTip6!.tr)
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -365,7 +386,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
SubmitBtn(
|
SubmitBtn(
|
||||||
btnName: widget.type == "3" ? "设置密码":TranslationLoader.lanKeys!.getPassword!.tr,
|
btnName: state.widgetType.value == 3 ? "设置密码":TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
@ -568,6 +589,66 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TabBar _tabBar() {
|
||||||
|
return TabBar(
|
||||||
|
controller: state.tabController,
|
||||||
|
onTap: (index){
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
},
|
||||||
|
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||||
|
isScrollable: true,
|
||||||
|
indicatorColor: Colors.red,
|
||||||
|
unselectedLabelColor: Colors.black,
|
||||||
|
unselectedLabelStyle: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
),
|
||||||
|
automaticIndicatorColorAdjustment: true,
|
||||||
|
labelColor: AppColors.mainColor,
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
indicator: CustomUnderlineTabIndicator(
|
||||||
|
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||||
|
strokeCap: StrokeCap.round,
|
||||||
|
width: 30.w),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Tab _tab(ItemView item) {
|
||||||
|
return Tab(
|
||||||
|
// text: item.title,
|
||||||
|
child: Container(
|
||||||
|
// width: item.title.length > 2 ? 1.sw / 8 : 1.sw / 12,
|
||||||
|
// margin: EdgeInsets.all(10.w),
|
||||||
|
// color: Colors.red,
|
||||||
|
child: Text(
|
||||||
|
item.title,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _pageWidget() {
|
||||||
|
return Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
controller: state.tabController,
|
||||||
|
children: _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<ItemView> _itemTabs = <ItemView>[
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "0"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "1"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.custom!.tr, type: "3"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "4"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.clearAll!.tr, type: "5"),
|
||||||
|
];
|
||||||
|
|
||||||
List<Widget> initBottomSheetList() {
|
List<Widget> initBottomSheetList() {
|
||||||
List<Widget> widgetList = [];
|
List<Widget> widgetList = [];
|
||||||
|
|
||||||
@ -684,3 +765,10 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
|||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ItemView {
|
||||||
|
const ItemView({required this.title, required this.type});
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
final String type;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||||
@ -32,4 +33,13 @@ class PasswordKeyPerpetualState {
|
|||||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||||
|
|
||||||
var pwdNumber = 0.obs;// 密码编号
|
var pwdNumber = 0.obs;// 密码编号
|
||||||
|
late TabController tabController;
|
||||||
|
|
||||||
|
PasswordKeyPerpetualState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if(map["keyInfo"] != null){
|
||||||
|
keyInfo.value = map["keyInfo"];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,38 +0,0 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../../tools/titleAppBar.dart';
|
|
||||||
import '../../../../../translations/trans_lib.dart';
|
|
||||||
import 'addRemoteControlManage_tabbar.dart';
|
|
||||||
|
|
||||||
class AddRemoteControlManagePage extends StatefulWidget {
|
|
||||||
const AddRemoteControlManagePage({Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<AddRemoteControlManagePage> createState() => _AddRemoteControlManagePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddRemoteControlManagePageState extends State<AddRemoteControlManagePage> {
|
|
||||||
var index = 0;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
|
|
||||||
return Scaffold(
|
|
||||||
backgroundColor: AppColors.mainBackgroundColor,
|
|
||||||
appBar: TitleAppBar(
|
|
||||||
barTitle:
|
|
||||||
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.remoteControl!.tr}",
|
|
||||||
haveBack: true,
|
|
||||||
backgroundColor: AppColors.mainColor),
|
|
||||||
body: Column(
|
|
||||||
children: [
|
|
||||||
AddRemoteControlManageTabbar(initialIndex: index),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,100 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../../../app_settings/app_colors.dart';
|
|
||||||
import '../../../../../tools/CustomUnderlineTabIndicator.dart';
|
|
||||||
import '../../../../../translations/trans_lib.dart';
|
|
||||||
import '../addRemoteControl_page.dart';
|
|
||||||
|
|
||||||
class AddRemoteControlManageTabbar extends StatefulWidget {
|
|
||||||
var initialIndex = 1;
|
|
||||||
|
|
||||||
AddRemoteControlManageTabbar({Key? key, required this.initialIndex}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<AddRemoteControlManageTabbar> createState() => _AddRemoteControlManageTabbarState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AddRemoteControlManageTabbarState extends State<AddRemoteControlManageTabbar> with SingleTickerProviderStateMixin {
|
|
||||||
late TabController _tabController;
|
|
||||||
|
|
||||||
final List<ItemView> _itemTabs = <ItemView>[
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
|
||||||
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
|
||||||
];
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
// TODO: implement initState
|
|
||||||
super.initState();
|
|
||||||
_tabController = TabController(
|
|
||||||
vsync: this,
|
|
||||||
length: _itemTabs.length,
|
|
||||||
initialIndex: widget.initialIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Expanded(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
_tabBar(),
|
|
||||||
_pageWidget(),
|
|
||||||
],
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
TabBar _tabBar() {
|
|
||||||
return TabBar(
|
|
||||||
controller: _tabController,
|
|
||||||
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(),
|
|
||||||
isScrollable: true,
|
|
||||||
indicatorColor: Colors.red,
|
|
||||||
unselectedLabelColor: Colors.black,
|
|
||||||
unselectedLabelStyle: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
),
|
|
||||||
automaticIndicatorColorAdjustment: true,
|
|
||||||
labelColor: AppColors.mainColor,
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
fontSize: 24.sp,
|
|
||||||
fontWeight: FontWeight.w600),
|
|
||||||
indicator: CustomUnderlineTabIndicator(
|
|
||||||
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
|
||||||
strokeCap: StrokeCap.round,
|
|
||||||
width: 30.w),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Tab _tab(ItemView item) {
|
|
||||||
return Tab(
|
|
||||||
child: SizedBox(
|
|
||||||
width: 1.sw / 5,
|
|
||||||
child: Text(item.title, textAlign: TextAlign.center)));
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _pageWidget() {
|
|
||||||
return Expanded(
|
|
||||||
child: TabBarView(
|
|
||||||
controller: _tabController,
|
|
||||||
children: _itemTabs
|
|
||||||
.map((ItemView item) => AddRemoteControlPage(selectType: item.selectType,))
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ItemView {
|
|
||||||
const ItemView({required this.title, required this.selectType});
|
|
||||||
|
|
||||||
final String title;
|
|
||||||
final String selectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -8,34 +8,67 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
|
|||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/CustomUnderlineTabIndicator.dart';
|
||||||
import '../../../../tools/commonItem.dart';
|
import '../../../../tools/commonItem.dart';
|
||||||
import '../../../../tools/dateTool.dart';
|
import '../../../../tools/dateTool.dart';
|
||||||
import '../../../../tools/storage.dart';
|
import '../../../../tools/storage.dart';
|
||||||
import '../../../../tools/submitBtn.dart';
|
import '../../../../tools/submitBtn.dart';
|
||||||
|
import '../../../../tools/titleAppBar.dart';
|
||||||
import '../../../../translations/trans_lib.dart';
|
import '../../../../translations/trans_lib.dart';
|
||||||
import 'addRemoteControl_logic.dart';
|
import 'addRemoteControl_logic.dart';
|
||||||
|
|
||||||
class AddRemoteControlPage extends StatefulWidget {
|
class AddRemoteControlPage extends StatefulWidget {
|
||||||
final String selectType;
|
const AddRemoteControlPage({Key? key})
|
||||||
|
|
||||||
const AddRemoteControlPage({Key? key, required this.selectType})
|
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AddRemoteControlPage> createState() => _AddRemoteControlPageState();
|
State<AddRemoteControlPage> createState() => _AddRemoteControlPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
class _AddRemoteControlPageState extends State<AddRemoteControlPage> with SingleTickerProviderStateMixin {
|
||||||
final logic = Get.put(AddRemoteControlLoigc());
|
final logic = Get.put(AddRemoteControlLoigc());
|
||||||
final state = Get.find<AddRemoteControlLoigc>().state;
|
final state = Get.find<AddRemoteControlLoigc>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
state.tabController = TabController(
|
||||||
|
vsync: this,
|
||||||
|
length: state.fromType.value == 1 ? _itemTabs.length : _fromCheckInTypeItemTabs.length,
|
||||||
|
initialIndex: 0);
|
||||||
|
state.tabController.addListener(() {
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
state.selectType.value = state.tabController.index.toString();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (state.tabController.animation!.value == state.tabController.index) {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return indexChangeWidget();
|
return Scaffold(
|
||||||
|
backgroundColor: AppColors.mainBackgroundColor,
|
||||||
|
appBar: TitleAppBar(
|
||||||
|
barTitle:
|
||||||
|
"${TranslationLoader.lanKeys!.addTip!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}",
|
||||||
|
haveBack: true,
|
||||||
|
backgroundColor: AppColors.mainColor),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
_tabBar(),
|
||||||
|
_pageWidget(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget indexChangeWidget() {
|
Widget indexChangeWidget() {
|
||||||
switch (int.parse(widget.selectType)) {
|
switch (int.parse(state.selectType.value)) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
// 永久
|
// 永久
|
||||||
@ -68,37 +101,18 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
|||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
// 循环
|
// 循环
|
||||||
return Column(
|
return SingleChildScrollView(
|
||||||
children: [
|
child: Column(
|
||||||
perpetualKeyWidget(
|
children: [
|
||||||
TranslationLoader.lanKeys!.name!.tr,
|
perpetualKeyWidget(
|
||||||
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
TranslationLoader.lanKeys!.name!.tr,
|
||||||
state.nameController),
|
TranslationLoader.lanKeys!.pleaseEnter!.tr,
|
||||||
CommonItem(
|
state.nameController),
|
||||||
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
keyCyclicDate(),
|
||||||
rightTitle: "",
|
SizedBox(height: 10.h),
|
||||||
isHaveDirection: true,
|
keyBottomWidget()
|
||||||
action: () async {
|
],
|
||||||
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage,
|
),
|
||||||
arguments: {
|
|
||||||
'validityValue': state.weekdaysList.value,
|
|
||||||
'starDate': state.beginTime.value,
|
|
||||||
'endDate': state.endTime.value,
|
|
||||||
'starTime': state.effectiveDateTime.value,
|
|
||||||
'endTime': state.failureDateTime.value
|
|
||||||
});
|
|
||||||
if(result != null && result.isNotEmpty){
|
|
||||||
state.weekdaysList.value = result['validityValue'];
|
|
||||||
state.beginTime.value = result['starDate'];
|
|
||||||
state.endTime.value = result['endDate'];
|
|
||||||
state.effectiveDateTime.value = result['starTime'];
|
|
||||||
state.failureDateTime.value = result['endTime'];
|
|
||||||
Get.log('得到的有效期数据:${state.weekdaysList.value} == ${state.beginTime.value} == ${state.endTime.value}== ${state.effectiveDateTime.value} == ${state.failureDateTime.value}');
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
SizedBox(height: 10.h),
|
|
||||||
keyBottomWidget()
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -127,29 +141,104 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
|||||||
children: [
|
children: [
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
|
||||||
rightTitle: state.beginTime.value,
|
rightTitle: state.timeLimitBeginTime.value,
|
||||||
isHaveLine: true,
|
isHaveLine: true,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () async {
|
action: () async {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
onConfirm: (p) {
|
onConfirm: (p) {
|
||||||
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
|
state.timeLimitBeginTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
});
|
});
|
||||||
})),
|
})),
|
||||||
Obx(() => CommonItem(
|
Obx(() => CommonItem(
|
||||||
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
|
||||||
rightTitle: state.endTime.value,
|
rightTitle: state.timeLimitEndTime.value,
|
||||||
isHaveDirection: true,
|
isHaveDirection: true,
|
||||||
action: () {
|
action: () {
|
||||||
Pickers.showDatePicker(context, mode: DateMode.YMDHM, onConfirm: (p) {
|
Pickers.showDatePicker(context, mode: DateMode.YMDHM,
|
||||||
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
|
onConfirm: (p) {
|
||||||
});
|
state.timeLimitEndTime.value = DateTool().getYMDHNDateString(p, 1);
|
||||||
|
});
|
||||||
})),
|
})),
|
||||||
Container(height: 10.h),
|
Container(height: 10.h),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 循环顶部选择日期
|
||||||
|
Widget keyCyclicDate() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
|
||||||
|
rightTitle:"${state.cycleBeginTime.value}\n${state.cycleEndTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.cycleBeginTime.value,
|
||||||
|
'endDate': state.cycleEndTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
|
state.cycleEndTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.weekdaysList.isNotEmpty ? true : false,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效日".tr,
|
||||||
|
rightTitle: state.weekdaysList.value.join(",").toString(),
|
||||||
|
isHaveDirection: true,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.cycleBeginTime.value,
|
||||||
|
'endDate': state.cycleEndTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
|
state.cycleEndTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
Obx(() => Visibility(
|
||||||
|
visible: state.effectiveDateTime.value.isNotEmpty,
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: "有效时间".tr,
|
||||||
|
rightTitle: "${state.effectiveDateTime.value}-${state.failureDateTime.value}",
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
var result = await Get.toNamed(Routers.seletKeyCyclicDatePage, arguments: {
|
||||||
|
'validityValue': state.weekdaysList.value,
|
||||||
|
'starDate': state.cycleBeginTime.value,
|
||||||
|
'endDate': state.cycleEndTime.value,
|
||||||
|
'starTime': state.effectiveDateTime.value,
|
||||||
|
'endTime': state.failureDateTime.value
|
||||||
|
});
|
||||||
|
if (result != null && result.isNotEmpty) {
|
||||||
|
state.weekdaysList.value = result['validityValue'];
|
||||||
|
state.cycleBeginTime.value = result['starDate'];
|
||||||
|
state.cycleEndTime.value = result['endDate'];
|
||||||
|
state.effectiveDateTime.value = result['starTime'];
|
||||||
|
state.failureDateTime.value = result['endTime'];
|
||||||
|
}
|
||||||
|
}))),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget keyBottomWidget() {
|
Widget keyBottomWidget() {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
@ -310,4 +399,69 @@ class _AddRemoteControlPageState extends State<AddRemoteControlPage> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final List<ItemView> _itemTabs = <ItemView>[
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, selectType: "2"),
|
||||||
|
];
|
||||||
|
|
||||||
|
final List<ItemView> _fromCheckInTypeItemTabs = <ItemView>[
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, selectType: "0"),
|
||||||
|
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, selectType: "1"),
|
||||||
|
];
|
||||||
|
|
||||||
|
TabBar _tabBar() {
|
||||||
|
return TabBar(
|
||||||
|
controller: state.tabController,
|
||||||
|
onTap: (index) {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
|
},
|
||||||
|
tabs: state.fromType.value == 1 ? _itemTabs.map((ItemView item) => _tab(item)).toList() : _fromCheckInTypeItemTabs.map((ItemView item) => _tab(item)).toList(),
|
||||||
|
isScrollable: true,
|
||||||
|
indicatorColor: Colors.red,
|
||||||
|
unselectedLabelColor: Colors.black,
|
||||||
|
unselectedLabelStyle: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
),
|
||||||
|
automaticIndicatorColorAdjustment: true,
|
||||||
|
labelColor: AppColors.mainColor,
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
color: AppColors.mainColor,
|
||||||
|
fontSize: 24.sp,
|
||||||
|
fontWeight: FontWeight.w600),
|
||||||
|
indicator: CustomUnderlineTabIndicator(
|
||||||
|
borderSide: BorderSide(color: AppColors.mainColor, width: 4.w),
|
||||||
|
strokeCap: StrokeCap.round,
|
||||||
|
width: 30.w),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Tab _tab(ItemView item) {
|
||||||
|
return Tab(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 1.sw / 5,
|
||||||
|
child: Text(item.title, textAlign: TextAlign.center)));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _pageWidget() {
|
||||||
|
return Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
controller: state.tabController,
|
||||||
|
children:
|
||||||
|
state.fromType.value == 1
|
||||||
|
? _itemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList()
|
||||||
|
: _fromCheckInTypeItemTabs.map((ItemView item) => Obx(() => indexChangeWidget())).toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class ItemView {
|
||||||
|
const ItemView({required this.title, required this.selectType});
|
||||||
|
|
||||||
|
final String title;
|
||||||
|
final String selectType;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,13 +2,39 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
class AddRemoteControlState{
|
import '../../../../tools/dateTool.dart';
|
||||||
|
|
||||||
var beginTime = "".obs;// 开始时间
|
class AddRemoteControlState{
|
||||||
var endTime = "".obs;// 结束时间
|
final lockId = 0.obs;
|
||||||
|
final selectType = "0".obs;// 0永久 1显示 2循环
|
||||||
|
final fromType = 1.obs; // // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
final isStressFingerprint = false.obs;
|
||||||
|
final isAdministrator = false.obs;// 是否是管理员
|
||||||
|
|
||||||
|
var timeLimitBeginTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时开始时间
|
||||||
|
var timeLimitEndTime = DateTool().dateToYMDHNString(DateTime.now().millisecondsSinceEpoch.toString()).obs;// 限时结束时间
|
||||||
|
var cycleBeginTime = "".obs;// 循环开始时间
|
||||||
|
var cycleEndTime = "".obs;// 循环结束时间
|
||||||
var effectiveDateTime = "".obs;// 生效时间
|
var effectiveDateTime = "".obs;// 生效时间
|
||||||
var failureDateTime = "".obs;// 失效时间
|
var failureDateTime = "".obs;// 失效时间
|
||||||
var weekdaysList = [].obs;
|
var weekdaysList = [].obs;
|
||||||
|
var fromTypeTwoStaffName = "".obs; // 从添加员工进入 传入员工名字
|
||||||
|
|
||||||
final TextEditingController nameController = TextEditingController();
|
final TextEditingController nameController = TextEditingController();
|
||||||
|
late TabController tabController;
|
||||||
|
AddRemoteControlState() {
|
||||||
|
Map map = Get.arguments;
|
||||||
|
if(map["lockId"]!=null){
|
||||||
|
lockId.value = map["lockId"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(map["fromType"]!=null){
|
||||||
|
fromType.value = map["fromType"];
|
||||||
|
// 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
if(fromType.value == 2){
|
||||||
|
fromTypeTwoStaffName.value = map["fromTypeTwoStaffName"]; // 从添加员工进入 传入员工名字
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
|||||||
|
|
||||||
import '../../../../appRouters.dart';
|
import '../../../../appRouters.dart';
|
||||||
import '../../../../app_settings/app_colors.dart';
|
import '../../../../app_settings/app_colors.dart';
|
||||||
|
import '../../../../tools/commonDataManage.dart';
|
||||||
import '../../../../tools/keySearchWidget.dart';
|
import '../../../../tools/keySearchWidget.dart';
|
||||||
import '../../../../tools/noData.dart';
|
import '../../../../tools/noData.dart';
|
||||||
import '../../../../tools/showIosTipView.dart';
|
import '../../../../tools/showIosTipView.dart';
|
||||||
@ -69,7 +70,10 @@ class _RemoteControlListPageState extends State<RemoteControlListPage> {
|
|||||||
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.remoteControl!.tr}',
|
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.remoteControl!.tr}',
|
||||||
onClick: () async {
|
onClick: () async {
|
||||||
var data =
|
var data =
|
||||||
await Get.toNamed(Routers.addRemoteControlManagePage);
|
await Get.toNamed(Routers.addRemoteControlPage, arguments: {
|
||||||
|
"lockId": CommonDataManage().currentLockSetInfoData.lockId,
|
||||||
|
"fromType": 1 // 1从添加钥匙列表进入 2从考勤添加员工入口进入
|
||||||
|
});
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
// 遥控添加
|
// 遥控添加
|
||||||
|
|
||||||
|
|||||||
@ -298,6 +298,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderGetStarLockStatuInfo(
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
|
isBeforeAddUser: true,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -343,6 +344,7 @@ class NearbyLockLogic extends BaseGetXController {
|
|||||||
IoSenderManage.senderGetStarLockStatuInfo(
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
lockID: BlueManage().connectDeviceName,
|
lockID: BlueManage().connectDeviceName,
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
|
isBeforeAddUser: true,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
);
|
);
|
||||||
} else if (state == BluetoothConnectionState.disconnected) {
|
} else if (state == BluetoothConnectionState.disconnected) {
|
||||||
|
|||||||
@ -38,10 +38,9 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
_replySenderCustomPasswords(reply);
|
_replySenderCustomPasswords(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reply is ChangeAdministratorPasswordReply) {
|
// if (reply is ChangeAdministratorPasswordReply) {
|
||||||
_replyChangeAdministratorPassword(reply);
|
// _replyChangeAdministratorPassword(reply);
|
||||||
}
|
// }
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +85,8 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
publicKey: publicKeyDataList,
|
publicKey: publicKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: token);
|
token: token,
|
||||||
|
isBeforeAddUser: true);
|
||||||
break;
|
break;
|
||||||
case 0x07:
|
case 0x07:
|
||||||
//无权限
|
//无权限
|
||||||
@ -151,51 +151,51 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 修改管理员密码
|
// 修改管理员密码
|
||||||
Future<void> _replyChangeAdministratorPassword(Reply reply) async {
|
// Future<void> _replyChangeAdministratorPassword(Reply reply) async {
|
||||||
var token = reply.data.sublist(5, 9);
|
// var token = reply.data.sublist(5, 9);
|
||||||
var saveStrList = changeIntListToStringList(token);
|
// var saveStrList = changeIntListToStringList(token);
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
// Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
//
|
||||||
int status = reply.data[2];
|
// int status = reply.data[2];
|
||||||
Get.log("status:$status");
|
// Get.log("status:$status");
|
||||||
|
//
|
||||||
switch (status) {
|
// switch (status) {
|
||||||
case 0x00:
|
// case 0x00:
|
||||||
//成功
|
// //成功
|
||||||
Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
// Get.log("${reply.commandType!.typeValue} 数据解析成功");
|
||||||
cancelBlueConnetctToastTimer();
|
// cancelBlueConnetctToastTimer();
|
||||||
addLockAdminPassword(false);
|
// addLockAdminPassword(false);
|
||||||
break;
|
// break;
|
||||||
case 0x06:
|
// case 0x06:
|
||||||
//无权限
|
// //无权限
|
||||||
Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
// Get.log("${reply.commandType!.typeValue} 需要鉴权");
|
||||||
|
//
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
// var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
// List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
//
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
//
|
||||||
IoSenderManage.changeAdministratorPasswordCommand(
|
// IoSenderManage.changeAdministratorPasswordCommand(
|
||||||
keyID: "1",
|
// keyID: "1",
|
||||||
userID: await Storage.getUid(),
|
// userID: await Storage.getUid(),
|
||||||
pwdNo: 254,
|
// pwdNo: 254,
|
||||||
pwd:state.adminPasswordTF.text,
|
// pwd:state.adminPasswordTF.text,
|
||||||
useCountLimit: 0xff,
|
// useCountLimit: 0xff,
|
||||||
startTime: 0x11223344,
|
// startTime: 0x11223344,
|
||||||
endTime: 0x11223344,
|
// endTime: 0x11223344,
|
||||||
needAuthor: 1,
|
// needAuthor: 1,
|
||||||
isBeforeAddUser: true,
|
// isBeforeAddUser: true,
|
||||||
signKey: signKeyDataList,
|
// signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
// privateKey: getPrivateKeyList,
|
||||||
token: token);
|
// token: token);
|
||||||
break;
|
// break;
|
||||||
default:
|
// default:
|
||||||
// 失败
|
// // 失败
|
||||||
Get.log("${reply.commandType!.typeValue} 失败");
|
// Get.log("${reply.commandType!.typeValue} 失败");
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 添加用户
|
// 添加用户
|
||||||
Future<void> addUserConnectBlue() async {
|
Future<void> addUserConnectBlue() async {
|
||||||
@ -234,7 +234,8 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
needAuthor:1,
|
needAuthor:1,
|
||||||
publicKey:publicKeyDataList,
|
publicKey:publicKeyDataList,
|
||||||
privateKey:getPrivateKeyList,
|
privateKey:getPrivateKeyList,
|
||||||
token: getTokenList
|
token: getTokenList,
|
||||||
|
isBeforeAddUser: true
|
||||||
);
|
);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
@ -282,45 +283,45 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 修改管理员密码(同添加自定义开锁密码,指纹/密码/卡片前5个是管理员)
|
// 修改管理员密码(同添加自定义开锁密码,指纹/密码/卡片前5个是管理员)
|
||||||
Future<void> changeAdministratorPasswordCommand() async {
|
// Future<void> changeAdministratorPasswordCommand() async {
|
||||||
showEasyLoading();
|
// showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
// showBlueConnetctToastTimer(action: (){
|
||||||
dismissEasyLoading();
|
// dismissEasyLoading();
|
||||||
});
|
// });
|
||||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
// BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
// if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
// var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
// List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
//
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
// var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
//
|
||||||
var token = await Storage.getStringList(saveBlueToken);
|
// var token = await Storage.getStringList(saveBlueToken);
|
||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
// List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
//
|
||||||
IoSenderManage.changeAdministratorPasswordCommand(
|
// IoSenderManage.changeAdministratorPasswordCommand(
|
||||||
keyID: "1",
|
// keyID: "1",
|
||||||
userID: await Storage.getUid(),
|
// userID: await Storage.getUid(),
|
||||||
pwdNo: 254,
|
// pwdNo: 254,
|
||||||
pwd:state.adminPasswordTF.text,
|
// pwd:state.adminPasswordTF.text,
|
||||||
useCountLimit: 0xff,
|
// useCountLimit: 0xff,
|
||||||
startTime: 0x11223344,
|
// startTime: 0x11223344,
|
||||||
endTime: 0x11223344,
|
// endTime: 0x11223344,
|
||||||
needAuthor: 1,
|
// needAuthor: 1,
|
||||||
isBeforeAddUser: true,
|
// isBeforeAddUser: true,
|
||||||
signKey: signKeyDataList,
|
// signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
// privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
// token: getTokenList);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
// } else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
// dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
// cancelBlueConnetctToastTimer();
|
||||||
state.saveBtnIsUsable.value = true;
|
// state.saveBtnIsUsable.value = true;
|
||||||
if(state.ifCurrentScreen.value == true){
|
// if(state.ifCurrentScreen.value == true){
|
||||||
showBlueConnetctToast();
|
// showBlueConnetctToast();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}, isAddEquipment: true);
|
// }, isAddEquipment: true);
|
||||||
}
|
// }
|
||||||
|
|
||||||
void bindBlueAdmin() async{
|
void bindBlueAdmin() async{
|
||||||
|
|
||||||
@ -379,52 +380,52 @@ class SaveLockLogic extends BaseGetXController {
|
|||||||
adminPwd: state.adminPasswordTF.text,
|
adminPwd: state.adminPasswordTF.text,
|
||||||
);
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if(isAddLockAdminPassword == true){
|
// if(isAddLockAdminPassword == true){
|
||||||
showDeletPasswordAlertDialog();
|
// showDeletPasswordAlertDialog();
|
||||||
}else{
|
// }else{
|
||||||
backAction();
|
backAction();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void showDeletPasswordAlertDialog() {
|
// void showDeletPasswordAlertDialog() {
|
||||||
showDialog(
|
// showDialog(
|
||||||
context: Get.context!,
|
// context: Get.context!,
|
||||||
builder: (BuildContext context) {
|
// builder: (BuildContext context) {
|
||||||
return ShowTFView(
|
// return ShowTFView(
|
||||||
title: "管理员密码",
|
// title: "管理员密码",
|
||||||
tipTitle: "如需修改,请输入新的管理员密码(6位),点击确定即可修改",
|
// tipTitle: "如需修改,请输入新的管理员密码(6位),点击确定即可修改",
|
||||||
leftBtnTitle: "确定".tr,
|
// leftBtnTitle: "确定".tr,
|
||||||
rightBtnTitle: "修改",
|
// rightBtnTitle: "修改",
|
||||||
keyboardType: TextInputType.number,
|
// keyboardType: TextInputType.number,
|
||||||
inputFormatters: [
|
// inputFormatters: [
|
||||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
// FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||||
LengthLimitingTextInputFormatter(6),
|
// LengthLimitingTextInputFormatter(6),
|
||||||
],
|
// ],
|
||||||
controller: state.adminPasswordTF,
|
// controller: state.adminPasswordTF,
|
||||||
sureClick: () {
|
// sureClick: () {
|
||||||
if(state.adminPasswordTF.text.length < 6){
|
// if(state.adminPasswordTF.text.length < 6){
|
||||||
showToast("请输入6位管理员密码".tr);
|
// showToast("请输入6位管理员密码".tr);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(state.adminPasswordTF.text == state.adminPassword){
|
// if(state.adminPasswordTF.text == state.adminPassword){
|
||||||
showToast("请输入新的管理员密码".tr);
|
// showToast("请输入新的管理员密码".tr);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
changeAdministratorPasswordCommand();
|
// changeAdministratorPasswordCommand();
|
||||||
},
|
// },
|
||||||
cancelClick: () {
|
// cancelClick: () {
|
||||||
backAction();
|
// backAction();
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
void backAction(){
|
void backAction(){
|
||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
Get.close(state.isFromMap == 1 ? 6 : 7);
|
Get.close(state.isFromMap == 1 ? 5 : 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/blue/blue_manage.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_colors.dart';
|
import '../../../app_settings/app_colors.dart';
|
||||||
import '../../../tools/appRouteObserver.dart';
|
import '../../../tools/appRouteObserver.dart';
|
||||||
@ -134,6 +135,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
|||||||
/// 取消路由订阅
|
/// 取消路由订阅
|
||||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
BlueManage().stopScan();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 从上级界面进入 当前界面即将出现
|
/// 从上级界面进入 当前界面即将出现
|
||||||
@ -141,6 +143,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
|||||||
void didPush() {
|
void didPush() {
|
||||||
super.didPush();
|
super.didPush();
|
||||||
|
|
||||||
|
BlueManage().stopScan();
|
||||||
state.ifCurrentScreen.value = true;
|
state.ifCurrentScreen.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,6 +152,7 @@ class _SaveLockPageState extends State<SaveLockPage> with RouteAware {
|
|||||||
void didPop() {
|
void didPop() {
|
||||||
super.didPop();
|
super.didPop();
|
||||||
|
|
||||||
|
BlueManage().stopScan();
|
||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
logic.cancelBlueConnetctToastTimer();
|
logic.cancelBlueConnetctToastTimer();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,9 +32,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# 1.0.27+2024041101:打包提审
|
# 1.0.27+2024041101:打包提审
|
||||||
# 1.0.27+2024041102:打包预发布环境给田总测试
|
# 1.0.27+2024041102:打包预发布环境给田总测试
|
||||||
# 1.0.28+2024041702:打包给欧阳回归测试
|
# 1.0.28+2024041702:打包给欧阳回归测试
|
||||||
# 1.0.27+2024041702 打包星星锁提审华为
|
# 1.0.27+2024041702 打包鑫锁提审华为
|
||||||
# 1.0.27+2024041703 打包星星锁提审ios
|
# 1.0.27+2024041703 打包鑫锁提审ios
|
||||||
# 1.0.27+2024042204 打包星星锁提审ios与 android
|
# 1.0.27+2024042204 打包鑫锁提审ios与 android
|
||||||
|
|
||||||
version: 1.0.27+2024042204
|
version: 1.0.27+2024042204
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user