diff --git a/star_lock/ios/Podfile.lock b/star_lock/ios/Podfile.lock index 485df03f..a5ddc949 100644 --- a/star_lock/ios/Podfile.lock +++ b/star_lock/ios/Podfile.lock @@ -322,7 +322,7 @@ SPEC CHECKSUMS: flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907 flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82 - fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db + fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265 fluwx: daa284756ce53442b3d0417ceeda66e981906811 google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458 GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4 @@ -351,4 +351,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc -COCOAPODS: 1.15.2 +COCOAPODS: 1.14.3 diff --git a/star_lock/lib/blue/blue_manage.dart b/star_lock/lib/blue/blue_manage.dart index 08c5d768..b5027d9b 100644 --- a/star_lock/lib/blue/blue_manage.dart +++ b/star_lock/lib/blue/blue_manage.dart @@ -282,14 +282,17 @@ class BlueManage { } // String listStr = scanDevices - // // .where((element) => - // // element.advertisementData.advName == 'TMH_dc8f928369ed') + // .where((element) => + // element.advertisementData.advName == 'TMH_dc8f928369ed' || + // element.device.platformName == 'TMH_dc8f928369ed') // .map((e) => 'advName:${e.advertisementData.advName} ' // 'serviceUuids:${e.advertisementData.serviceUuids} ' // '是否被重置:${e.advertisementData.serviceUuids[0].toString()[31]}') // .join(',') // .toString(); - // AppLog.log('--->扫描到的设备 ${listStr} '); + // if (listStr.trim() != '') { + // AppLog.log('--->扫描到的设备 ${listStr} '); + // } scanDevicesCallBack(scanDevices); // EventBusManager().eventBusFir(scanDevices); @@ -354,9 +357,14 @@ class BlueManage { {bool isAddEquipment = false}) async { connectDeviceName = deviceName; List devicesList = scanDevices; - if (isAddEquipment == false) { + + bool isExistDevice = scanDevices.any((element) => + element.device.platformName == connectDeviceName || + element.advertisementData.advName == connectDeviceName); + + if (isAddEquipment == false || isExistDevice == false) { //取消缓存直接使用,存在配对场景设备信息会更变 - startScan(10, (List scanDevices) { + startScanSingle(deviceName, 10, (List scanDevices) { _connectDevice(scanDevices, deviceName, connectStateCallBack, isAddEquipment: isAddEquipment); }); diff --git a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart index 287710b0..a2e3a7d9 100644 --- a/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart +++ b/star_lock/lib/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_logic.dart @@ -228,20 +228,23 @@ class AuthorizedAdminLogic extends BaseGetXController { //检测实名认证是否支持开启 Future keyCheckFace() async { AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace( - countryCode: int.parse(state.countryCode.value), - account: state.emailOrPhoneController.text); + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + ); if (entity.errorCode!.codeIsSuccessful) { //打开实名认证,需要弹出输入身份证信息框 state.isRequireAuth.value = true; state.isAuthentication.value = true; - } else { + } else if (entity.errorCode == 432) { //432--余量不足,需购买 - ShowTipView().showBuyTipWithContentAlert( + ShowCupertinoAlertView().showBuyTipWithContentAlert( titleStr: '实名认证为付费功能,请购买后再使用'.tr, sureClick: () { Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {'isShop': false}); }); + } else if (entity.errorCode == 433) { + //需联系管理员购买 + ShowCupertinoAlertView().showContactAdministratorBuyAlert(); } } diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart index 86bb7c82..a5460d17 100644 --- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart +++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_logic.dart @@ -185,20 +185,23 @@ class SendElectronicKeyViewLogic extends BaseGetXController { //检测实名认证是否支持开启 Future keyCheckFace() async { AdvancedFunctionRecordEntity entity = await ApiRepository.to.keyCheckFace( - countryCode: int.parse(state.countryCode), - account: state.emailOrPhoneController.text); + lockId: CommonDataManage().currentKeyInfo.lockId ?? 0, + ); if (entity.errorCode!.codeIsSuccessful) { //打开实名认证,需要弹出输入身份证信息框 state.isRequireAuth.value = true; state.isAuthentication.value = true; - } else { + } else if (entity.errorCode == 432) { //432--余量不足,需购买 - ShowTipView().showBuyTipWithContentAlert( + ShowCupertinoAlertView().showBuyTipWithContentAlert( titleStr: '实名认证为付费功能,请购买后再使用'.tr, sureClick: () { Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {'isShop': false}); }); + } else if (entity.errorCode == 433) { + //需联系管理员购买 + ShowCupertinoAlertView().showContactAdministratorBuyAlert(); } } diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index e6c404a9..8e6cde2a 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -643,8 +643,8 @@ class _LockDetailPageState extends State : false, child: GestureDetector( onTap: () { - ShowCupertinoAlertView() - .isToRemoteUnLockAlert((idCard, name) { + ShowCupertinoAlertView().isToRemoteUnLockAlert( + remoteUnlockAction: () { if (state.keyInfos.value.hasGateway != 1) { logic.showToast('附近没有可用网关'); } @@ -1316,7 +1316,9 @@ class _LockDetailPageState extends State //如果需要实名认证,需认证完成,方可开锁 isNeedRealNameAuthThenOpenLock() { state.nextAuthTime.value = state.keyInfos.value.nextFaceValidateTime ?? 0; - if (state.keyInfos.value.faceAuthentication == 1 && state.nextAuthTime.value > 0 && DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) { + if (state.keyInfos.value.faceAuthentication == 1 && + state.nextAuthTime.value > 0 && + DateTool().compareTimeIsOvertime(state.nextAuthTime.value) == true) { AliyunRealNameAuthProvider( getLockInfo: state.keyInfos.value, onCertifyResultWithTime: ((bool isSuccess, int getNextAuthTime) { diff --git a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart index ada75f11..034df4a8 100644 --- a/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/star_lock/lib/main/lockMian/lockMain/lockMain_page.dart @@ -4,6 +4,7 @@ import 'package:flutter/scheduler.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; +import 'package:star_lock/blue/blue_manage.dart'; import 'package:star_lock/main/lockMian/lockList/lockList_xhj_page.dart'; import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/submitBtn.dart'; @@ -36,22 +37,21 @@ class _StarLockMainPageState extends State with BaseWidget { final logic = Get.put(LockMainLogic()); final state = Get.find().state; - Future getHttpData() async { + Future getHttpData({bool clearScanDevices = false}) async { LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData(); if (lockListInfoGroupEntity != null) { var localLockListInfoGroupEntity = lockListInfoGroupEntity; - logic.loadMainDataLogic(localLockListInfoGroupEntity).then((value) { - if (mounted) { - setState(() {}); - } - }); + await logic.loadMainDataLogic(localLockListInfoGroupEntity); + } + await logic.getStarLockInfo(); + await Future.delayed(const Duration(milliseconds: 200)); + if (clearScanDevices) { + BlueManage().scanDevices.clear(); + } + if (mounted) { + setState(() {}); } - logic.getStarLockInfo().then((LockListInfoEntity value) { - if (mounted) { - setState(() {}); - } - }); } @override @@ -237,7 +237,7 @@ class _StarLockMainPageState extends State with BaseWidget { void _initLoadDataAction() { _teamEvent = eventBus.on().listen((event) { logic.pageNo = 1; - getHttpData(); + getHttpData(clearScanDevices: event.clearScanDevices); }); } diff --git a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart index e7814662..e25a940f 100644 --- a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart +++ b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart @@ -1,4 +1,3 @@ - import 'dart:async'; import 'dart:math'; @@ -31,8 +30,10 @@ class SaveLockLogic extends BaseGetXController { // 获取解析后的数据 late StreamSubscription _replySubscription; + void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((reply) { + _replySubscription = + EventBusManager().eventBus!.on().listen((reply) { if (reply is AddUserReply && state.ifCurrentScreen.value == true) { _replyAddUserKey(reply); } @@ -81,19 +82,19 @@ class SaveLockLogic extends BaseGetXController { startDate: DateTime.now().millisecondsSinceEpoch, expireDate: 0x11223344, useCountLimit: 0xFFFF, - isRound:0, + isRound: 0, weekRound: 0, - startHour: 0, + startHour: 0, startMin: 0, endHour: 0, - endMin: 0, + endMin: 0, role: 255, password: state.adminPassword, needAuthor: 1, publicKey: publicKeyDataList, privateKey: getPrivateKeyList, token: token, - isBeforeAddUser: true); + isBeforeAddUser: true); break; default: //失败 关闭loading @@ -195,7 +196,7 @@ class SaveLockLogic extends BaseGetXController { // 添加用户 Future addUserConnectBlue() async { // 进来之后首先连接 - if(state.sureBtnState.value == 1){ + if (state.sureBtnState.value == 1) { return; } state.sureBtnState.value = 1; @@ -203,15 +204,16 @@ class SaveLockLogic extends BaseGetXController { // showTitleEasyLoading("添加锁进行中 1/2"); showEasyLoading(); // 判断超时 - showBlueConnetctToastTimer(action: (){ + showBlueConnetctToastTimer(action: () { dismissEasyLoading(); state.sureBtnState.value = 0; - if(state.ifCurrentScreen.value == true){ + if (state.ifCurrentScreen.value == true) { showBlueConnetctToast(); } }); - BlueManage().bludSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { - if (deviceConnectionState == BluetoothConnectionState.connected){ + BlueManage().bludSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState deviceConnectionState) async { + if (deviceConnectionState == BluetoothConnectionState.connected) { // 私钥 var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -226,33 +228,33 @@ class SaveLockLogic extends BaseGetXController { } IoSenderManage.senderAddUser( lockID: BlueManage().connectDeviceName, - authUserID:await Storage.getUid(), - keyID:"1", - userID:await Storage.getUid(), - openMode:1, - keyType:1, - startDate:DateTime.now().millisecondsSinceEpoch, - expireDate:0x11223344, + authUserID: await Storage.getUid(), + keyID: "1", + userID: await Storage.getUid(), + openMode: 1, + keyType: 1, + startDate: DateTime.now().millisecondsSinceEpoch, + expireDate: 0x11223344, useCountLimit: 0xFFFF, - isRound:0, + isRound: 0, weekRound: 0, - startHour: 0, + startHour: 0, startMin: 0, endHour: 0, - endMin: 0, - role:255, - password:state.adminPassword, - needAuthor:1, - publicKey:publicKeyDataList, - privateKey:getPrivateKeyList, + endMin: 0, + role: 255, + password: state.adminPassword, + needAuthor: 1, + publicKey: publicKeyDataList, + privateKey: getPrivateKeyList, token: getTokenList, - isBeforeAddUser: true - ); - } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { + isBeforeAddUser: true); + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { dismissEasyLoading(); cancelBlueConnetctToastTimer(); state.sureBtnState.value = 0; - if(state.ifCurrentScreen.value == true){ + if (state.ifCurrentScreen.value == true) { showBlueConnetctToast(); } } @@ -352,7 +354,7 @@ class SaveLockLogic extends BaseGetXController { // }, isAddEquipment: true); // } - void bindBlueAdmin() async{ + void bindBlueAdmin() async { state.lockInfo["adminPwd"] = state.adminPassword; var positionMap = {}; @@ -402,7 +404,7 @@ class SaveLockLogic extends BaseGetXController { // BlueManage().disconnect(BlueManage().connectDeviceMacAddress); // eventBus.fire(RefreshLockListInfoDataEvent()); // Get.close(state.isFromMap == 1 ? 5 : 6); - }else{ + } else { state.sureBtnState.value = 0; } } @@ -457,8 +459,8 @@ class SaveLockLogic extends BaseGetXController { // ); // } - void backAction(){ - eventBus.fire(RefreshLockListInfoDataEvent()); + void backAction() { + eventBus.fire(RefreshLockListInfoDataEvent(clearScanDevices: true)); BlueManage().disconnect(); Get.close(state.isFromMap == 1 ? 5 : 6); } @@ -475,7 +477,6 @@ class SaveLockLogic extends BaseGetXController { void onInit() { // TODO: implement onInit super.onInit(); - } @override @@ -484,5 +485,4 @@ class SaveLockLogic extends BaseGetXController { _replySubscription.cancel(); super.onClose(); } - } diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart index 9a9e93a0..c2182fa6 100644 --- a/star_lock/lib/network/api_provider.dart +++ b/star_lock/lib/network/api_provider.dart @@ -184,8 +184,7 @@ class ApiProvider extends BaseProvider { 'electricQuantityStandby': electricQuantityStandby, 'lockId': lockId, }), - isUnShowLoading: isUnShowLoading - ); + isUnShowLoading: isUnShowLoading); Future modifyKeyName( String keyId, @@ -265,17 +264,17 @@ class ApiProvider extends BaseProvider { Future lockRecordList( {required String lockId, - required String pageNo, - required String recordType, - required String searchStr, - required String startDate, - required String endDate, - required String keyboardPwdId, - required String cardId, - required String fingerprintId, - required String keyId, - required String faceId, - required String pageSize}) => + required String pageNo, + required String recordType, + required String searchStr, + required String startDate, + required String endDate, + required String keyboardPwdId, + required String cardId, + required String fingerprintId, + required String keyId, + required String faceId, + required String pageSize}) => post( keyOperationRecordURL.toUrl, jsonEncode({ @@ -809,10 +808,8 @@ class ApiProvider extends BaseProvider { })); // 获取服务器当前时间 - Future getServerDatetimeLoadData() => post( - getServerDatetimeUrl.toUrl, - jsonEncode({}), - isUnShowLoading: true); + Future getServerDatetimeLoadData() => + post(getServerDatetimeUrl.toUrl, jsonEncode({}), isUnShowLoading: true); // 锁诊断 Future setLockDiagnoseData( @@ -1611,12 +1608,12 @@ class ApiProvider extends BaseProvider { post(getUserInfoURL.toUrl, jsonEncode({'operatorUid': operatorUid})); // 重置密码钥匙 - Future keyboardPwdReset(String lockId, List passwordKey) => - post(keyboardPwdResetURL.toUrl, - jsonEncode({ - 'lockId': lockId, - 'passwordKey': passwordKey, - })); + Future keyboardPwdReset(String lockId, List passwordKey) => post( + keyboardPwdResetURL.toUrl, + jsonEncode({ + 'lockId': lockId, + 'passwordKey': passwordKey, + })); //登陆后可使用获取验证码,免图片滑动验证 Future sendValidationCodeAuth(String countryCode, String account, @@ -2042,14 +2039,12 @@ class ApiProvider extends BaseProvider { // 检测实名认证是否支持开启 Future keyCheckFace( - int countryCode, - String account, + int lockId, ) => post( isFaceAuthenticationURL.toUrl, jsonEncode({ - 'countryCode': countryCode, - 'account': account, + 'lockId': lockId, })); // 获取人脸认证certifyId diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart index 6ad25392..9288b3c8 100644 --- a/star_lock/lib/network/api_repository.dart +++ b/star_lock/lib/network/api_repository.dart @@ -219,19 +219,19 @@ class ApiRepository { //钥匙详情-操作记录 Future lockRecordList({ - required String lockId, - required String pageNo, - required String recordType, - required String searchStr, - required String startDate, - required String endDate, - required String keyboardPwdId, - required String cardId, - required String fingerprintId, - required String keyId, - required String faceId, - required String pageSize, - }) async { + required String lockId, + required String pageNo, + required String recordType, + required String searchStr, + required String startDate, + required String endDate, + required String keyboardPwdId, + required String cardId, + required String fingerprintId, + required String keyId, + required String faceId, + required String pageSize, + }) async { final res = await apiProvider.lockRecordList( lockId: lockId, pageNo: pageNo, @@ -323,9 +323,9 @@ class ApiRepository { //锁电量更新 Future uploadElectricQuantity( {required String? electricQuantity, - required String? electricQuantityStandby, - required String? lockId, - required bool? isUnShowLoading}) async { + required String? electricQuantityStandby, + required String? lockId, + required bool? isUnShowLoading}) async { final res = await apiProvider.uploadElectricQuantity( electricQuantity!, electricQuantityStandby!, lockId!, isUnShowLoading!); return KeyOperationRecordEntity.fromJson(res.body); @@ -2075,10 +2075,9 @@ class ApiRepository { // 检测实名认证是否支持开启 Future keyCheckFace({ - required int countryCode, - required String account, + required int lockId, }) async { - final res = await apiProvider.keyCheckFace(countryCode, account); + final res = await apiProvider.keyCheckFace(lockId); return AdvancedFunctionRecordEntity.fromJson(res.body); } diff --git a/star_lock/lib/tools/eventBusEventManage.dart b/star_lock/lib/tools/eventBusEventManage.dart index d77d5c48..99ed2e1a 100644 --- a/star_lock/lib/tools/eventBusEventManage.dart +++ b/star_lock/lib/tools/eventBusEventManage.dart @@ -7,13 +7,17 @@ EventBus eventBus = EventBus(); /// 刷新锁列表数据 class RefreshLockListInfoDataEvent { - RefreshLockListInfoDataEvent(); + //是否清除蓝牙设备列表缓存 + bool clearScanDevices; + + RefreshLockListInfoDataEvent({this.clearScanDevices = false}); } /// 蓝牙添加用户成功 class LockAddUserSucceedEvent { int type; // 0用户号更新成功 1token失效 List dataList; + LockAddUserSucceedEvent(this.dataList, this.type); } @@ -40,6 +44,7 @@ class RefreshCheckInListEvent { /// 传递当前锁信息 class PassCurrentLockInformationEvent { LockSetInfoData lockSetInfoData; + PassCurrentLockInformationEvent(this.lockSetInfoData); } @@ -51,12 +56,14 @@ class OtherTypeRefreshListEvent { /// 考情添加员工卡、指纹之后回调卡、指纹number class ChickInAddStaffCardAndFingerprintBlockNumberEvent { String number; + ChickInAddStaffCardAndFingerprintBlockNumberEvent(this.number); } /// 多语言 切换之后传值到上一级界面 class ChangeLanguageBlockLastLanguageEvent { String languageTitle; + ChangeLanguageBlockLastLanguageEvent(this.languageTitle); } @@ -69,36 +76,42 @@ class LockGroupEditGroupLockRefreshEvent { class LockSetChangeSetRefreshLockDetailWithType { int type; // 0 考勤 1开锁时是否需联网 2常开模式 3修改了锁名字 4修改了电量 5远程开锁 String setResult; + LockSetChangeSetRefreshLockDetailWithType(this.type, this.setResult); } /// 获取到视频流数据然后刷新界面 class GetTVDataRefreshUI { List tvList; + GetTVDataRefreshUI(this.tvList); } /// 获取到UDP接收状态然后刷新界面 class GetUDPStatusRefreshUI { int udpStatus; + GetUDPStatusRefreshUI(this.udpStatus); } /// 获取到UDP接收状态然后刷新监控界面 class GetUDPStatusMonitorUI { int udpStatus; + GetUDPStatusMonitorUI(this.udpStatus); } /// 获取到第一帧图片数据后跳转 class GetFirstFrameGoPush { bool isFirstFrame; + GetFirstFrameGoPush(this.isFirstFrame); } /// 获取到实时点击的密码类型更新typeIndex class GetPasswordTypeUpdateIndex { int passwordType; + GetPasswordTypeUpdateIndex(this.passwordType); } @@ -125,6 +138,7 @@ class AuthorizedAdminPageRefreshUI { /// 刷新门锁日志列表 class DoorLockLogListRefreshUI { DateTime getDoorLockLogTime; + DoorLockLogListRefreshUI(this.getDoorLockLogTime); } @@ -141,4 +155,4 @@ class AuthorizedAdministratorListPageRefreshUI { /// 个人信息修改时刷新我的界面的头像昵称等 class MineInfoChangeRefreshUI { MineInfoChangeRefreshUI(); -} \ No newline at end of file +} diff --git a/star_lock/lib/tools/showCupertinoAlertView.dart b/star_lock/lib/tools/showCupertinoAlertView.dart index ddca72fd..dd9f7336 100644 --- a/star_lock/lib/tools/showCupertinoAlertView.dart +++ b/star_lock/lib/tools/showCupertinoAlertView.dart @@ -276,7 +276,7 @@ class ShowCupertinoAlertView { } //是否要远程开锁弹窗 - void isToRemoteUnLockAlert(AuthInfoCallback callback) { + void isToRemoteUnLockAlert({required Function remoteUnlockAction}) { showCupertinoDialog( context: Get.context!, builder: (BuildContext context) { @@ -296,7 +296,7 @@ class ShowCupertinoAlertView { CupertinoDialogAction( onPressed: () { // 在这里处理确认按钮的逻辑 - callback(null, null); + remoteUnlockAction(); Get.back(); }, child: Text( @@ -309,4 +309,59 @@ class ShowCupertinoAlertView { }, ); } + + // 购买按钮 + void showBuyTipWithContentAlert( + {required String titleStr, required Function sureClick}) { + showCupertinoDialog( + context: Get.context!, + builder: (context) { + return CupertinoAlertDialog( + title: Text(titleStr), + actions: [ + CupertinoDialogAction( + child: Text( + '取消'.tr, + style: TextStyle(color: AppColors.mainColor), + ), + onPressed: () { + Get.back(); + }, + ), + CupertinoDialogAction( + child: + Text('购买'.tr, style: TextStyle(color: AppColors.mainColor)), + onPressed: () { + Get.back(); + sureClick(); + }, + ), + ], + ); + }, + ); + } + + // 联系管理员购买 + void showContactAdministratorBuyAlert() { + showCupertinoDialog( + context: Get.context!, + builder: (context) { + return CupertinoAlertDialog( + title: const Text('实名认证为付费功能,请联系锁的管理员购买后再使用'), + actions: [ + CupertinoDialogAction( + child: Text( + '确定'.tr, + style: TextStyle(color: AppColors.mainColor), + ), + onPressed: () { + Get.back(); + }, + ), + ], + ); + }, + ); + } } diff --git a/star_lock/lib/tools/showTipView.dart b/star_lock/lib/tools/showTipView.dart index 24110458..40ca6fad 100644 --- a/star_lock/lib/tools/showTipView.dart +++ b/star_lock/lib/tools/showTipView.dart @@ -122,36 +122,4 @@ class ShowTipView { }, ); } - - // 购买按钮 - void showBuyTipWithContentAlert( - {required String titleStr, required Function sureClick}) { - showCupertinoDialog( - context: Get.context!, - builder: (context) { - return CupertinoAlertDialog( - title: Text(titleStr), - actions: [ - CupertinoDialogAction( - child: Text( - '取消'.tr, - style: TextStyle(color: AppColors.mainColor), - ), - onPressed: () { - Get.back(); - }, - ), - CupertinoDialogAction( - child: - Text('购买'.tr, style: TextStyle(color: AppColors.mainColor)), - onPressed: () { - Get.back(); - sureClick(); - }, - ), - ], - ); - }, - ); - } }