添加网关UI

This commit is contained in:
魏少阳 2024-08-19 11:01:37 +08:00
parent 915be9fb52
commit 8f25e1bf04
15 changed files with 240 additions and 332 deletions

View File

@ -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"
}

View File

@ -859,5 +859,7 @@
"掌静脉详情": "掌静脉详情",
"掌静脉号": "掌静脉号",
"蓝牙未打开,请到设置里面打开蓝牙": "蓝牙未打开,请到设置里面打开蓝牙",
"删除用户时,会将用户拥有的钥匙一起删除。": "删除用户时,会将用户拥有的钥匙一起删除。"
"删除用户时,会将用户拥有的钥匙一起删除。": "删除用户时,会将用户拥有的钥匙一起删除。",
"配置网络": "配置网络"
}

View File

@ -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 @@
"掌静脉详情": "掌静脉详情",
"掌静脉号": "掌静脉号",
"蓝牙未打开,请到设置里面打开蓝牙": "蓝牙未打开,请到设置里面打开蓝牙",
"删除用户时,会将用户拥有的钥匙一起删除。": "删除用户时,会将用户拥有的钥匙一起删除。"
"删除用户时,会将用户拥有的钥匙一起删除。": "删除用户时,会将用户拥有的钥匙一起删除。",
"配置网络": "配置网络"
}

View File

@ -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<void> main() async {
@ -57,6 +60,8 @@ FutureOr<void> main() async {
SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
}
// checkChinese();
}
//
@ -87,3 +92,27 @@ Future<void> 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<FileSystemEntity> 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);
}

View File

@ -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<void> 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<void> 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<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
// WIFI配网结果
if(reply is SenderConfiguringWifiReply) {
_replySenderConfiguringWifi(reply);
@ -55,7 +57,7 @@ class ConfiguringWifiLogic extends BaseGetXController{
// WIFI配网结果
Future<void> _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<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
final List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
var tokenData = reply.data.sublist(7, 10);
var saveStrList = changeIntListToStringList(tokenData);
final List<int> tokenData = reply.data.sublist(7, 10);
final List<String> saveStrList = changeIntListToStringList(tokenData);
Storage.setStringList(saveBlueToken, saveStrList);
var serversList = <int>[];
final List<int> serversList = <int>[];
for(int i = 0; i<state.configuringWifiEntity.value.data!.serviceList!.length; i++){
var item = state.configuringWifiEntity.value.data!.serviceList![i];
var itemList = item.serviceIp!.split(".");
for (var element in itemList) {
final ServiceList item = state.configuringWifiEntity.value.data!.serviceList![i];
final List<String> 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<String> uidList = <String>[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<void> 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<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
final List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
var serversList = <int>[];
final List<int> serversList = <int>[];
for(int i = 0; i<state.configuringWifiEntity.value.data!.serviceList!.length; i++){
var item = state.configuringWifiEntity.value.data!.serviceList![i];
if(item.serviceIp!.contains("192")){
var itemList = item.serviceIp!.split(".");
for (var element in itemList) {
final ServiceList item = state.configuringWifiEntity.value.data!.serviceList![i];
if(item.serviceIp!.contains('192')){
final List<String> itemList = item.serviceIp!.split('.');
for (String element in itemList) {
serversList.add(int.parse(element));
}
}else{
List<InternetAddress> addresses = await InternetAddress.lookup(item.serviceIp!);
var itemList = addresses.first.address.split(".");
for (var element in itemList) {
final List<InternetAddress> addresses = await InternetAddress.lookup(item.serviceIp!);
final List<String> 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<String> uidList = <String>[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<String> 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<bool> 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();
}

View File

@ -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 = ConfiguringWifiEntity().obs;
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
Rx<LockBasicInfo> lockBasicInfo = LockBasicInfo().obs;
RxString wifiName = ''.obs;
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;// 0() 1()
TextEditingController wifiNameController = TextEditingController();
TextEditingController wifiPWDController = TextEditingController();
}

View File

@ -20,7 +20,7 @@ class WifiListLogic extends BaseGetXController {
//
late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if(reply is SenderGetWifiReply) {
_replySendGetWifiParameters(reply);
}
@ -33,15 +33,13 @@ class WifiListLogic extends BaseGetXController {
// wifi列表数据解析
Future<void> _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<void> _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 = <Map<String, String>>[];
final List<List<int>> getList = splitList(reply.data, 33);
final List<Map<String, String>> uploadList = <Map<String, String>>[];
for (int i = 0; i < getList.length; i++) {
var indexList = getList[i];
var indexMap = <String, String>{};
var wifiName = indexList.sublist(0, 32);
indexMap["wifiName"] = utf8String(wifiName);
indexMap["rssi"] = (indexList.last - 255).toString();
final List<int> indexList = getList[i];
final Map<String, String> indexMap = <String, String>{};
final List<int> 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<int> getTokenList = changeStringListToIntList(token!);
final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!);
var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var publicKey = await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
final List<String>? publicKey = await Storage.getStringList(saveBluePublicKey);
final List<int> 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();
}

View File

@ -3,16 +3,16 @@ import 'package:get/get.dart';
import '../../lockSet/lockSetInfo_entity.dart';
class WifiListState{
final wifiNameDataList = <Map<String, String>>[].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<Map<String, String>> wifiNameDataList = <Map<String, String>>[].obs;
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
Rx<LockBasicInfo> lockBasicInfo = LockBasicInfo().obs;
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;
}

View File

@ -122,7 +122,7 @@ class _SelectLockTypePageState extends State<SelectLockTypePage> 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, () {

View File

@ -0,0 +1,8 @@
import 'package:star_lock/tools/baseGetXController.dart';
import 'gatewayConfigurationWifi_state.dart';
class GatewayConfigurationWifiLogic extends BaseGetXController {
GatewayConfigurationWifiState state = GatewayConfigurationWifiState();
}

View File

@ -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<GatewayConfigurationWifiPage> {
final TextEditingController _wifiPassward = TextEditingController();
final TextEditingController _gatewayNamePassward = TextEditingController();
final GatewayConfigurationWifiLogic logic = Get.put(GatewayConfigurationWifiLogic());
final GatewayConfigurationWifiState state = Get.find<GatewayConfigurationWifiLogic>().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: <Widget>[
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: <Widget>[
@ -57,7 +59,7 @@ class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiP
rightTitle: '',
isHaveRightWidget: true,
rightWidget: getTFWidget(
_wifiPassward,
state.wifiPasswardTF,
'请输入WiFi密码'.tr)),
SizedBox(
height: 10.h,
@ -66,7 +68,7 @@ class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiP
leftTitel: '网关名称'.tr,
rightTitle: '',
isHaveRightWidget: true,
rightWidget: getTFWidget(_gatewayNamePassward,
rightWidget: getTFWidget(state.gatewayNamePasswardTF,
'请输入网关名称'.tr)),
SizedBox(
height: 10.h,
@ -74,42 +76,45 @@ class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiP
CommonItem(
leftTitel: '网络MAC'.tr,
rightTitle: '48:55:19:7d:84:7a',
allHeight: 100.h,
// allHeight: 100.h,
isHaveLine: false),
SizedBox(
height: 10.h,
),
Visibility(
visible: true,
Obx(() => Visibility(
visible: state.isUseStaticIP.value,
child: Column(
children: <Widget>[
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: <Widget>[
CommonItem(
@ -118,23 +123,21 @@ class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiP
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: getTFWidget(
_gatewayNamePassward,
'请输入'.tr,)),
state.firstChoiceDNSTF,
'请输入'.tr)),
CommonItem(
leftTitel: '备选DNS'.tr,
rightTitle: '',
isHaveLine: false,
isHaveRightWidget: true,
rightWidget: getTFWidget(
_gatewayNamePassward,
state.alternativeDNSTF,
'请输入'.tr,)),
],
)),
],
)),
SizedBox(
height: 50.h,
),
))),
SizedBox(height: 50.h),
Container(
margin: EdgeInsets.only(left: 20.w, right: 20.w),
child: SubmitBtn(
@ -147,28 +150,29 @@ class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiP
// Navigator.pushNamed(context, Routers.selectGatewayPage);
}),
),
SizedBox(
height: 10.h,
),
SizedBox(height: 10.h),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
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<GatewayConfigurationWifiP
textAlign: TextAlign.end,
decoration: InputDecoration(
//
contentPadding: const EdgeInsets.only(top: 12.0, bottom: 8.0),
hintText: tfStr,
hintStyle: TextStyle(fontSize: 22.sp),
//线
border: InputBorder.none,
focusedBorder: const OutlineInputBorder(
borderSide:
BorderSide(width: 0, color: Colors.transparent)),
disabledBorder: const OutlineInputBorder(
borderSide:
BorderSide(width: 0, color: Colors.transparent)),
enabledBorder: const OutlineInputBorder(
borderSide:
BorderSide(width: 0, color: Colors.transparent)),
border: const OutlineInputBorder(
borderSide:
BorderSide(width: 0, color: Colors.transparent)),
contentPadding: const EdgeInsets.symmetric(vertical: 0),
),
),
),
@ -216,16 +230,13 @@ class _GatewayConfigurationWifiPageState extends State<GatewayConfigurationWifiP
}
CupertinoSwitch _switch() {
bool _isOn = false;
return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white,
value: _isOn,
value: state.isAutomaticallyGetDNSServerAddress.value,
onChanged: (bool value) {
setState(() {
_isOn = value;
});
state.isAutomaticallyGetDNSServerAddress.value = !state.isAutomaticallyGetDNSServerAddress.value;
},
);
}

View File

@ -0,0 +1,18 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
class GatewayConfigurationWifiState{
RxBool isUseStaticIP = false.obs;
final TextEditingController wifiPasswardTF = TextEditingController();
final TextEditingController gatewayNamePasswardTF = TextEditingController();
final TextEditingController ipAddressTF = TextEditingController();
final TextEditingController subnetMaskTF = TextEditingController();
final TextEditingController defaultGatewayTF = TextEditingController();
RxBool isAutomaticallyGetDNSServerAddress = true.obs;
final TextEditingController firstChoiceDNSTF = TextEditingController();
final TextEditingController alternativeDNSTF = TextEditingController();
}

View File

@ -20,14 +20,18 @@ class _GatewayConnectionLockListPageState extends State<GatewayConnectionLockLis
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(barTitle: '网关'.tr, haveBack:true, backgroundColor: AppColors.mainColor),
appBar: TitleAppBar(
barTitle: '网关'.tr,
haveBack:true,
backgroundColor: AppColors.mainColor
),
body: Column(
children: [
Container(
width: 1.sw,
color: Colors.grey.shade300,
padding: EdgeInsets.all(15.h),
child: Text('网关连接的锁'.tr)
padding: EdgeInsets.all(10.h),
child: Text('网关连接的锁'.tr, style: TextStyle(fontSize: 24.sp))
),
Expanded(
child: ListView.builder(
@ -50,15 +54,14 @@ class _GatewayConnectionLockListPageState extends State<GatewayConnectionLockLis
child: Container(
// height: 100.h,
margin: const EdgeInsets.only(bottom: 2),
padding: EdgeInsets.only(left: 10.w, right: 20.w, top: 20.h, bottom: 20.h),
padding: EdgeInsets.only(left: 15.w, right: 20.w, top: 15.h, bottom: 15.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10.w),
),
child: Row(
children: [
SizedBox(width: 10.w,),
Image.asset(lockTypeIcon, width: 90.w, height: 90.w,),
Image.asset(lockTypeIcon, width: 70.w, height: 70.w,),
SizedBox(width: 20.w,),
Expanded(
child: Column(
@ -69,7 +72,7 @@ class _GatewayConnectionLockListPageState extends State<GatewayConnectionLockLis
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(gateWayName, style: TextStyle(fontSize: 32.sp, fontWeight: FontWeight.w500), ),
Text(gateWayName, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500)),
],
),
),
@ -78,9 +81,9 @@ class _GatewayConnectionLockListPageState extends State<GatewayConnectionLockLis
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 40.w, height: 40.w,),
Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 30.w, height: 30.w,),
SizedBox(width: 10.w,),
Text(signalStrength, style: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.w500), ),
Text(signalStrength, style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w500), ),
],
),
),

View File

@ -25,7 +25,7 @@ class _GatewayListPageState extends State<GatewayListPage> {
actionsList: [
GestureDetector(
onTap: () {
Navigator.pushNamed(context, Routers.selectGatewayTypePage);
Get.toNamed(Routers.selectGatewayTypeNextTipPage);
},
child: Image.asset(
'images/icon_add_white.png',

View File

@ -230,6 +230,14 @@ class _MineSetPageState extends State<MineSetPage>
Get.toNamed(Routers.authorityManagementPage);
// Toast.show(msg: "功能暂未开放");
}),
CommonItem(
leftTitel: '网关'.tr,
rightTitle: '',
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.gatewayListPage);
}),
CommonItem(
leftTitel: '锁分组'.tr,
rightTitle: '',