diff --git a/lan/lan_en.json b/lan/lan_en.json index fbc10bee..eb5fb534 100755 --- a/lan/lan_en.json +++ b/lan/lan_en.json @@ -830,5 +830,7 @@ "掌静脉详情": "Palm vein details", "掌静脉号": "Palm vein number", "蓝牙未打开,请到设置里面打开蓝牙": "Bluetooth is not turned on, please turn on Bluetooth in the settings", - "删除用户时,会将用户拥有的钥匙一起删除。": "When deleting a user, the keys owned by the user will be deleted together." + "删除用户时,会将用户拥有的钥匙一起删除。": "When deleting a user, the keys owned by the user will be deleted together.", + + "配置网络": "Configure network" } diff --git a/lan/lan_keys.json b/lan/lan_keys.json index 709cb5d0..d1d433a9 100755 --- a/lan/lan_keys.json +++ b/lan/lan_keys.json @@ -859,5 +859,7 @@ "掌静脉详情": "掌静脉详情", "掌静脉号": "掌静脉号", "蓝牙未打开,请到设置里面打开蓝牙": "蓝牙未打开,请到设置里面打开蓝牙", - "删除用户时,会将用户拥有的钥匙一起删除。": "删除用户时,会将用户拥有的钥匙一起删除。" + "删除用户时,会将用户拥有的钥匙一起删除。": "删除用户时,会将用户拥有的钥匙一起删除。", + + "配置网络": "配置网络" } diff --git a/lan/lan_zh.json b/lan/lan_zh.json index 7826f26d..63f913c6 100755 --- a/lan/lan_zh.json +++ b/lan/lan_zh.json @@ -104,7 +104,6 @@ "未打卡": "未打卡", "假日信息": "假日信息", -<<<<<<< HEAD "基本信息": "基本信息", "无线键盘": "无线键盘", "选择无线键盘": "选择无线键盘", @@ -202,174 +201,7 @@ "请输入昵称": "请输入昵称", "修改昵称": "修改昵称", "修改账号": "修改账号", -======= - "accountNumber": "账号", - "volumeAuthorizationLock": "批量授权锁", - "authorizedAdminTip": "授权管理员拥有操作这把锁的重要权限,请确保只发给我你信任的人", - "lockOperatingRecordTip": "如果您需要保留历史记录,可以在右上角导出", - "rankingList": "排列榜", - "earlyArrivalList": "早到榜", - "lateList": "迟到榜", - "hardWorkingList": "勤奋榜", - "company": "公司", - "staff": "员工", - "work": "工作", - "workday": "工作日", - "holidays": "节假日", - "punchingMode": "打卡方式", - "whetherTheEmployeeHasAKey": "员工是否有钥匙", - "selectKey": "选择钥匙", - "officeHours": "上班时间", - "closingTime": "下班时间", - "thisWeek": "本周", - "singleDayWeekend": "单休", - "twoDaysOff": "双休", - "oddOrEvenDaysOff": "单双休", - "year": "年", - "month": "月", - "libertyDay": "放假日期", - "coverDate": "补班日期", - "addedHoliday": "添加假日", - "startDate": "开始日期", - "accessDate": "接入日期", - "mustFillIn": "必填", - "endDate": "结束日期", - "dailyCharts": "日榜", - "monthlyLeaderboard": "月榜", - "noAttendanceRecord": "无考勤记录", - "attendanceRecord": "考勤记录", - "everyoneIsVeryMotivated": "大家干劲十足", - "workingHoursWereNotReleased": "工作时长未出炉", - "beLate": "迟到", - "leaveEarly": "早退", - "noCardPunched": "未打卡", - "holidayInfo": "假日信息", - "basicInformation": "基本信息", - "wirelessKeyboard": "无线键盘", - "doorMagnetic": "门磁", - "remoteUnlocking": "远程开锁", - "automaticBlocking": "自动闭锁", - "normallyOpenMode": "常开模式", - "automaticUnLock": "自动开锁", - "automaticUnLockTip": "开启后锁将在常开模式开始时自动打开", - "lockSound": "锁声音", - "burglarAlarm": "防撬报警", - "resetButton": "重置键", - "lockTime": "锁时间", - "diagnose": "诊断", - "uploadData": "上传数据", - "importOtherLockData": "导入其他锁数据", - "lockEscalation": "锁升级", - "markedHouseState": "标记房态", - "unlockReminder": "开锁提醒", - "unlockQRCode": "微信二维码", - "lockNumber": "锁编号", - "electricQuantity": "电量", - "lockName": "名称", - "lockGrouping": "锁分组", - "selectGroup": "选择分组", - "createNewGroup": "创建新分组", - "adminOpenLockPassword": "管理员开锁密码", - "update": "更新", - "updateElectricQuantityTip": "电量信息可以通过网关远程更新,或通过手机蓝牙在锁旁边更新", - "adminOpenLockPasswordTip": "如果你在锁上修改过密码,锁内实际有效密码与这里显示的可能不同", - "updateLockAdminPassword": "上传锁内管理员密码", - "whenScreenFlashesClickNext": "当屏幕闪烁时,点击下一步", - "theScreenNeverFlickered": "屏幕一直没有闪烁", - "enterNumberOrPressSet": "输入*529#或按设置键", - "theLocationOfTheSetKeyWillBeDifferent": "设置键的位置会有差异", - "pressAndHoldTheResetButtonTwoSeconds": "长按重置键2秒", - "nearbyEquipment": "附近的设备", - "noData": "暂无数据", - "doorMagneticListTopTip": "通过门磁可查询门的开、关状态。每把锁咳添加一个门磁", - "remoteUnlockingPageTip": "功能开启后,你将可以通过网关远程开锁。此功能的开启和关闭只能在锁附近通过手机蓝牙进行。", - "currentMode": "当前模式", - "delayTime": "延迟时间", - "automaticBlockingTip": "经过以上设定的时间,锁会自动关闭。开启或修改设置后,请先开一次锁,使时间生效。", - "time": "时间", - "normallyOpen": "常开", - "date": "日期", - "begin": "开始", - "end": "结束", - "allDay": "全天", - "save": "保存", - "normallyOpenModeTip": "在设置的常开时间内,锁被打开后将一直处于打开的状态,直到被手动关闭", - "pleaseSelectLockVolume": "请选择锁音量", - "lockSoundTip": "功能开启后,你将可以听到智能锁的提示音。包括电量过低,密码错误等提示。", - "low": "低", - "lower": "较低", - "medium": "中", - "higher": "较高", - "high": "高", - "burglarAlarmTip": "开启后,锁被撬动时,会发出报警声", - "resetButtonTip1": "开启后,可通过长按锁上的重置键来用APP重新添加", - "resetButtonTip2": "关闭后,重置键无效,锁要通过app删除后才能重新添加", - "calibrationTime": "校准时间", - "setTheDSTMode": "夏令时模式设置", - "diagnoseTip": "诊断是读取锁内的配置信息并上传,以便工作人员分析故障的原因", - "uploading": "上传", - "uploadDataTip": "本操作将上传锁内数据到服务器,过程可能需要几分钟,请耐心等待", - "importOtherLockDataTip": "请选择要从哪把锁导入", - "haveNewVersion": "有新版本", - "currentVersion": "当前版本", - "newVersion": "新版本", - "upgrade": "升级", - "leisure": "空闲", - "checkedIn": "已入住", - "lanEnglish": "英文", - "lanChinese": "中文", - "multilingual": "多语言", - "addLock": "添加锁", - "lockAddress": "锁地址", - "selectLockType": "选择锁类型", - "videoIntercomDoorLock": "可视对讲门锁", - "NFCPassiveLock": "NFC无源锁", - "addDevice": "添加设备", - "gateway": "网关", - "message": "消息", - "supportStaff": "客服", - "set": "设置", - "moreServices": "更多服务", - "moreSet": "更多设置", - "prompTone": "提示音", - "touchUnlock": "触摸开锁", - "pushNotification": "消息推送", - "lockUserManagement": "锁用户管理", - "ownedKey": "拥有的钥匙", - "authorityManagement": "批量授权", - "associatedDevice": "关联设备", - "associatedName": "关联姓名", - "device": "设备", - "authorizedAdmin": "授权管理员", - "addAuthorizedAdmin": "添加授权管理员", - "lockGroup": "锁分组", - "transferSmartLock": "转移智能锁", - "selectiveLock": "选择锁", - "recipientInformation": "接收人信息", - "transferGateway": "转移网关", - "multiLanguage": "多语言", - "lockScreen": "锁屏", - "closed": "已关闭", - "opened": "已开启", - "close": "关闭", - "open": "开启", - "hideInvalidUnlockPermissions": "隐藏无效开锁权限", - "appUnlockRequiresMobilePhoneAccessToTheLock": "APP开锁时需手机连网的锁", - "valueAddedServices": "增值服务", - "about": "关于", - "userAgreement": "用户协议", - "privacyPolicy": "隐私政策", - "personalInformationCollectionList": "个人信息收集清单", - "applicationPermissionDescription": "应用权限说明", - "thirdPartyInformationSharingList": "第三方信息共享清单", - "logout": "退出", - "deleteAccount": "删除账号", - "personalInformation": "个人信息", - "avatar": "头像", - "nickName": "昵称", - "changeNickName": "修改昵称", - "modifyAccount": "修改账号", ->>>>>>> release + "重置密码": "重置密码", "安全问题": "安全问题", "为了你的账号安全,修改账号前请先使用验证码验证": "为了你的账号安全,修改账号前请先使用验证码验证", @@ -993,6 +825,7 @@ "掌静脉详情": "掌静脉详情", "掌静脉号": "掌静脉号", "蓝牙未打开,请到设置里面打开蓝牙": "蓝牙未打开,请到设置里面打开蓝牙", - "删除用户时,会将用户拥有的钥匙一起删除。": "删除用户时,会将用户拥有的钥匙一起删除。" + "删除用户时,会将用户拥有的钥匙一起删除。": "删除用户时,会将用户拥有的钥匙一起删除。", + "配置网络": "配置网络" } diff --git a/lib/main.dart b/lib/main.dart index be8484da..03ed9fbf 100755 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,6 @@ import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -20,6 +22,7 @@ import 'package:star_lock/translations/trans_lib.dart'; import 'app.dart'; import 'app_settings/app_settings.dart'; import 'tools/store_service.dart'; +import 'package:path/path.dart' as path; // 该文件不可作为编译入口,请查看 flavorizr.yaml 中的说明 FutureOr main() async { @@ -57,6 +60,8 @@ FutureOr main() async { SystemUiOverlayStyle(statusBarColor: Colors.transparent); SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle); } + + // checkChinese(); } // 设置国际化信息 @@ -87,3 +92,27 @@ Future privacySDKInitialization() async { final XSJPushProvider jpushProvider = XSJPushProvider(); await jpushProvider.initJPushService(); } + +void checkChinese(){ + // 获取当前脚本的目录 + final String scriptDir = path.dirname(Platform.script.path); + + // 遍历这个目录下的所有 .dart 文件 + findChineseCharacters(Directory(scriptDir)); +} + +void findChineseCharacters(Directory directory) { + final List files = directory.listSync(recursive: true); + for (FileSystemEntity file in files) { + if (file is File && file.path.endsWith('.dart')) { + final String content = file.readAsStringSync(encoding: utf8); + if (hasChineseCharacters(content)) { + print('Found Chinese characters in ${file.path}'); + } + } + } +} + +bool hasChineseCharacters(String input) { + return RegExp(r'[\u4e00-\u9fa5]').hasMatch(input); +} \ No newline at end of file diff --git a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart index 340ccc1b..d00eec25 100755 --- a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart +++ b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart @@ -6,6 +6,8 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; import 'package:network_info_plus/network_info_plus.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'package:star_lock/login/login/entity/LoginEntity.dart'; +import 'package:star_lock/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifiEntity.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import '../../../../../blue/blue_manage.dart'; @@ -23,19 +25,19 @@ class ConfiguringWifiLogic extends BaseGetXController{ final ConfiguringWifiState state = ConfiguringWifiState(); Future getWifiLockServiceIpAndPort() async { - var entity = await ApiRepository.to.getWifiLockServiceIpAndPort(); + final ConfiguringWifiEntity entity = await ApiRepository.to.getWifiLockServiceIpAndPort(); if(entity.errorCode! == 0){ state.configuringWifiEntity.value = entity; } } - void updateNetworkInfo() async{ - var entity = await ApiRepository.to.updateNetworkInfo( + Future updateNetworkInfo() async{ + final LoginEntity entity = await ApiRepository.to.updateNetworkInfo( lockId: state.lockSetInfoData.value.lockId!, network:state.wifiNameController.text, ); if(entity.errorCode!.codeIsSuccessful){ - showToast("配网成功", something:(){ + showToast('配网成功', something:(){ eventBus.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); Get.close(2); }); @@ -45,7 +47,7 @@ class ConfiguringWifiLogic extends BaseGetXController{ // 监听设备返回的数据 late StreamSubscription _replySubscription; void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((reply) async { + _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) async { // WIFI配网结果 if(reply is SenderConfiguringWifiReply) { _replySenderConfiguringWifi(reply); @@ -55,7 +57,7 @@ class ConfiguringWifiLogic extends BaseGetXController{ // WIFI配网结果 Future _replySenderConfiguringWifi(Reply reply) async { - int status = reply.data[5]; + final int status = reply.data[5]; switch(status){ case 0x00: @@ -67,32 +69,32 @@ class ConfiguringWifiLogic extends BaseGetXController{ break; case 0x06: //无权限 - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List publicKeyDataList = changeStringListToIntList(publicKey!); - var tokenData = reply.data.sublist(7, 10); - var saveStrList = changeIntListToStringList(tokenData); + final List tokenData = reply.data.sublist(7, 10); + final List saveStrList = changeIntListToStringList(tokenData); Storage.setStringList(saveBlueToken, saveStrList); - var serversList = []; + final List serversList = []; for(int i = 0; i itemList = item.serviceIp!.split('.'); + for (String element in itemList) { serversList.add(int.parse(element)); } - double typeDouble = int.parse(item.port!) / 256; - int type1 = typeDouble.toInt(); - int type2 = int.parse(item.port!) % 256; + final double typeDouble = int.parse(item.port!) / 256; + final int type1 = typeDouble.toInt(); + final int type2 = int.parse(item.port!) % 256; serversList.add(type1); serversList.add(type2); } - var uidList = [Storage.getUid().toString()]; + final List uidList = [Storage.getUid().toString()]; IoSenderManage.senderConfiguringWifiCommand( keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), @@ -111,7 +113,7 @@ class ConfiguringWifiLogic extends BaseGetXController{ break; case 0xff: //成功 - showToast("配网失败"); + showToast('配网失败'); break; default: //失败 @@ -122,7 +124,7 @@ class ConfiguringWifiLogic extends BaseGetXController{ // 点击配置wifi Future senderConfiguringWifiAction() async { if(state.wifiNameController.text.isEmpty){ - showToast("请输入wifi名称"); + showToast('请输入wifi名称'); return; } @@ -138,40 +140,40 @@ class ConfiguringWifiLogic extends BaseGetXController{ }); BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected){ - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List publicKeyDataList = changeStringListToIntList(publicKey!); - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); - var serversList = []; + final List serversList = []; for(int i = 0; i itemList = item.serviceIp!.split('.'); + for (String element in itemList) { serversList.add(int.parse(element)); } }else{ - List addresses = await InternetAddress.lookup(item.serviceIp!); - var itemList = addresses.first.address.split("."); - for (var element in itemList) { + final List addresses = await InternetAddress.lookup(item.serviceIp!); + final List itemList = addresses.first.address.split('.'); + for (String element in itemList) { serversList.add(int.parse(element)); } } - double typeDouble = int.parse(item.port!) / 256; - int type1 = typeDouble.toInt(); - int type2 = int.parse(item.port!) % 256; + final double typeDouble = int.parse(item.port!) / 256; + final int type1 = typeDouble.toInt(); + final int type2 = int.parse(item.port!) % 256; serversList.add(type1); serversList.add(type2); } - var uidStr = await Storage.getUid(); - var uidList = [uidStr.toString()]; + final String? uidStr = await Storage.getUid(); + final List uidList = [uidStr.toString()]; IoSenderManage.senderConfiguringWifiCommand( keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), userID: await Storage.getUid(), @@ -197,9 +199,9 @@ class ConfiguringWifiLogic extends BaseGetXController{ }); } - final _networkInfo = NetworkInfo(); + final NetworkInfo _networkInfo = NetworkInfo(); Future getWifiName() async { - var ssid = ''; + String ssid = ''; ssid = (await _networkInfo.getWifiName())!; ssid = ssid ?? ''; ssid = ssid.replaceAll(r'"', ''); @@ -208,8 +210,8 @@ class ConfiguringWifiLogic extends BaseGetXController{ ///定位权限 Future checkLocationPermission() async { - PermissionStatus value = await locationPermission(); - bool allow = value != PermissionStatus.permanentlyDenied && value != PermissionStatus.denied; + final PermissionStatus value = await locationPermission(); + final bool allow = value != PermissionStatus.permanentlyDenied && value != PermissionStatus.denied; return allow; } @@ -217,11 +219,10 @@ class ConfiguringWifiLogic extends BaseGetXController{ @override void onReady() { - // TODO: implement onReady super.onReady(); if(state.wifiName.value.isEmpty){ - getWifiName().then((value) { + getWifiName().then((String value) { state.wifiNameController.text = value; }); } @@ -232,13 +233,11 @@ class ConfiguringWifiLogic extends BaseGetXController{ @override void onInit() { - // TODO: implement onInit super.onInit(); } @override void onClose() { - // TODO: implement onClose _replySubscription.cancel(); super.onClose(); } diff --git a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_state.dart b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_state.dart index ec9b3161..04a748a4 100755 --- a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_state.dart +++ b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_state.dart @@ -6,24 +6,24 @@ import '../../lockSet/lockSetInfo_entity.dart'; import 'configuringWifiEntity.dart'; class ConfiguringWifiState{ - var configuringWifiEntity = ConfiguringWifiEntity().obs; - var lockSetInfoData = LockSetInfoData().obs; - var lockBasicInfo = LockBasicInfo().obs; - - var wifiName = "".obs; - var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 - var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用) - - TextEditingController wifiNameController = TextEditingController(); - TextEditingController wifiPWDController = TextEditingController(); ConfiguringWifiState() { var map = Get.arguments; - lockSetInfoData.value = map["lockSetInfoData"]; + lockSetInfoData.value = map['lockSetInfoData']; lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!; - if ((map["wifiName"] != null)) { - wifiName.value = map["wifiName"]; + if (map['wifiName'] != null) { + wifiName.value = map['wifiName']; wifiNameController.text = wifiName.value; } } + Rx configuringWifiEntity = ConfiguringWifiEntity().obs; + Rx lockSetInfoData = LockSetInfoData().obs; + Rx lockBasicInfo = LockBasicInfo().obs; + + RxString wifiName = ''.obs; + RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + RxInt sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用) + + TextEditingController wifiNameController = TextEditingController(); + TextEditingController wifiPWDController = TextEditingController(); } \ No newline at end of file diff --git a/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_logic.dart b/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_logic.dart index 77456721..d9c00155 100755 --- a/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_logic.dart +++ b/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_logic.dart @@ -20,7 +20,7 @@ class WifiListLogic extends BaseGetXController { // 获取解析后的数据 late StreamSubscription _replySubscription; void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((reply) { + _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) { if(reply is SenderGetWifiReply) { _replySendGetWifiParameters(reply); } @@ -33,15 +33,13 @@ class WifiListLogic extends BaseGetXController { // 发送获取wifi列表数据解析 Future _replySendGetWifiParameters(Reply reply) async { - int status = reply.data[2]; + final int status = reply.data[2]; switch(status){ case 0x00: //成功 showEasyLoading(); cancelBlueConnetctToastTimer(); - Future.delayed(5.seconds, (){ - dismissEasyLoading(); - }); + Future.delayed(5.seconds, dismissEasyLoading); break; case 0x06: // 需要鉴权 @@ -71,7 +69,7 @@ class WifiListLogic extends BaseGetXController { // 设置自动落锁数据解析 Future _replyGetWifiListParameters(Reply reply) async { - int status = reply.data[2]; + final int status = reply.data[2]; switch(status){ case 0x00: //成功 @@ -82,14 +80,14 @@ class WifiListLogic extends BaseGetXController { if (reply.data[6] > 0) { reply.data.removeRange(0, 7); // 把得到的数据按33位分割成数组 然后塞进一个新的数组里面 - var getList = splitList(reply.data, 33); - var uploadList = >[]; + final List> getList = splitList(reply.data, 33); + final List> uploadList = >[]; for (int i = 0; i < getList.length; i++) { - var indexList = getList[i]; - var indexMap = {}; - var wifiName = indexList.sublist(0, 32); - indexMap["wifiName"] = utf8String(wifiName); - indexMap["rssi"] = (indexList.last - 255).toString(); + final List indexList = getList[i]; + final Map indexMap = {}; + final List wifiName = indexList.sublist(0, 32); + indexMap['wifiName'] = utf8String(wifiName); + indexMap['rssi'] = (indexList.last - 255).toString(); uploadList.add(indexMap); state.wifiNameDataList.value = uploadList; } @@ -115,14 +113,14 @@ class WifiListLogic extends BaseGetXController { }); BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected){ - var token = await Storage.getStringList(saveBlueToken); - List getTokenList = changeStringListToIntList(token!); + final List? token = await Storage.getStringList(saveBlueToken); + final List getTokenList = changeStringListToIntList(token!); - var privateKey = await Storage.getStringList(saveBluePrivateKey); - List getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = changeStringListToIntList(privateKey!); - var publicKey = await Storage.getStringList(saveBluePublicKey); - List publicKeyDataList = changeStringListToIntList(publicKey!); + final List? publicKey = await Storage.getStringList(saveBluePublicKey); + final List publicKeyDataList = changeStringListToIntList(publicKey!); IoSenderManage.getWifiListCommand( keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), @@ -145,7 +143,6 @@ class WifiListLogic extends BaseGetXController { @override void onReady() { - // TODO: implement onReady super.onReady(); _initReplySubscription(); @@ -153,7 +150,6 @@ class WifiListLogic extends BaseGetXController { @override void onInit() { - // TODO: implement onInit super.onInit(); senderGetWifiListWifiAction(); @@ -161,7 +157,6 @@ class WifiListLogic extends BaseGetXController { @override void onClose() { - // TODO: implement onClose super.onClose(); _replySubscription.cancel(); } diff --git a/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_state.dart b/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_state.dart index 698501f2..ca058136 100755 --- a/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_state.dart +++ b/lib/main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_state.dart @@ -3,16 +3,16 @@ import 'package:get/get.dart'; import '../../lockSet/lockSetInfo_entity.dart'; -class WifiListState{ - final wifiNameDataList = >[].obs; - var lockSetInfoData = LockSetInfoData().obs; - var lockBasicInfo = LockBasicInfo().obs; - - var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 - var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用) +class WifiListState{// 0普通状态(可用) 1连接中(不可用) WifiListState() { - var map = Get.arguments; - lockSetInfoData.value = map["lockSetInfoData"]; + final map = Get.arguments; + lockSetInfoData.value = map['lockSetInfoData']; lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!; } + final RxList> wifiNameDataList = >[].obs; + Rx lockSetInfoData = LockSetInfoData().obs; + Rx lockBasicInfo = LockBasicInfo().obs; + + RxBool ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示 + RxInt sureBtnState = 0.obs; } \ No newline at end of file diff --git a/lib/mine/addLock/selectLockType/selectLockType_page.dart b/lib/mine/addLock/selectLockType/selectLockType_page.dart index 51f66893..b797a0aa 100755 --- a/lib/mine/addLock/selectLockType/selectLockType_page.dart +++ b/lib/mine/addLock/selectLockType/selectLockType_page.dart @@ -122,7 +122,7 @@ class _SelectLockTypePageState extends State with BaseWidget lockTypeItem('images/lockType/lockType_gatewayLock.png', '网关'.tr, () { CommonDataManage().seletLockType = 7; - // Navigator.pushNamed(context, Routers.gatewayListPage); + Get.toNamed(Routers.selectGatewayTypeNextTipPage); }), if (!F.isLite) lockTypeItem('images/lockType/lockType_camera.png', '网络摄像头'.tr, () { diff --git a/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_logic.dart b/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_logic.dart new file mode 100644 index 00000000..9304d293 --- /dev/null +++ b/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_logic.dart @@ -0,0 +1,8 @@ + +import 'package:star_lock/tools/baseGetXController.dart'; +import 'gatewayConfigurationWifi_state.dart'; + +class GatewayConfigurationWifiLogic extends BaseGetXController { + GatewayConfigurationWifiState state = GatewayConfigurationWifiState(); + +} \ No newline at end of file diff --git a/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_page.dart b/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_page.dart index 708897a4..84f61a5d 100755 --- a/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_page.dart +++ b/lib/mine/gateway/addGateway/gatewayConfigurationWifi/gatewayConfigurationWifi_page.dart @@ -8,6 +8,8 @@ import '../../../../tools/commonItem.dart'; import '../../../../tools/submitBtn.dart'; import '../../../../tools/titleAppBar.dart'; import '../../../../translations/trans_lib.dart'; +import 'gatewayConfigurationWifi_logic.dart'; +import 'gatewayConfigurationWifi_state.dart'; class GatewayConfigurationWifiPage extends StatefulWidget { const GatewayConfigurationWifiPage({Key? key}) : super(key: key); @@ -18,28 +20,28 @@ class GatewayConfigurationWifiPage extends StatefulWidget { } class _GatewayConfigurationWifiPageState extends State { - final TextEditingController _wifiPassward = TextEditingController(); - final TextEditingController _gatewayNamePassward = TextEditingController(); + final GatewayConfigurationWifiLogic logic = Get.put(GatewayConfigurationWifiLogic()); + final GatewayConfigurationWifiState state = Get.find().state; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: TitleAppBar( - barTitle: '网关'.tr, + barTitle: '配置网络'.tr, haveBack: true, backgroundColor: AppColors.mainColor), body: Column( children: [ - Container( - width: 1.sw, - color: const Color(0xFFF2F6F9), - padding: EdgeInsets.all(15.h), - child: Text( - '不支持5G WiFi网络,请选择2.4G WiFi网络进行配置'.tr, - style: TextStyle( - color: AppColors.darkGrayTextColor, fontSize: 20.sp), - )), + // Container( + // width: 1.sw, + // color: const Color(0xFFF2F6F9), + // padding: EdgeInsets.all(15.h), + // child: Text( + // '不支持5G WiFi网络,请选择2.4G WiFi网络进行配置'.tr, + // style: TextStyle( + // color: AppColors.darkGrayTextColor, fontSize: 20.sp), + // )), Expanded( child: ListView( children: [ @@ -57,7 +59,7 @@ class _GatewayConfigurationWifiPageState extends State Visibility( + visible: state.isUseStaticIP.value, child: Column( children: [ CommonItem( leftTitel: 'IP地址'.tr, - rightTitle: '192.168.1.1', - allHeight: 100.h, - isHaveLine: true), - CommonItem( - leftTitel: '子网掩码'.tr, - rightTitle: '255.255.255.0', - allHeight: 100.h, - isHaveLine: true), - CommonItem( - leftTitel: '默认网关'.tr, - rightTitle: '192.168.1.1', - allHeight: 100.h, - isHaveLine: true), - SizedBox( - height: 10.h, + // rightTitle: '192.168.1.1', + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: getTFWidget(state.ipAddressTF, '请输入IP地址') ), CommonItem( + leftTitel: '子网掩码'.tr, + // rightTitle: '255.255.255.0', + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: getTFWidget(state.subnetMaskTF, '请输入子网掩码')), + CommonItem( + leftTitel: '默认网关'.tr, + // rightTitle: '192.168.1.1', + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: getTFWidget(state.defaultGatewayTF, '请输入默认网关') + ), + SizedBox(height: 10.h,), + Obx(() => CommonItem( leftTitel: '自动获取DNS服务器地址'.tr, rightTitle: '', isHaveLine: true, isHaveRightWidget: true, rightWidget: SizedBox( - width: 60.w, height: 50.h, child: _switch())), + width: 60.w, height: 50.h, child: _switch()))), Visibility( - visible: true, + visible: !state.isAutomaticallyGetDNSServerAddress.value, child: Column( children: [ CommonItem( @@ -118,23 +123,21 @@ class _GatewayConfigurationWifiPageState extends State[ - GestureDetector( + Obx(() => GestureDetector( child: SizedBox( // width: 150.w, height: 50.h, // color: Colors.red, child: Center( child: Text( - '不使用静态IP'.tr, + state.isUseStaticIP.value + ? '不使用静态IP'.tr + : '使用静态IP'.tr, style: TextStyle( fontSize: 22.sp, color: AppColors.mainColor)), ), ), onTap: () { - // Navigator.pushNamed(context, Routers.starLockForgetPasswordPage); + state.isUseStaticIP.value = !state.isUseStaticIP.value; + }, - ), + )), SizedBox(width: 30.w), ], ), @@ -199,11 +203,21 @@ class _GatewayConfigurationWifiPageState extends State { actionsList: [ GestureDetector( onTap: () { - Navigator.pushNamed(context, Routers.selectGatewayTypePage); + Get.toNamed(Routers.selectGatewayTypeNextTipPage); }, child: Image.asset( 'images/icon_add_white.png', diff --git a/lib/mine/mineSet/mineSet/mineSet_page.dart b/lib/mine/mineSet/mineSet/mineSet_page.dart index 792b6827..4bbb5a65 100755 --- a/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -230,6 +230,14 @@ class _MineSetPageState extends State Get.toNamed(Routers.authorityManagementPage); // Toast.show(msg: "功能暂未开放"); }), + CommonItem( + leftTitel: '网关'.tr, + rightTitle: '', + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.gatewayListPage); + }), CommonItem( leftTitel: '锁分组'.tr, rightTitle: '',