This commit is contained in:
魏少阳 2024-05-09 13:49:47 +08:00
commit e429dd96b3
28 changed files with 690 additions and 328 deletions

View File

@ -830,5 +830,7 @@
"发送人":"Sender",
"发送时间":"Send time",
"钥匙详情":"Key details",
"姓名":"Name"
"姓名":"Name",
"发送":"Send",
"请确认姓名全名和身份证号码是否正确":"Please confirm that the full name and ID number are correct"
}

View File

@ -858,5 +858,7 @@
"发送人":"发送人",
"发送时间":"发送时间",
"钥匙详情":"钥匙详情",
"姓名":"姓名"
"姓名":"姓名",
"发送":"发送",
"请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确"
}

View File

@ -861,5 +861,7 @@
"发送人":"发送人",
"发送时间":"发送时间",
"钥匙详情":"钥匙详情",
"姓名":"姓名"
"姓名":"姓名",
"发送":"发送",
"请确认姓名全名和身份证号码是否正确":"请确认姓名全名和身份证号码是否正确"
}

View File

@ -375,7 +375,6 @@ class BlueManage {
// AppLog.log('bluetoothConnectDevice: $bluetoothConnectDevice');
scanResult = devicesList[knownDeviceIndex];
_initGetMtuSubscription();
_initListenConnectionState();
}
@ -478,7 +477,7 @@ class BlueManage {
//
//
dataLen = data[8] * 256 + data[9]; // 16
// AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data");
AppLog.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data");
if (dataLen! + 14 > data.length) {
//
allData.addAll(data);
@ -494,8 +493,9 @@ class BlueManage {
//
allData.addAll(data);
// var len = allData[8] * 256 + allData[9];
AppLog.log("dataLen3333:$dataLen allData.length:${allData.length} allData:$allData");
if ((dataLen! + 14) <= allData.length) {
AppLog.log(
"dataLen3333:$dataLen allData.length:${allData.length} allData:$allData");
if (((dataLen ?? 0) + 14) <= allData.length) {
//
CommandReciverManager.appDataReceive(allData);
//

View File

@ -34,8 +34,8 @@ abstract class SenderProtocol extends IOData {
}
void printLog(List<int> data) {
AppLog.log(
"App -> 锁,指令类型:${commandType!.typeName} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}");
// AppLog.log(
// "App -> 锁,指令类型:${commandType!.typeName} \n参数是:\n${toString()} \n加密之前数据是:\n$data 长度是:${data.length}");
}
//TODO:Ï

View File

@ -5,6 +5,7 @@ import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/blue/blue_manage.dart';
import 'package:star_lock/blue/io_protocol/io_addFace.dart';
import 'package:star_lock/blue/io_protocol/io_changeAdministratorPassword.dart';
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
import 'package:star_lock/blue/io_protocol/io_editUser.dart';
import 'package:star_lock/blue/io_protocol/io_factoryDataReset.dart';
@ -107,8 +108,11 @@ class CommandReciverManager {
AppLog.log("APP收到的解密后的数据:$oriDataList");
break;
}
parseData(oriDataList).then((value) async {
parseData(oriDataList).then((Reply? value) async {
EasyLoading.dismiss();
if (value != null) {
AppLog.log("锁 -> App指令订阅类型 :${value.commandType?.typeName} \n $value");
}
await EventBusManager().eventBusFir(value);
}).catchError((error) {
AppLog.log("APP解析数据时发生错误: $error");
@ -195,6 +199,11 @@ class CommandReciverManager {
reply = ProcessOtaUpgradeReply.parseData(commandType, data);
}
break;
case CommandType.cleanUpUsers:
{
reply = CleanUpUsersReply.parseData(commandType, data);
}
break;
case CommandType.generalExtendedCommond:
{
//

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/blue/io_protocol/io_cleanUpUsers.dart';
import 'package:star_lock/blue/sender_manage.dart';
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
import 'package:star_lock/network/api_provider.dart';
@ -46,9 +47,12 @@ class SenderBeforeDataManage {
_replySubscription ??=
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
//
if ((reply is AddUserReply)) {
if (reply is AddUserReply) {
_replyAddUserKey(reply);
}
if(reply is CleanUpUsersReply){
}
});
}
@ -104,7 +108,7 @@ class SenderBeforeDataManage {
keyID: currentKeyInfo.keyId.toString(),
userID: await Storage.getUid(),
openMode: 1,
keyType: 0,
keyType: currentKeyInfo.keyType,
startDate: currentKeyInfo.startDate! ~/ 1000,
expireDate: currentKeyInfo.endDate! ~/ 1000,
useCountLimit: 0xFFFF,
@ -144,22 +148,17 @@ class SenderBeforeDataManage {
List<int> tokenList = changeStringListToIntList(tokenKey!);
AppLog.log('---> ${entity.data?.userNos}');
BlueManage().bludSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) {
IoSenderManage.senderCleanUpUsersCommand(
lockID: BlueManage().connectDeviceName,
authUserID:
CommonDataManage().currentKeyInfo.senderUserId!.toString(),
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
userID: await Storage.getUid(),
userNoList: entity.data!.userNos!,
needAuthor: 1,
publicKey: publicKeyDataList,
privateKey: getPrivateKeyList,
token: tokenList);
}
});
IoSenderManage.senderCleanUpUsersCommand(
lockID: BlueManage().connectDeviceName,
authUserID:
CommonDataManage().currentKeyInfo.senderUserId!.toString(),
keyID: CommonDataManage().currentKeyInfo.keyId.toString(),
userID: await Storage.getUid(),
userNoList: entity.data!.userNos!,
needAuthor: 1,
publicKey: publicKeyDataList,
privateKey: getPrivateKeyList,
token: tokenList);
break;
default:
@ -188,7 +187,7 @@ class SenderBeforeDataManage {
keyID: currentKeyInfo.keyId.toString(),
userID: await Storage.getUid(),
openMode: 1,
keyType: 0,
keyType: currentKeyInfo.keyType,
startDate: currentKeyInfo.startDate! ~/ 1000,
expireDate: currentKeyInfo.endDate! ~/ 1000,
useCountLimit: 0xFFFF,

View File

@ -1,11 +1,12 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_page.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import '../../../../../tools/custom_bottom_sheet.dart';
import '../../../../../tools/dateTool.dart';
@ -40,14 +41,14 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
// updateType 1: 2:
Future<void> updateKeyDateRequest(int updateType) async {
KeyOperationRecordEntity entity = await ApiRepository.to.updateKeyDate(
keyId:state.itemData.value.keyId.toString(),
lockId:state.itemData.value.lockId.toString(),
endDate:state.endDate.value.toString(),
startDate:state.starDate.value.toString(),
weekDays:state.itemData.value.weekDays!,
keyType:state.itemData.value.keyType!,
startTime:int.parse(state.starTime.value),
endTime:int.parse(state.endTime.value),
keyId: state.itemData.value.keyId.toString(),
lockId: state.itemData.value.lockId.toString(),
endDate: state.endDate.value.toString(),
startDate: state.starDate.value.toString(),
weekDays: state.itemData.value.weekDays!,
keyType: state.itemData.value.keyType!,
startTime: int.parse(state.starTime.value),
endTime: int.parse(state.endTime.value),
isOnlyManageSelf: state.onlyManageYouCreatesUser.value == true ? 1 : 0,
remoteEnable: state.isRemoteUnlock.value == true ? 1 : 2);
if (entity.errorCode!.codeIsSuccessful) {
@ -61,9 +62,8 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
//
Future<void> deleteKeyRequest(int includeUnderlings) async {
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
keyId:state.itemData.value.keyId.toString(),
includeUnderlings: includeUnderlings
);
keyId: state.itemData.value.keyId.toString(),
includeUnderlings: includeUnderlings);
if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
@ -76,7 +76,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
//
Future<void> setAdministrator() async {
ElectronicKeyListEntity entity = await ApiRepository.to.setAdministrator(
keyId:state.itemData.value.keyId.toString(),
keyId: state.itemData.value.keyId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("设置成功".tr, something: () {
@ -90,7 +90,7 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
//
Future<void> cancelAdministrator() async {
ElectronicKeyListEntity entity = await ApiRepository.to.cancelAdministrator(
keyId:state.itemData.value.keyId.toString(),
keyId: state.itemData.value.keyId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
showToast("设置成功".tr, something: () {
@ -104,9 +104,8 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
//
Future<void> freezeKey(int includeUnderlings) async {
ElectronicKeyListEntity entity = await ApiRepository.to.freezeKey(
keyId:state.itemData.value.keyId.toString(),
includeUnderlings: includeUnderlings
);
keyId: state.itemData.value.keyId.toString(),
includeUnderlings: includeUnderlings);
if (entity.errorCode!.codeIsSuccessful) {
showToast("设置成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
@ -119,9 +118,8 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
//
Future<void> cancelFreeze(int includeUnderlings) async {
ElectronicKeyListEntity entity = await ApiRepository.to.cancelFreeze(
keyId:state.itemData.value.keyId.toString(),
includeUnderlings: includeUnderlings
);
keyId: state.itemData.value.keyId.toString(),
includeUnderlings: includeUnderlings);
if (entity.errorCode!.codeIsSuccessful) {
showToast("设置成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
@ -131,26 +129,119 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
}
}
String getKeyTypeShowDateTime(){
//
Future<void> checkRealNameStatus(int realNameAuthStatus) async {
//
if (realNameAuthStatus == 1) {
if (state.getRealName.value.isEmpty ||
state.getIDCardNumber.value.isEmpty) {
ShowCupertinoAlertView()
.showOpenAuthWithIDCardInfoAlert((idCard, realName) {
if (idCard.isNotEmpty && realName.isNotEmpty) {
state.getIDCardNumber.value = idCard;
state.getRealName.value = realName;
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
} else {
showToast("请输入完整信息".tr);
return;
}
});
} else {
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
}
} else {
updateRealNameInfoWithAuthStatus(realNameAuthStatus);
}
}
//--
Future<void> updateRealNameInfoWithAuthStatus(int realNameAuthStatus) async {
KeyOperationRecordEntity entity = await ApiRepository.to.updateRealNameInfo(
lockId: state.itemData.value.lockId ?? 0,
keyId: state.itemData.value.keyId ?? 0,
uid: state.itemData.value.uid ?? 0,
faceAuthentication: realNameAuthStatus,
realName: state.getRealName.value,
idCardNumber: state.getIDCardNumber.value);
if (entity.errorCode!.codeIsSuccessful) {
state.isRealNameAuth.value = !state.isRealNameAuth.value;
showToast("修改成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
Get.back();
});
}
}
//
Future<void> updateRealNameInfoRequest(ShowAlertEnum alertEnum) async {
switch (alertEnum) {
case ShowAlertEnum.realName:
if (state.changeRealNameController.text.isEmpty) {
showToast("请输入真实姓名".tr);
return;
}
break;
case ShowAlertEnum.idCardNumber:
if (state.changeIDCardController.text.isEmpty) {
showToast("请输入身份证号".tr);
return;
}
break;
default:
}
KeyOperationRecordEntity entity = await ApiRepository.to.updateRealNameInfo(
lockId: state.itemData.value.lockId ?? 0,
keyId: state.itemData.value.keyId ?? 0,
uid: state.itemData.value.uid ?? 0,
faceAuthentication: state.isRealNameAuth.value ? 1 : 2,
realName: state.changeRealNameController.text,
idCardNumber: state.changeIDCardController.text);
if (entity.errorCode!.codeIsSuccessful) {
if (alertEnum == ShowAlertEnum.realName) {
state.itemData.value.userIdCard!.realName =
state.changeRealNameController.text;
state.getRealName.value = state.itemData.value.userIdCard!.realName!;
} else if (alertEnum == ShowAlertEnum.idCardNumber) {
state.itemData.value.userIdCard!.idCardNumber =
state.changeIDCardController.text;
state.getIDCardNumber.value =
state.itemData.value.userIdCard!.idCardNumber!;
}
showToast("修改成功".tr, something: () {
eventBus.fire(ElectronicKeyListRefreshUI());
eventBus.fire(AuthorizedAdminPageRefreshUI());
});
}
}
String getKeyTypeShowDateTime() {
String useDateStr = '';
if(state.keyType.value == 1){
if (state.keyType.value == 1) {
useDateStr = "永久".tr;
}else if(state.keyType.value == 2){
useDateStr = "${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
}else if(state.keyType.value == 3){
} else if (state.keyType.value == 2) {
useDateStr =
"${DateTool().dateToYMDHNString(state.starDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}";
} else if (state.keyType.value == 3) {
useDateStr = "单次".tr;
}else if(state.keyType.value == 4){
useDateStr = "${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
} else if (state.keyType.value == 4) {
useDateStr =
"${DateTool().dateToYMDString(state.starDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}";
}
return useDateStr;
}
Future openModalBottomSheet(BuildContext context) async {
var textList = <String>[];
if(state.keyType.value == 1 || state.keyType.value == 2){
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr, state.itemData.value.keyRight == 1 ? '取消授权'.tr : '授权'.tr];
} else if(state.keyType.value == 4){
textList = [state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr];
if (state.keyType.value == 1 || state.keyType.value == 2) {
textList = [
state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr,
state.itemData.value.keyRight == 1 ? '取消授权'.tr : '授权'.tr
];
} else if (state.keyType.value == 4) {
textList = [
state.itemData.value.keyStatus == 110405 ? '取消冻结'.tr : "冻结".tr
];
}
showModalBottomSheet(
context: context,
@ -162,40 +253,46 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
items: textList,
chooseCallback: (value) {
int index = value;
if(index == 0){
if(state.itemData.value.keyStatus == 110405){
if (index == 0) {
if (state.itemData.value.keyStatus == 110405) {
//
if(state.itemData.value.keyRight == 1){
if (state.itemData.value.keyRight == 1) {
//
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时解冻其发送的钥匙'.tr, (isAllData) {
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
'同时解冻其发送的钥匙'.tr, (isAllData) {
cancelFreeze(isAllData ? 1 : 0);
});
}else{
ShowTipView().showIosTipWithContentDialog("取消冻结会在用户APP连网后生效".tr, (){
} else {
ShowTipView()
.showIosTipWithContentDialog("取消冻结会在用户APP连网后生效".tr, () {
cancelFreeze(0);
});
}
}else{
if(state.itemData.value.keyRight == 1){
} else {
if (state.itemData.value.keyRight == 1) {
//
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时冻结其发送的钥匙'.tr, (isAllData) {
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
'同时冻结其发送的钥匙'.tr, (isAllData) {
freezeKey(isAllData ? 1 : 0);
});
}else{
ShowTipView().showIosTipWithContentDialog("冻结会在用户APP连网后生效".tr, (){
} else {
ShowTipView()
.showIosTipWithContentDialog("冻结会在用户APP连网后生效".tr, () {
freezeKey(0);
});
}
}
}else{
} else {
// /
if(state.itemData.value.keyRight == 1){
if (state.itemData.value.keyRight == 1) {
//
ShowTipView().showIosTipWithContentDialog("取消授权会在用户APP连网后生效".tr, (){
ShowTipView()
.showIosTipWithContentDialog("取消授权会在用户APP连网后生效".tr, () {
cancelAdministrator();
});
}else{
ShowTipView().showIosTipWithContentDialog("授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码".tr, (){
} else {
ShowTipView().showIosTipWithContentDialog(
"授权用户拥有管理员的大部分权限,比如发送钥匙、发送密码".tr, () {
setAdministrator();
});
}
@ -205,20 +302,38 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
});
}
deletKeyLogic(){
if(state.itemData.value.keyRight == 1){
deletKeyLogic() {
if (state.itemData.value.keyRight == 1) {
//
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) {
deleteKeyRequest(isAllData ? 1 : 0);
});
}else{
} else {
//
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr,(){
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr, () {
deleteKeyRequest(0);
});
}
}
TextEditingController getCurrentController(ShowAlertEnum alertEnum) {
TextEditingController currentController = TextEditingController();
switch (alertEnum) {
case ShowAlertEnum.name:
currentController = state.changeNameController;
break;
case ShowAlertEnum.realName:
currentController = state.changeRealNameController;
break;
case ShowAlertEnum.idCardNumber:
currentController = state.changeIDCardController;
break;
default:
}
return currentController;
}
@override
void onReady() {
// TODO: implement onReady

View File

@ -2,7 +2,9 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart';
@ -14,6 +16,8 @@ import '../../../../../tools/showTFView.dart';
import '../../../../../tools/submitBtn.dart';
import '../../../../../tools/titleAppBar.dart';
enum ShowAlertEnum { name, realName, idCardNumber }
class ElectronicKeyDetailPage extends StatefulWidget {
const ElectronicKeyDetailPage({Key? key}) : super(key: key);
@ -57,8 +61,33 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveDirection: true,
isHaveLine: true,
action: () {
showCupertinoAlertDialog(context);
showCupertinoAlertDialog(
tipsTitle: "修改姓名".tr, alertEnum: ShowAlertEnum.name);
})),
Obx(() => Visibility(
visible: state.isRealNameAuth.value,
child: CommonItem(
leftTitel: '真实姓名'.tr,
rightTitle: state.getRealName.value,
isHaveDirection: true,
isHaveLine: true,
action: () {
showCupertinoAlertDialog(
tipsTitle: "修改真实姓名".tr,
alertEnum: ShowAlertEnum.realName);
}))),
Obx(() => Visibility(
visible: state.isRealNameAuth.value,
child: CommonItem(
leftTitel: '身份证'.tr,
rightTitle: state.getIDCardNumber.value,
isHaveDirection: true,
isHaveLine: true,
action: () {
showCupertinoAlertDialog(
tipsTitle: "修改身份证号".tr,
alertEnum: ShowAlertEnum.idCardNumber);
}))),
Obx(() => CommonItem(
leftTitel: '有效期'.tr,
allHeight: 70.h,
@ -184,31 +213,31 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
rightWidget: SizedBox(
width: 60.w, child: _onlyManageYouCreatesUserSwitch())),
),
Visibility(
// (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false
visible:
CommonDataManage().currentKeyInfo.lockSetting!.remoteUnlock ==
Obx(
() => Visibility(
// (state.keyInfo.value.lockSetting!.remoteUnlock == 1 ? true : false
visible: CommonDataManage()
.currentKeyInfo
.lockSetting!
.remoteUnlock ==
1 &&
state.itemData.value.keyRight != 1
? true
: false,
child: CommonItem(
leftTitel: "远程开锁".tr,
rightTitle: "",
isHaveRightWidget: true,
isHaveLine: true,
rightWidget:
SizedBox(width: 60.w, child: _remoteUnlockingSwitch())),
child: CommonItem(
leftTitel: "远程开锁".tr,
rightTitle: "",
isHaveRightWidget: true,
isHaveLine: true,
rightWidget: SizedBox(
width: 60.w, child: _remoteUnlockingSwitch()))),
),
CommonItem(
Obx(() => CommonItem(
leftTitel: '实名认证'.tr,
rightTitle: "",
isHaveRightWidget: true,
rightWidget: SizedBox(
width: 60.w,
child: _switch(state.itemData.value.faceAuthentication == 1
? true
: false))),
rightWidget:
SizedBox(width: 60.w, child: _realNameAuthSwitch()))),
Container(height: 10.h),
CommonItem(
leftTitel: '操作记录'.tr,
@ -221,31 +250,36 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
});
}),
Container(height: 40.h),
SubmitBtn(
btnName: '删除'.tr,
borderRadius: 20.w,
isDelete: true,
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
logic.deletKeyLogic();
}),
Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w),
child: SubmitBtn(
btnName: '删除'.tr,
borderRadius: 20.w,
isDelete: true,
margin: EdgeInsets.only(
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {
logic.deletKeyLogic();
}),
),
],
),
);
}
CupertinoSwitch _switch(isOn) {
CupertinoSwitch _realNameAuthSwitch() {
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: isOn,
value: state.isRealNameAuth.value,
onChanged: (value) {
setState(() {
isOn = value;
});
if (!state.isRealNameAuth.value) {
logic.checkRealNameStatus(1);
} else {
logic.checkRealNameStatus(2);
}
},
);
}
@ -257,10 +291,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
thumbColor: CupertinoColors.white,
value: state.isRemoteUnlock.value,
onChanged: (value) {
setState(() {
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
logic.updateKeyDateRequest(2);
});
state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
logic.updateKeyDateRequest(2);
},
);
}
@ -281,18 +313,20 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
);
}
void showCupertinoAlertDialog(BuildContext context) {
void showCupertinoAlertDialog(
{required String tipsTitle, required ShowAlertEnum alertEnum}) {
showDialog(
context: context,
builder: (BuildContext context) {
return ShowTFView(
title: "修改姓名".tr,
title: tipsTitle,
tipTitle: "请输入".tr,
controller: state.changeNameController,
controller: logic.getCurrentController(alertEnum),
sureClick: () {
//
if (state.changeNameController.text.isNotEmpty) {
if (alertEnum == ShowAlertEnum.name) {
logic.modifyKeyNameRequest();
} else {
logic.updateRealNameInfoRequest(alertEnum);
}
},
cancelClick: () {

View File

@ -2,24 +2,28 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import '../../../../lockMian/entity/lockListInfo_entity.dart';
class ElectronicKeyDetailState {
final itemData = ElectronicKeyListItem().obs;
// final keyInfo = LockListInfoItemEntity().obs;
final keyName = "".obs;
final TextEditingController changeNameController = TextEditingController();
final TextEditingController changeRealNameController =
TextEditingController();
final TextEditingController changeIDCardController = TextEditingController();
var starDate = "".obs;//
var endDate = "".obs;//
var starTime = "".obs;//
var endTime = "".obs;//
final keyType = 0.obs;// :1;23:4
var weekDay = [].obs;//
var starDate = "".obs; //
var endDate = "".obs; //
var starTime = "".obs; //
var endTime = "".obs; //
final keyType = 0.obs; // :1;23:4
var weekDay = [].obs; //
var onlyManageYouCreatesUser = false.obs;// 0: 1:
var onlyManageYouCreatesUser = false.obs; // 0: 1:
var isRemoteUnlock = false.obs; // 0: 1:
var isRealNameAuth = false.obs; // 0: 1:
var getRealName = ''.obs; //
var getIDCardNumber = ''.obs; //
ElectronicKeyDetailState() {
Map map = Get.arguments;
@ -29,9 +33,16 @@ class ElectronicKeyDetailState {
// }
changeNameController.text = itemData.value.keyName!;
keyName.value = itemData.value.keyName!;
if (itemData.value.userIdCard != null) {
getRealName.value = itemData.value.userIdCard!.realName ?? "";
getIDCardNumber.value = itemData.value.userIdCard!.idCardNumber ?? "";
}
isRemoteUnlock.value = itemData.value.remoteEnable! == 1 ? true : false;
onlyManageYouCreatesUser.value = itemData.value.isOnlyManageSelf! == 0 ? false : true;
isRealNameAuth.value =
itemData.value.faceAuthentication == 1 ? true : false;
onlyManageYouCreatesUser.value =
itemData.value.isOnlyManageSelf! == 0 ? false : true;
starDate.value = itemData.value.startDate!.toString();
endDate.value = itemData.value.endDate!.toString();

View File

@ -88,30 +88,34 @@ class ElectronicKeyListItem {
int? appUnlockMustOnline;
List? weekDays;
int? isOnlyManageSelf;
UserIdCard? userIdCard;
int? uid;
ElectronicKeyListItem(
{this.keyId,
this.lockId,
this.username,
this.lockName,
this.lockAlias,
this.userType,
this.keyName,
this.keyStatus,
this.startDate,
this.endDate,
this.keyRight,
this.keyType,
this.senderUsername,
this.remarks,
this.isCameraEnable,
this.faceAuthentication,
this.sendDate,
this.remoteEnable,
this.appUnlockMustOnline,
this.weekDays,
this.isOnlyManageSelf
});
ElectronicKeyListItem({
this.keyId,
this.lockId,
this.username,
this.lockName,
this.lockAlias,
this.userType,
this.keyName,
this.keyStatus,
this.startDate,
this.endDate,
this.keyRight,
this.keyType,
this.senderUsername,
this.remarks,
this.isCameraEnable,
this.faceAuthentication,
this.sendDate,
this.remoteEnable,
this.appUnlockMustOnline,
this.weekDays,
this.isOnlyManageSelf,
this.userIdCard,
this.uid,
});
ElectronicKeyListItem.fromJson(Map<String, dynamic> json) {
keyId = json['keyId'];
@ -139,6 +143,10 @@ class ElectronicKeyListItem {
appUnlockMustOnline = json['appUnlockMustOnline'];
isOnlyManageSelf = json['isOnlyManageSelf'];
json['weekDays'] != null ? weekDays = json['weekDays'] : [];
json['userIdCard'] != null
? userIdCard = UserIdCard.fromJson(json['userIdCard'])
: null;
uid = json['uid'];
}
Map<String, dynamic> toJson() {
@ -164,6 +172,29 @@ class ElectronicKeyListItem {
data['appUnlockMustOnline'] = appUnlockMustOnline;
data['weekDays'] = weekDays;
data['isOnlyManageSelf'] = isOnlyManageSelf;
if (userIdCard != null) {
data['userIdCard'] = userIdCard!.toJson();
}
data['uid'] = uid;
return data;
}
}
class UserIdCard {
String? realName;
String? idCardNumber;
UserIdCard({this.realName, this.idCardNumber});
UserIdCard.fromJson(Map<String, dynamic> json) {
realName = json['realName'];
idCardNumber = json['idCardNumber'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['realName'] = realName;
data['idCardNumber'] = idCardNumber;
return data;
}
}

View File

@ -7,7 +7,7 @@ import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/ma
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupList_logic.dart';
import 'package:star_lock/tools/ExpandedListView.dart';
import 'package:star_lock/tools/advancedFunctionHandle.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/translations/trans_lib.dart';
@ -54,7 +54,7 @@ class _MassSendLockGroupListPageState extends State<MassSendLockGroupListPage> {
children: [
Obx(() => Visibility(
visible: state.isVip.value ? false : true,
child: AdvancedFunctionHandle()
child: ShowCupertinoAlertView()
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
SizedBox(
height: 10.h,

View File

@ -6,7 +6,7 @@ import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiverCell.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendReceiver/massSendReceiver_logic.dart';
import 'package:star_lock/tools/advancedFunctionHandle.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/translations/trans_lib.dart';
@ -61,7 +61,7 @@ class _MassSendReceiverPageState extends State<MassSendReceiverPage> {
children: [
Obx(() => Visibility(
visible: state.isVip.value ? false : true,
child: AdvancedFunctionHandle()
child: ShowCupertinoAlertView()
.topTipsAdvancedFeatures('开通高级功能后才可以选择和添加接收者'.tr))),
Obx(() => Visibility(
visible: state.isVip.value ? true : false,

View File

@ -5,6 +5,7 @@ import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import 'package:star_lock/tools/dateTool.dart';
@ -33,7 +34,6 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
return;
}
//
var startDate = "0";
var endDate = "0";
var startTime = "0";
@ -91,6 +91,50 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
}
String getKeyType = typeValue.toString();
//
if (state.isAuthentication.value == true) {
if (state.realNameController.text.isEmpty) {
showToast("请输入真实姓名".tr);
return;
}
if (state.idCardController.text.isEmpty) {
showToast("请输入身份证号".tr);
return;
}
//
ShowCupertinoAlertView().realNameIDCardInfoComfirmAlert(
getNameStr: state.realNameController.text,
getIDCardStr: state.idCardController.text,
onConfirm: () {
goSendElectronicKey(
startDate: startDate,
endDate: endDate,
startTime: startTime,
endTime: endTime,
typeValue: typeValue,
getKeyType: getKeyType);
});
} else {
goSendElectronicKey(
startDate: startDate,
endDate: endDate,
startTime: startTime,
endTime: endTime,
typeValue: typeValue,
getKeyType: getKeyType);
}
}
//
Future<void> goSendElectronicKey({
required String startDate,
required String endDate,
required String startTime,
required String endTime,
required int typeValue,
required String getKeyType,
}) async {
var entity = await ApiRepository.to.sendElectronicKey(
createUser: state.isCreateUser == true ? "1" : "0",
countryCode: state.countryCode,

View File

@ -326,7 +326,7 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
),
),
SubmitBtn(
btnName: TranslationLoader.lanKeys!.send!.tr,
btnName: '发送'.tr,
onClick: () {
if (logic.state.isDemoMode == false) {
logic.sendElectronicKeyRequest();
@ -545,14 +545,16 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value:
isRemote ? logic.state.isRemoteUnlock : logic.state.isAuthentication,
value: isRemote
? logic.state.isRemoteUnlock
: logic.state.isAuthentication.value,
onChanged: (value) {
if (isRemote) {
logic.state.isRemoteUnlock = !logic.state.isRemoteUnlock;
} else {
logic.state.isAuthentication = !logic.state.isAuthentication;
if (logic.state.isAuthentication) {
logic.state.isAuthentication.value =
!logic.state.isAuthentication.value;
if (logic.state.isAuthentication.value == true) {
logic.keyCheckFace();
} else {
logic.state.isRequireAuth.value = false;

View File

@ -14,7 +14,7 @@ class SendElectronicKeyViewState {
late Contact contact;
bool isRemoteUnlock = false; //
bool isAuthentication = false; //
var isAuthentication = false.obs; //
var timeLimitBeginTime = DateTool().dateToYMDHNString(
DateTime.now().millisecondsSinceEpoch.toString()); //

View File

@ -4,7 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/messageWarn/addFamily/addFamily_logic.dart';
import 'package:star_lock/tools/advancedFunctionHandle.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/showTFView.dart';
import 'package:star_lock/tools/storage.dart';
@ -125,7 +125,7 @@ class _AddFamilyPageState extends State<AddFamilyPage> {
logic.addLockNoticeSetting();
}
} else {
AdvancedFunctionHandle().advancedFeatureAlert();
ShowCupertinoAlertView().advancedFeatureAlert();
}
},
)),

View File

@ -3,7 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/coerceOpenDoor/coerceFingerprint/coerceFingerprint_logic.dart';
import 'package:star_lock/tools/advancedFunctionHandle.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/tools/submitBtn.dart';
@ -118,7 +118,7 @@ class _CoerceFingerprintPageState extends State<CoerceFingerprintPage> {
logic.addLockNoticeSetting();
}
} else {
AdvancedFunctionHandle().advancedFeatureAlert();
ShowCupertinoAlertView().advancedFeatureAlert();
}
},
)),

View File

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/tools/advancedFunctionHandle.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/storage.dart';
import 'package:star_lock/tools/submitBtn.dart';
@ -118,7 +118,7 @@ class _LowBatteryReminderPageState extends State<LowBatteryReminderPage> {
onClick: () async {
var isVip = await Storage.getBool(saveIsVip);
if (isVip == false) {
AdvancedFunctionHandle().advancedFeatureAlert();
ShowCupertinoAlertView().advancedFeatureAlert();
} else {
logic.lockNoticeSettingAccountList();
}

View File

@ -4,7 +4,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/messageWarn/msgNotification/msgNotification/msgNotification_entity.dart';
import 'package:star_lock/tools/advancedFunctionHandle.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/commonItem.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/style/default_style.dart';
@ -69,7 +69,7 @@ class _NDaysUnopenedPageState extends State<NDaysUnopenedPage> {
onClick: () async {
var isVip = await Storage.getBool(saveIsVip);
if (isVip == false) {
AdvancedFunctionHandle().advancedFeatureAlert();
ShowCupertinoAlertView().advancedFeatureAlert();
} else {
logic.lockNoticeSettingAccountList();
}

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import 'package:star_lock/tools/advancedFunctionHandle.dart';
import 'package:star_lock/tools/showCupertinoAlertView.dart';
import 'package:star_lock/tools/noData.dart';
import '../../../../../../app_settings/app_colors.dart';
@ -36,7 +36,7 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
children: [
Obx(() => Visibility(
visible: state.isVip.value ? false : true,
child: AdvancedFunctionHandle()
child: ShowCupertinoAlertView()
.topTipsAdvancedFeatures('开通高级功能后才可以对锁进行管理'.tr))),
Container(
margin: EdgeInsets.all(15.w),

View File

@ -221,6 +221,7 @@ abstract class Api {
final String getFaceCertifyIdURL = '/service/getCertifyId'; //certifyId
final String getServiceCheckCertifyURL =
'/service/checkCertify'; //certifyId是否完成认证
final String updateRealNameInfoURL = '/key/updateRealName'; //
final String getBuyRecordListURL = '/v2/service/getBuyRecordList'; //
final String getUseRecordListURL = '/v2/service/getUseRecordList'; //使

View File

@ -236,6 +236,26 @@ class ApiProvider extends BaseProvider {
'remoteEnable': remoteEnable,
}));
//
Future<Response> updateRealNameInfo(
int lockId,
int keyId,
int uid,
int faceAuthentication,
String realName,
String idCardNumber,
) =>
post(
updateRealNameInfoURL.toUrl,
jsonEncode({
'lockId': lockId,
'keyId': keyId,
'uid': uid,
'faceAuthentication': faceAuthentication,
'realName': realName,
'idCardNumber': idCardNumber,
}));
Future<Response> resetElectronicKey(String lockId, String operatorUid) =>
post(resetElectronicKeyURL.toUrl,
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));

View File

@ -385,6 +385,19 @@ class ApiRepository {
return KeyOperationRecordEntity.fromJson(res.body);
}
//
Future<KeyOperationRecordEntity> updateRealNameInfo(
{required int lockId,
required int keyId,
required int uid,
required int faceAuthentication,
required String realName,
required String idCardNumber}) async {
final res = await apiProvider.updateRealNameInfo(
lockId, keyId, uid, faceAuthentication, realName, idCardNumber);
return KeyOperationRecordEntity.fromJson(res.body);
}
//
Future<PasswordKeyListEntity> passwordKeyList(String keyStatus, String lockId,
String pageNo, String pageSize, String searchStr) async {

View File

@ -1,88 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_colors.dart';
class AdvancedFunctionHandle {
//
void advancedFeatureAlert() {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: Container(
margin: EdgeInsets.only(bottom: 20.h),
child: Image.asset(
'images/icon_gift.png',
width: 50.w,
height: 50.w,
),
),
content: Text('该功能是高级功能,请开通后再使用'.tr),
actions: [
CupertinoDialogAction(
child: Text(
'取消'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child: Text(
'去开通'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () async {
Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: {'isShop': true});
},
),
],
);
});
}
//
Widget topTipsAdvancedFeatures(String tipsText) {
return Container(
color: AppColors.vipFeatureBgColor,
padding: EdgeInsets.only(left: 20.w),
height: 80.h,
child: Row(
children: [
Text(tipsText,
style: TextStyle(
color: AppColors.vipFeatureBtnTextColor, fontSize: 22.sp)),
SizedBox(
width: 10.w,
),
SizedBox(
width: 146.w,
height: 46.h,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.vipFeatureBtnBgColor,
),
onPressed: () {
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
'isShop': true,
});
},
child: Text(
'去开通'.tr,
style: TextStyle(color: Colors.white, fontSize: 22.sp),
)),
),
Expanded(
child: SizedBox(
width: 2.w,
))
],
),
);
}
}

View File

@ -1,56 +0,0 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
// future
//primaryColor
Future<bool> showCupertinoAlert({
BuildContext? context, //context
String title = '',
String message = '',
confirmText = '确定',
cancelText = '取消',
isShowCancel = true,
isDestructiveConfirm = false,
isDestructiveCancel = false,
}) {
// context = context ?? DialogConfig.context;
final completer = Completer<bool>();
final actions = <CupertinoDialogAction>[
CupertinoDialogAction(
isDestructiveAction: isDestructiveConfirm,
onPressed: () {
completer.complete(true);
Navigator.of(context!).pop();
},
child: Text(confirmText),
),
];
if (isShowCancel) {
actions.insert(
0,
CupertinoDialogAction(
isDestructiveAction: isDestructiveCancel,
onPressed: () {
completer.complete(false);
Navigator.of(context!).pop();
},
child: Text(
cancelText,
),
),
);
}
// showCupertinoModalPopup<void>(
// context: context,
// barrierDismissible: false,
// builder: (BuildContext context) => CupertinoAlertDialog(
// title: Text(title),
// content: Padding(
// padding: const EdgeInsets.only(top: 10),
// child: Text(message),
// ),
// actions: actions,
// ),
// );
return completer.future;
}

View File

@ -0,0 +1,223 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_colors.dart';
typedef AuthInfoCallback = void Function(String idCard, String name);
class ShowCupertinoAlertView {
//
void advancedFeatureAlert() {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: Container(
margin: EdgeInsets.only(bottom: 20.h),
child: Image.asset(
'images/icon_gift.png',
width: 50.w,
height: 50.w,
),
),
content: Text('该功能是高级功能,请开通后再使用'.tr),
actions: [
CupertinoDialogAction(
child: Text(
'取消'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child: Text(
'去开通'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () async {
Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: {'isShop': true});
},
),
],
);
});
}
//
Widget topTipsAdvancedFeatures(String tipsText) {
return Container(
color: AppColors.vipFeatureBgColor,
padding: EdgeInsets.only(left: 20.w),
height: 80.h,
child: Row(
children: [
Text(tipsText,
style: TextStyle(
color: AppColors.vipFeatureBtnTextColor, fontSize: 22.sp)),
SizedBox(
width: 10.w,
),
SizedBox(
width: 146.w,
height: 46.h,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.vipFeatureBtnBgColor,
),
onPressed: () {
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
'isShop': true,
});
},
child: Text(
'去开通'.tr,
style: TextStyle(color: Colors.white, fontSize: 22.sp),
)),
),
Expanded(
child: SizedBox(
width: 2.w,
))
],
),
);
}
//
void realNameIDCardInfoComfirmAlert(
{required String getNameStr,
required String getIDCardStr,
required VoidCallback onConfirm}) {
showCupertinoDialog(
context: Get.context!,
builder: (context) {
return CupertinoAlertDialog(
title: Text('请确认姓名全名和身份证号码是否正确'.tr),
content: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10.h,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
'姓名 ',
style: TextStyle(fontSize: 22.sp, color: Colors.black),
),
Text(
'身份证',
style: TextStyle(fontSize: 22.sp, color: Colors.black),
)
],
),
SizedBox(
width: 10.w,
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
getNameStr,
style: TextStyle(fontSize: 22.sp, color: Colors.black),
),
Text(
getIDCardStr,
style: TextStyle(fontSize: 22.sp, color: Colors.black),
)
],
)
],
),
actions: [
CupertinoDialogAction(
child: Text(
'取消'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child: Text(
'确定'.tr,
style: TextStyle(color: AppColors.mainColor),
),
onPressed: () async {
//
onConfirm();
Get.back();
},
),
],
);
});
}
//
void showOpenAuthWithIDCardInfoAlert(AuthInfoCallback callback) {
showCupertinoDialog(
context: Get.context!,
builder: (BuildContext context) {
String idCard = '';
String name = '';
return CupertinoAlertDialog(
title: const Text('请输入身份证号和真实姓名'),
content: Column(
children: <Widget>[
SizedBox(
height: 10.h,
),
CupertinoTextField(
placeholder: '请输入身份证号',
onChanged: (value) {
idCard = value;
},
),
SizedBox(
height: 10.h,
),
CupertinoTextField(
placeholder: '请输入真实姓名',
onChanged: (value) {
name = value;
},
),
],
),
actions: <Widget>[
CupertinoDialogAction(
onPressed: () {
Get.back();
},
child: Text(
'取消'.tr,
style: TextStyle(color: AppColors.mainColor),
),
),
CupertinoDialogAction(
onPressed: () {
//
callback(idCard, name);
Get.back();
},
child: Text(
'确定'.tr,
style: TextStyle(color: AppColors.mainColor),
),
),
],
);
},
);
}
}

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import '../translations/trans_lib.dart';
@ -70,10 +71,8 @@ class ShowTFView extends StatelessWidget {
),
actions: <Widget>[
CupertinoDialogAction(
child: Text(
leftBtnTitle ?? TranslationLoader.lanKeys!.cancel!.tr,
style: const TextStyle(color: Colors.black),
),
child: Text(leftBtnTitle ?? TranslationLoader.lanKeys!.cancel!.tr,
style: TextStyle(color: AppColors.mainColor)),
onPressed: () {
// Navigator.pop(context);
if (cancelClick != null) {
@ -82,9 +81,8 @@ class ShowTFView extends StatelessWidget {
},
),
CupertinoDialogAction(
child: Text(
rightBtnTitle ?? TranslationLoader.lanKeys!.sure!.tr,
style: const TextStyle(color: Colors.black)),
child: Text(rightBtnTitle ?? TranslationLoader.lanKeys!.sure!.tr,
style: TextStyle(color: AppColors.mainColor)),
onPressed: () {
if (sureClick != null) {
sureClick!();