Compare commits
4 Commits
develop_sk
...
develop_sk
| Author | SHA1 | Date | |
|---|---|---|---|
| b0506a8910 | |||
| 4fa076565f | |||
| 8a8c81b7d2 | |||
| 7e53ecfbf5 |
BIN
images/icon_device_not_selected.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
images/icon_device_selected.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
images/icon_main_drlock_1024.png
Normal file
|
After Width: | Height: | Size: 306 KiB |
BIN
images/mine/icon_message_checbox.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
images/mine/icon_message_close.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
images/mine/icon_message_readed.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
images/mine/icon_message_unread.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
@ -1185,5 +1185,6 @@
|
|||||||
"这是单次密码,只能使用一次": "这是单次密码,只能使用一次",
|
"这是单次密码,只能使用一次": "这是单次密码,只能使用一次",
|
||||||
"您好": "您好",
|
"您好": "您好",
|
||||||
"您的开门密码是": "您的开门密码是",
|
"您的开门密码是": "您的开门密码是",
|
||||||
"开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标": "开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标"
|
"开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标": "开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标",
|
||||||
|
"锁博士": "锁博士"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,6 +150,7 @@ class AppColors {
|
|||||||
|
|
||||||
static Color openPassageModeColor = const Color(0xFFEB2A3B); // 首页开启常开模式颜色(红色)
|
static Color openPassageModeColor = const Color(0xFFEB2A3B); // 首页开启常开模式颜色(红色)
|
||||||
static Color listTimeYellowColor = const Color(0xFFF3BA37); // 首页时间过期颜色(黄色)
|
static Color listTimeYellowColor = const Color(0xFFF3BA37); // 首页时间过期颜色(黄色)
|
||||||
|
static Color messageTipsColor = const Color.fromRGBO(202, 220, 247, 1); //消息页面顶部提示条背景色
|
||||||
|
|
||||||
static Color get lockDetailBottomBtnUneable =>
|
static Color get lockDetailBottomBtnUneable =>
|
||||||
const Color(0xFF808080); // 首页时间灰色颜色(灰色)
|
const Color(0xFF808080); // 首页时间灰色颜色(灰色)
|
||||||
|
|||||||
74
lib/blue/io_protocol/io_readRegisterKey.dart
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import '../io_tool/io_tool.dart';
|
||||||
|
import '../sm4Encipher/sm4.dart';
|
||||||
|
import '../io_reply.dart';
|
||||||
|
import '../io_sender.dart';
|
||||||
|
import '../io_type.dart';
|
||||||
|
import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
|
/// 读取注册密钥
|
||||||
|
class SenderReadRegisterKeyCommand extends SenderProtocol {
|
||||||
|
SenderReadRegisterKeyCommand({
|
||||||
|
this.lockID,
|
||||||
|
this.token,
|
||||||
|
this.needAuthor,
|
||||||
|
this.publicKey,
|
||||||
|
this.privateKey,
|
||||||
|
}) : super(CommandType.readRegisterKey);
|
||||||
|
|
||||||
|
String? lockID;
|
||||||
|
|
||||||
|
List<int>? token;
|
||||||
|
int? needAuthor;
|
||||||
|
List<int>? publicKey;
|
||||||
|
List<int>? privateKey;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SenderReadRegisterKeyCommand{ lockID: $lockID, token: $token, '
|
||||||
|
'needAuthor: $needAuthor, publicKey: $publicKey, '
|
||||||
|
'privateKey: $privateKey}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<int> messageDetail() {
|
||||||
|
List<int> data = <int>[];
|
||||||
|
List<int> ebcData = <int>[];
|
||||||
|
|
||||||
|
// 指令类型
|
||||||
|
final int type = commandType!.typeValue;
|
||||||
|
final double typeDouble = type / 256;
|
||||||
|
final int type1 = typeDouble.toInt();
|
||||||
|
final int type2 = type % 256;
|
||||||
|
data.add(type1);
|
||||||
|
data.add(type2);
|
||||||
|
|
||||||
|
// 锁id 40
|
||||||
|
final int lockIDLength = utf8.encode(lockID!).length;
|
||||||
|
data.addAll(utf8.encode(lockID!));
|
||||||
|
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||||
|
|
||||||
|
if ((data.length % 16) != 0) {
|
||||||
|
final int add = 16 - data.length % 16;
|
||||||
|
for (int i = 0; i < add; i++) {
|
||||||
|
data.add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printLog(data);
|
||||||
|
|
||||||
|
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||||
|
return ebcData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SenderReadRegisterKeyCommandReply extends Reply {
|
||||||
|
SenderReadRegisterKeyCommandReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||||
|
: super.parseData(commandType, dataDetail) {
|
||||||
|
data = dataDetail;
|
||||||
|
|
||||||
|
final int status = data[6];
|
||||||
|
errorWithStstus(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
106
lib/blue/io_protocol/io_sendAuthorizationCode.dart
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import '../io_tool/io_tool.dart';
|
||||||
|
import '../sm4Encipher/sm4.dart';
|
||||||
|
import '../io_reply.dart';
|
||||||
|
import '../io_sender.dart';
|
||||||
|
import '../io_type.dart';
|
||||||
|
import 'package:crypto/crypto.dart' as crypto;
|
||||||
|
|
||||||
|
/// 发送授权码
|
||||||
|
class SenderAuthorizationCodeCommand extends SenderProtocol {
|
||||||
|
SenderAuthorizationCodeCommand({
|
||||||
|
this.lockID,
|
||||||
|
this.uuid,
|
||||||
|
this.key,
|
||||||
|
this.mac,
|
||||||
|
this.platform,
|
||||||
|
this.utcTimeStamp,
|
||||||
|
this.token,
|
||||||
|
this.needAuthor,
|
||||||
|
this.publicKey,
|
||||||
|
this.privateKey,
|
||||||
|
}) : super(CommandType.sendAuthorizationCode);
|
||||||
|
|
||||||
|
String? lockID;
|
||||||
|
String? uuid;
|
||||||
|
String? key;
|
||||||
|
String? mac;
|
||||||
|
int? platform; //0:锁通通;1:涂鸦智能
|
||||||
|
int? utcTimeStamp;
|
||||||
|
|
||||||
|
List<int>? token;
|
||||||
|
int? needAuthor;
|
||||||
|
List<int>? publicKey;
|
||||||
|
List<int>? privateKey;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'SenderAuthorizationCodeCommand{ lockID: $lockID, token: $token, '
|
||||||
|
'needAuthor: $needAuthor, publicKey: $publicKey, '
|
||||||
|
'privateKey: $privateKey}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<int> messageDetail() {
|
||||||
|
List<int> data = <int>[];
|
||||||
|
List<int> ebcData = <int>[];
|
||||||
|
|
||||||
|
// 指令类型
|
||||||
|
final int type = commandType!.typeValue;
|
||||||
|
final double typeDouble = type / 256;
|
||||||
|
final int type1 = typeDouble.toInt();
|
||||||
|
final int type2 = type % 256;
|
||||||
|
data.add(type1);
|
||||||
|
data.add(type2);
|
||||||
|
|
||||||
|
// 锁id 40
|
||||||
|
final int lockIDLength = utf8.encode(lockID!).length;
|
||||||
|
data.addAll(utf8.encode(lockID!));
|
||||||
|
data = getFixedLengthList(data, 40 - lockIDLength);
|
||||||
|
|
||||||
|
// uuid 40
|
||||||
|
final int uuidLength = utf8.encode(uuid!).length;
|
||||||
|
data.addAll(utf8.encode(uuid!));
|
||||||
|
data = getFixedLengthList(data, 40 - uuidLength);
|
||||||
|
|
||||||
|
// key 40
|
||||||
|
final int keyLength = utf8.encode(key!).length;
|
||||||
|
data.addAll(utf8.encode(key!));
|
||||||
|
data = getFixedLengthList(data, 40 - keyLength);
|
||||||
|
|
||||||
|
// mac 40
|
||||||
|
final int macLength = utf8.encode(mac!).length;
|
||||||
|
data.addAll(utf8.encode(mac!));
|
||||||
|
data = getFixedLengthList(data, 40 - macLength);
|
||||||
|
|
||||||
|
data.add(platform!);
|
||||||
|
|
||||||
|
data.add((utcTimeStamp! & 0xff000000) >> 24);
|
||||||
|
data.add((utcTimeStamp! & 0xff0000) >> 16);
|
||||||
|
data.add((utcTimeStamp! & 0xff00) >> 8);
|
||||||
|
data.add(utcTimeStamp! & 0xff);
|
||||||
|
|
||||||
|
if ((data.length % 16) != 0) {
|
||||||
|
final int add = 16 - data.length % 16;
|
||||||
|
for (int i = 0; i < add; i++) {
|
||||||
|
data.add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printLog(data);
|
||||||
|
|
||||||
|
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||||
|
return ebcData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class SenderAuthorizationCodeCommandReply extends Reply {
|
||||||
|
SenderAuthorizationCodeCommandReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||||
|
: super.parseData(commandType, dataDetail) {
|
||||||
|
data = dataDetail;
|
||||||
|
|
||||||
|
final int status = data[6];
|
||||||
|
errorWithStstus(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -53,6 +53,8 @@ enum CommandType {
|
|||||||
gatewayGetWifiList, //网关获取附近的wifi列表 0x30F6
|
gatewayGetWifiList, //网关获取附近的wifi列表 0x30F6
|
||||||
gatewayGetWifiListResult, //网关获取附近的wifi列表结果 0x30F7
|
gatewayGetWifiListResult, //网关获取附近的wifi列表结果 0x30F7
|
||||||
gatewayGetStatus, //获取网关状态 0x30F8
|
gatewayGetStatus, //获取网关状态 0x30F8
|
||||||
|
readRegisterKey, //读取注册密钥 0x30A7
|
||||||
|
sendAuthorizationCode, //发送授权码 0x30A6
|
||||||
|
|
||||||
generalExtendedCommond, // 通用扩展指令 = 0x3030
|
generalExtendedCommond, // 通用扩展指令 = 0x3030
|
||||||
gecChangeAdministratorPassword, // 通用扩展指令子命令-修改管理员密码 = 2
|
gecChangeAdministratorPassword, // 通用扩展指令子命令-修改管理员密码 = 2
|
||||||
@ -245,6 +247,16 @@ extension ExtensionCommandType on CommandType {
|
|||||||
type = CommandType.gatewayGetStatus;
|
type = CommandType.gatewayGetStatus;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 0x30A6:
|
||||||
|
{
|
||||||
|
type = CommandType.sendAuthorizationCode;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x30A7:
|
||||||
|
{
|
||||||
|
type = CommandType.readRegisterKey;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
type = CommandType.readStarLockStatusInfo;
|
type = CommandType.readStarLockStatusInfo;
|
||||||
@ -353,6 +365,12 @@ extension ExtensionCommandType on CommandType {
|
|||||||
case CommandType.setLockCurrentVoicePacket:
|
case CommandType.setLockCurrentVoicePacket:
|
||||||
type = 0x30A5;
|
type = 0x30A5;
|
||||||
break;
|
break;
|
||||||
|
case CommandType.sendAuthorizationCode:
|
||||||
|
type = 0x30A6;
|
||||||
|
break;
|
||||||
|
case CommandType.readRegisterKey:
|
||||||
|
type = 0x30A7;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
type = 0x300A;
|
type = 0x300A;
|
||||||
break;
|
break;
|
||||||
@ -492,6 +510,12 @@ extension ExtensionCommandType on CommandType {
|
|||||||
case 0x30A5:
|
case 0x30A5:
|
||||||
t = '设置锁当前语音包';
|
t = '设置锁当前语音包';
|
||||||
break;
|
break;
|
||||||
|
case 0x30A6:
|
||||||
|
t = '发送授权码';
|
||||||
|
break;
|
||||||
|
case 0x30A7:
|
||||||
|
t = '读取注册密钥';
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
t = '读星锁状态信息';
|
t = '读星锁状态信息';
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -16,10 +16,12 @@ import 'package:star_lock/blue/io_protocol/io_getDeviceModel.dart';
|
|||||||
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
|
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_readRegisterKey.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_readSupportFunctionsNoParameters.dart';
|
import 'package:star_lock/blue/io_protocol/io_readSupportFunctionsNoParameters.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_readSupportFunctionsWithParameters.dart';
|
import 'package:star_lock/blue/io_protocol/io_readSupportFunctionsWithParameters.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_readVoicePackageFinalResult.dart';
|
import 'package:star_lock/blue/io_protocol/io_readVoicePackageFinalResult.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_referEventRecordTime.dart';
|
import 'package:star_lock/blue/io_protocol/io_referEventRecordTime.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_sendAuthorizationCode.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
|
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsNoParameters.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsWithParameters.dart';
|
import 'package:star_lock/blue/io_protocol/io_setSupportFunctionsWithParameters.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_setVoicePackageFinalResult.dart';
|
import 'package:star_lock/blue/io_protocol/io_setVoicePackageFinalResult.dart';
|
||||||
@ -331,6 +333,18 @@ class CommandReciverManager {
|
|||||||
SetVoicePackageFinalResultReply.parseData(commandType, data);
|
SetVoicePackageFinalResultReply.parseData(commandType, data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case CommandType.readRegisterKey:
|
||||||
|
{
|
||||||
|
reply =
|
||||||
|
SenderReadRegisterKeyCommandReply.parseData(commandType, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CommandType.sendAuthorizationCode:
|
||||||
|
{
|
||||||
|
reply =
|
||||||
|
SenderAuthorizationCodeCommandReply.parseData(commandType, data);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case CommandType.generalExtendedCommond:
|
case CommandType.generalExtendedCommond:
|
||||||
{
|
{
|
||||||
// 子命令类型
|
// 子命令类型
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import 'package:star_lock/blue/io_protocol/io_deletUser.dart';
|
|||||||
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
|
||||||
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
|
import 'package:star_lock/blue/io_protocol/io_readAdminPassword.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_readRegisterKey.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_sendAuthorizationCode.dart';
|
||||||
|
|
||||||
import 'io_gateway/io_gateway_configuringWifi.dart';
|
import 'io_gateway/io_gateway_configuringWifi.dart';
|
||||||
import 'io_gateway/io_gateway_getStatus.dart';
|
import 'io_gateway/io_gateway_getStatus.dart';
|
||||||
@ -1109,10 +1111,7 @@ class IoSenderManage {
|
|||||||
|
|
||||||
//ota 升级过程
|
//ota 升级过程
|
||||||
static void senderProcessOtaUpgradeCommand(
|
static void senderProcessOtaUpgradeCommand(
|
||||||
{required int? index,
|
{required int? index, required int? size, required List<int>? data, CommandSendCallBack? callBack}) {
|
||||||
required int? size,
|
|
||||||
required List<int>? data,
|
|
||||||
CommandSendCallBack? callBack}) {
|
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: ProcessOtaUpgradeCommand(
|
command: ProcessOtaUpgradeCommand(
|
||||||
index: index,
|
index: index,
|
||||||
@ -1321,8 +1320,7 @@ class IoSenderManage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 网关获取wifi列表
|
// 网关获取wifi列表
|
||||||
static void gatewayGetWifiCommand(
|
static void gatewayGetWifiCommand({required String? userID, CommandSendCallBack? callBack}) {
|
||||||
{required String? userID, CommandSendCallBack? callBack}) {
|
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: GatewayGetWifiCommand(
|
command: GatewayGetWifiCommand(
|
||||||
userID: userID,
|
userID: userID,
|
||||||
@ -1339,21 +1337,51 @@ class IoSenderManage {
|
|||||||
CommandSendCallBack? callBack}) {
|
CommandSendCallBack? callBack}) {
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: GatewayConfiguringWifiCommand(
|
command: GatewayConfiguringWifiCommand(
|
||||||
ssid: ssid,
|
ssid: ssid, password: password, gatewayConfigurationStr: gatewayConfigurationStr),
|
||||||
password: password,
|
|
||||||
gatewayConfigurationStr: gatewayConfigurationStr),
|
|
||||||
isBeforeAddUser: true,
|
isBeforeAddUser: true,
|
||||||
callBack: callBack);
|
callBack: callBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取网关状态
|
// 获取网关状态
|
||||||
static void gatewayGetStatusCommand(
|
static void gatewayGetStatusCommand(
|
||||||
{required String? lockID,
|
{required String? lockID, required String? userID, CommandSendCallBack? callBack}) {
|
||||||
required String? userID,
|
|
||||||
CommandSendCallBack? callBack}) {
|
|
||||||
CommandSenderManager().managerSendData(
|
CommandSenderManager().managerSendData(
|
||||||
command: GatewayGetStatusCommand(lockID: lockID, userID: userID),
|
command: GatewayGetStatusCommand(lockID: lockID, userID: userID), isBeforeAddUser: true, callBack: callBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取注册密钥
|
||||||
|
static void readRegisterKey({
|
||||||
|
required String? lockID,
|
||||||
|
CommandSendCallBack? callBack,
|
||||||
|
}) {
|
||||||
|
CommandSenderManager().managerSendData(
|
||||||
|
command: SenderReadRegisterKeyCommand(lockID: lockID),
|
||||||
isBeforeAddUser: true,
|
isBeforeAddUser: true,
|
||||||
callBack: callBack);
|
callBack: callBack,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送授权码
|
||||||
|
static void sendAuthorizationCode({
|
||||||
|
required String? lockID,
|
||||||
|
required String? uuid,
|
||||||
|
required String? key,
|
||||||
|
required String? mac,
|
||||||
|
required int? platform,
|
||||||
|
required int? utcTimeStamp,
|
||||||
|
CommandSendCallBack? callBack,
|
||||||
|
}) {
|
||||||
|
CommandSenderManager().managerSendData(
|
||||||
|
command: SenderAuthorizationCodeCommand(
|
||||||
|
lockID: lockID,
|
||||||
|
uuid: uuid,
|
||||||
|
key: key,
|
||||||
|
mac: mac,
|
||||||
|
platform: platform,
|
||||||
|
utcTimeStamp: utcTimeStamp,
|
||||||
|
),
|
||||||
|
isBeforeAddUser: true,
|
||||||
|
callBack: callBack,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,7 @@ class F {
|
|||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
case Flavor.sky_dev:
|
case Flavor.sky_dev:
|
||||||
case Flavor.sky_pre:
|
case Flavor.sky_pre:
|
||||||
return '锁通通'.tr;
|
return '锁博士'.tr;
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
case Flavor.xhj_bundle:
|
case Flavor.xhj_bundle:
|
||||||
case Flavor.xhj_dev:
|
case Flavor.xhj_dev:
|
||||||
@ -119,7 +119,7 @@ class F {
|
|||||||
case Flavor.sky:
|
case Flavor.sky:
|
||||||
case Flavor.sky_dev:
|
case Flavor.sky_dev:
|
||||||
case Flavor.sky_pre:
|
case Flavor.sky_pre:
|
||||||
return '锁通通'.tr;
|
return '锁博士'.tr;
|
||||||
case Flavor.xhj:
|
case Flavor.xhj:
|
||||||
case Flavor.xhj_bundle:
|
case Flavor.xhj_bundle:
|
||||||
case Flavor.xhj_dev:
|
case Flavor.xhj_dev:
|
||||||
|
|||||||
@ -52,6 +52,13 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
|
|
||||||
Future<void> login() async {
|
Future<void> login() async {
|
||||||
FocusScope.of(Get.context!).requestFocus(FocusNode()); //关闭键盘
|
FocusScope.of(Get.context!).requestFocus(FocusNode()); //关闭键盘
|
||||||
|
|
||||||
|
// 添加邮箱格式验证
|
||||||
|
if (!GetUtils.isEmail(state.emailOrPhone.value)) {
|
||||||
|
showToast('请输入有效的邮箱地址');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final LoginEntity entity = await ApiRepository.to.login(
|
final LoginEntity entity = await ApiRepository.to.login(
|
||||||
loginType: '1',
|
loginType: '1',
|
||||||
password: state.pwd.value,
|
password: state.pwd.value,
|
||||||
|
|||||||
@ -88,30 +88,31 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(10.w),
|
padding: EdgeInsets.all(10.w),
|
||||||
child: Center(child: Image.asset('images/icon_main_sky_1024.png', width: 110.w, height: 110.w))),
|
child: Center(child: Image.asset('images/icon_main_drlock_1024.png', width: 110.w, height: 110.w))),
|
||||||
SizedBox(height: 50.w),
|
SizedBox(height: 50.w),
|
||||||
Obx(() => CommonItem(
|
// Obx(() =>
|
||||||
leftTitel: '你所在的国家/地区'.tr,
|
// CommonItem(
|
||||||
rightTitle: '',
|
// leftTitel: '你所在的国家/地区'.tr,
|
||||||
isHaveLine: true,
|
// rightTitle: '',
|
||||||
isPadding: false,
|
// isHaveLine: true,
|
||||||
isHaveRightWidget: true,
|
// isPadding: false,
|
||||||
isHaveDirection: true,
|
// isHaveRightWidget: true,
|
||||||
rightWidget: Text(
|
// isHaveDirection: true,
|
||||||
'${state.countryName} +${state.countryCode.value}',
|
// rightWidget: Text(
|
||||||
textAlign: TextAlign.end,
|
// '${state.countryName} +${state.countryCode.value}',
|
||||||
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
// textAlign: TextAlign.end,
|
||||||
),
|
// style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
action: () async {
|
// ),
|
||||||
final result = await Get.toNamed(Routers.selectCountryRegionPage);
|
// action: () async {
|
||||||
if (result != null) {
|
// final result = await Get.toNamed(Routers.selectCountryRegionPage);
|
||||||
result as Map<String, dynamic>;
|
// if (result != null) {
|
||||||
state.countryCode.value = result['code'];
|
// result as Map<String, dynamic>;
|
||||||
state.countryKey.value = result['countryName'];
|
// state.countryCode.value = result['code'];
|
||||||
logic.checkIpAction();
|
// state.countryKey.value = result['countryName'];
|
||||||
}
|
// logic.checkIpAction();
|
||||||
},
|
// }
|
||||||
)),
|
// },
|
||||||
|
// )),
|
||||||
LoginInput(
|
LoginInput(
|
||||||
focusNode: logic.state.emailOrPhoneFocusNode,
|
focusNode: logic.state.emailOrPhoneFocusNode,
|
||||||
controller: state.emailOrPhoneController,
|
controller: state.emailOrPhoneController,
|
||||||
@ -126,12 +127,16 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
|||||||
height: 36.w,
|
height: 36.w,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
hintText: '请输入手机号或者邮箱'.tr,
|
// hintText: '请输入手机号或者邮箱'.tr,
|
||||||
|
hintText: '请输入邮箱'.tr,
|
||||||
// keyboardType: TextInputType.number,
|
// keyboardType: TextInputType.number,
|
||||||
|
keyboardType: TextInputType.emailAddress,
|
||||||
inputFormatters: <TextInputFormatter>[
|
inputFormatters: <TextInputFormatter>[
|
||||||
// FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
// FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||||
LengthLimitingTextInputFormatter(30),
|
LengthLimitingTextInputFormatter(30),
|
||||||
FilteringTextInputFormatter.singleLineFormatter
|
FilteringTextInputFormatter.singleLineFormatter,
|
||||||
|
// 添加邮箱格式限制
|
||||||
|
FilteringTextInputFormatter.allow(RegExp(r'^[a-zA-Z0-9@._-]+$')),
|
||||||
]),
|
]),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
LoginInput(
|
LoginInput(
|
||||||
|
|||||||
@ -30,7 +30,8 @@ class StarLockLoginState {
|
|||||||
RxString emailOrPhone = ''.obs;
|
RxString emailOrPhone = ''.obs;
|
||||||
RxString pwd = ''.obs;
|
RxString pwd = ''.obs;
|
||||||
RxBool canNext = false.obs;
|
RxBool canNext = false.obs;
|
||||||
bool get isEmailOrPhone => emailOrPhone.value.isNotEmpty;
|
// bool get isEmailOrPhone => emailOrPhone.value.isNotEmpty;
|
||||||
|
bool get isEmailOrPhone => GetUtils.isEmail(emailOrPhone.value);
|
||||||
bool get pwdIsOK => pwd.value.isNotEmpty;
|
bool get pwdIsOK => pwd.value.isNotEmpty;
|
||||||
|
|
||||||
TextEditingController emailOrPhoneController = TextEditingController();
|
TextEditingController emailOrPhoneController = TextEditingController();
|
||||||
|
|||||||
@ -41,7 +41,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
|||||||
child: ListView(
|
child: ListView(
|
||||||
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
|
padding: EdgeInsets.only(top: 40.h, left: 40.w, right: 40.w),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
topSelectCountryAndRegionWidget(),
|
// topSelectCountryAndRegionWidget(),
|
||||||
middleTFWidget(),
|
middleTFWidget(),
|
||||||
Obx(() {
|
Obx(() {
|
||||||
return SubmitBtn(
|
return SubmitBtn(
|
||||||
|
|||||||
@ -6,7 +6,7 @@ class StarLockRegisterState {
|
|||||||
StarLockRegisterState() {
|
StarLockRegisterState() {
|
||||||
// 根据系统语言设置默认选中的tab
|
// 根据系统语言设置默认选中的tab
|
||||||
final Locale? systemLocale = Get.deviceLocale;
|
final Locale? systemLocale = Get.deviceLocale;
|
||||||
isIphoneType.value = systemLocale?.languageCode == 'zh';
|
//isIphoneType.value = systemLocale?.languageCode == 'zh';
|
||||||
|
|
||||||
resetResend();
|
resetResend();
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ class StarLockRegisterState {
|
|||||||
RxString surePwd = ''.obs;
|
RxString surePwd = ''.obs;
|
||||||
RxString verificationCode = ''.obs;
|
RxString verificationCode = ''.obs;
|
||||||
RxString xWidth = ''.obs; // 滑动验证码滑动位置
|
RxString xWidth = ''.obs; // 滑动验证码滑动位置
|
||||||
RxBool isIphoneType = true.obs;
|
RxBool isIphoneType = false.obs;
|
||||||
RxBool canSub = false.obs; // 是否能提交
|
RxBool canSub = false.obs; // 是否能提交
|
||||||
RxBool agree = false.obs;
|
RxBool agree = false.obs;
|
||||||
RxBool canSendCode = false.obs; // 是否能发送验证码
|
RxBool canSendCode = false.obs; // 是否能发送验证码
|
||||||
|
|||||||
@ -69,6 +69,14 @@ FutureOr<void> main() async {
|
|||||||
String? token = await CallKitHandler.getVoipToken();
|
String? token = await CallKitHandler.getVoipToken();
|
||||||
print('获取到的VoIP Token: $token');
|
print('获取到的VoIP Token: $token');
|
||||||
}
|
}
|
||||||
|
// 在 runApp 之前设置
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
const SystemUiOverlayStyle(
|
||||||
|
statusBarColor: Colors.transparent, // 状态栏背景色(通常透明)
|
||||||
|
statusBarIconBrightness: Brightness.dark, // Android: 黑色图标
|
||||||
|
statusBarBrightness: Brightness.dark, // iOS: 状态栏内容为深色(影响时间等颜色)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
runApp(MyApp(isLogin: isLogin));
|
runApp(MyApp(isLogin: isLogin));
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
class ActivateInfoResponse {
|
class ActivateInfoResponse {
|
||||||
ActivateInfoResponse({
|
ActivateInfoResponse({
|
||||||
this.description,
|
this.description,
|
||||||
@ -9,16 +11,99 @@ class ActivateInfoResponse {
|
|||||||
ActivateInfoResponse.fromJson(dynamic json) {
|
ActivateInfoResponse.fromJson(dynamic json) {
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
errorCode = json['errorCode'];
|
errorCode = json['errorCode'];
|
||||||
// 修改这里:如果 json['data'] 是列表,则解析为 List<ActivateInfo>;否则为空列表
|
// 修改这里:直接解析为单个 ActivateInfo 对象
|
||||||
data = json['data'] != null
|
data = json['data'] != null ? ActivateInfo.fromJson(json['data']) : null;
|
||||||
? (json['data'] as List).map((item) => ActivateInfo.fromJson(item)).toList()
|
|
||||||
: [];
|
|
||||||
errorMsg = json['errorMsg'];
|
errorMsg = json['errorMsg'];
|
||||||
}
|
}
|
||||||
|
|
||||||
String? description;
|
String? description;
|
||||||
int? errorCode;
|
int? errorCode;
|
||||||
List<ActivateInfo>? data; // 改为 List<ActivateInfo>
|
ActivateInfo? data; // 改为 List<ActivateInfo>
|
||||||
|
String? errorMsg;
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final map = <String, dynamic>{};
|
||||||
|
map['description'] = description;
|
||||||
|
map['errorCode'] = errorCode;
|
||||||
|
if (data != null) {
|
||||||
|
// 修改这里:将单个 ActivateInfo 对象转换为 JSON
|
||||||
|
map['data'] = data!.toJson();
|
||||||
|
}
|
||||||
|
map['errorMsg'] = errorMsg;
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ActivateInfoResponse{description: $description, errorCode: $errorCode, data: $data, errorMsg: $errorMsg}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ActivateInfo {
|
||||||
|
String? authCode;
|
||||||
|
String? activatedAt;
|
||||||
|
Map<String, dynamic>? extraParams; // 修改为 Map 类型
|
||||||
|
|
||||||
|
ActivateInfo({
|
||||||
|
this.authCode,
|
||||||
|
this.activatedAt,
|
||||||
|
this.extraParams,
|
||||||
|
});
|
||||||
|
|
||||||
|
ActivateInfo.fromJson(dynamic json) {
|
||||||
|
authCode = json['auth_code'] ?? '';
|
||||||
|
activatedAt = json['activated_at'] ?? '';
|
||||||
|
// 修改这里:将 extraParams 解析为 Map 对象
|
||||||
|
if (json['extra_params'] != null) {
|
||||||
|
if (json['extra_params'] is Map) {
|
||||||
|
extraParams = json['extra_params'];
|
||||||
|
} else if (json['extra_params'] is String) {
|
||||||
|
// 如果是字符串,尝试解析为 JSON 对象
|
||||||
|
try {
|
||||||
|
extraParams = jsonDecode(json['extra_params']);
|
||||||
|
} catch (e) {
|
||||||
|
// 解析失败则设为 null 或空 map
|
||||||
|
extraParams = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
extraParams = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final map = <String, dynamic>{};
|
||||||
|
map['authCode'] = authCode;
|
||||||
|
map['activatedAt'] = activatedAt;
|
||||||
|
map['extraParams'] = extraParams;
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ActivateInfo{authCode: $authCode, activatedAt: $activatedAt, extraParams: $extraParams}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TppSupportResponse {
|
||||||
|
TppSupportResponse({
|
||||||
|
this.description,
|
||||||
|
this.errorCode,
|
||||||
|
this.data, // 现在是一个 List<ActivateInfo>
|
||||||
|
this.errorMsg,
|
||||||
|
});
|
||||||
|
|
||||||
|
TppSupportResponse.fromJson(dynamic json) {
|
||||||
|
description = json['description'];
|
||||||
|
errorCode = json['errorCode'];
|
||||||
|
// 修改这里:如果 json['data'] 是列表,则解析为 List<ActivateInfo>;否则为空列表
|
||||||
|
data = json['data'] != null ? (json['data'] as List).map((item) => TppSupportInfo.fromJson(item)).toList() : [];
|
||||||
|
errorMsg = json['errorMsg'];
|
||||||
|
}
|
||||||
|
|
||||||
|
String? description;
|
||||||
|
int? errorCode;
|
||||||
|
List<TppSupportInfo>? data; // 改为 List<ActivateInfo>
|
||||||
String? errorMsg;
|
String? errorMsg;
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
@ -35,33 +120,28 @@ class ActivateInfoResponse {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ActivateInfoResponse{description: $description, errorCode: $errorCode, data: $data, errorMsg: $errorMsg}';
|
return 'TppSupportResponse{description: $description, errorCode: $errorCode, data: $data, errorMsg: $errorMsg}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ActivateInfo {
|
class TppSupportInfo {
|
||||||
String? platformName;
|
|
||||||
int? platform;
|
int? platform;
|
||||||
|
String? platformName;
|
||||||
|
|
||||||
ActivateInfo({
|
TppSupportInfo({
|
||||||
this.platformName,
|
|
||||||
this.platform,
|
this.platform,
|
||||||
|
this.platformName,
|
||||||
});
|
});
|
||||||
|
|
||||||
ActivateInfo.fromJson(dynamic json) {
|
TppSupportInfo.fromJson(dynamic json) {
|
||||||
platformName = json['platformName'] ?? '';
|
platform = json['platform'] as int? ?? -1;
|
||||||
platform = json['platform'] ?? '';
|
platformName = json['platform_name'] as String? ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final map = <String, dynamic>{};
|
final map = <String, dynamic>{};
|
||||||
map['platformName'] = platformName;
|
|
||||||
map['platform'] = platform;
|
map['platform'] = platform;
|
||||||
|
map['platform_name'] = platformName;
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return 'ActivateInfo{platformName: $platformName, platform: $platform}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
@ -37,25 +36,23 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
|
|||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: F.navTitle,
|
barTitle: F.navTitle,
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: AppColors.mainColor),
|
backgroundColor: Colors.white,
|
||||||
body: LockDetailPage(
|
titleColor: Colors.black,
|
||||||
isOnlyOneData: isOnlyOneData,
|
iconColor: Colors.black,
|
||||||
lockListInfoItemEntity: keyInfos),
|
),
|
||||||
|
body: LockDetailPage(isOnlyOneData: isOnlyOneData, lockListInfoItemEntity: keyInfos),
|
||||||
// body: Container(),
|
// body: Container(),
|
||||||
),
|
),
|
||||||
xhjCall: () => Scaffold(
|
xhjCall: () => Scaffold(
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
appBar: TitleAppBar(
|
appBar: TitleAppBar(
|
||||||
barTitle: F.sw(
|
barTitle: F.sw(xhjCall: () => '星星锁'.tr, skyCall: () => keyInfos.lockAlias),
|
||||||
xhjCall: () => '星星锁'.tr, skyCall: () => keyInfos.lockAlias),
|
|
||||||
haveBack: true,
|
haveBack: true,
|
||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
titleColor: AppColors.blackColor,
|
titleColor: AppColors.blackColor,
|
||||||
iconColor: AppColors.blackColor,
|
iconColor: AppColors.blackColor,
|
||||||
),
|
),
|
||||||
body: LockDetailPage(
|
body: LockDetailPage(isOnlyOneData: isOnlyOneData, lockListInfoItemEntity: keyInfos),
|
||||||
isOnlyOneData: isOnlyOneData,
|
|
||||||
lockListInfoItemEntity: keyInfos),
|
|
||||||
// body: Container(),
|
// body: Container(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -464,6 +464,44 @@ class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStat
|
|||||||
Widget skWidget() {
|
Widget skWidget() {
|
||||||
return ListView(
|
return ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Visibility(
|
||||||
|
visible: widget.isOnlyOneData,
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Image.asset('images/icon_main_drlock_1024.png', width: 68.w, height: 68.w),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
F.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
//实现回调函数
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
Routers.selectLockTypePage,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.add_circle_outline_rounded,
|
||||||
|
size: 48.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: (state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
visible: (state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环
|
state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && // 限时、循环
|
||||||
|
|||||||
@ -1,40 +1,298 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_settings.dart';
|
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_getStarLockStatusInfo.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_readRegisterKey.dart';
|
||||||
|
import 'package:star_lock/blue/io_protocol/io_sendAuthorizationCode.dart';
|
||||||
|
import 'package:star_lock/blue/io_reply.dart';
|
||||||
|
import 'package:star_lock/blue/io_tool/io_tool.dart';
|
||||||
|
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
|
||||||
|
import 'package:star_lock/blue/sender_manage.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_state.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/thirdPartyPlatform/third_party_platform_state.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/network/start_company_api.dart';
|
import 'package:star_lock/network/start_company_api.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
|
||||||
class ThirdPartyPlatformLogic extends BaseGetXController {
|
class ThirdPartyPlatformLogic extends BaseGetXController {
|
||||||
ThirdPartyPlatformState state = ThirdPartyPlatformState();
|
ThirdPartyPlatformState state = ThirdPartyPlatformState();
|
||||||
|
|
||||||
void savePlatFormSetting() {
|
// 监听设备返回的数据
|
||||||
// showEasyLoading();
|
StreamSubscription<Reply>? _replySubscription;
|
||||||
showToast('功能待开放'.tr);
|
|
||||||
// dismissEasyLoading();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 查询TPP支持
|
|
||||||
void getActivateInfo() async {
|
|
||||||
final model = state.lockSetInfoData.value.lockBasicInfo?.model;
|
|
||||||
if (model != null && model != '') {
|
|
||||||
final response = await StartCompanyApi.to.getActivateInfo(model: model);
|
|
||||||
if (response.errorCode!.codeIsSuccessful) {
|
|
||||||
AppLog.log('${response.data}');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() async {
|
void onReady() async {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
getActivateInfo();
|
await getActivateInfo();
|
||||||
|
_initReplySubscription();
|
||||||
|
getServerDatetime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
|
// 安全地取消订阅
|
||||||
|
_replySubscription?.cancel();
|
||||||
|
_replySubscription = null;
|
||||||
|
|
||||||
|
// 添加额外的日志来跟踪清理过程
|
||||||
|
AppLog.log('ThirdPartyPlatformLogic disposed, subscription cancelled');
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
super.onClose();
|
||||||
|
// 安全地取消订阅
|
||||||
|
_replySubscription?.cancel();
|
||||||
|
_replySubscription = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从服务器时间
|
||||||
|
Future<void> getServerDatetime() async {
|
||||||
|
final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading: true);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int getUTCNetTime() {
|
||||||
|
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _initReplySubscription() {
|
||||||
|
// 更严格的检查,避免重复初始化
|
||||||
|
if (_replySubscription != null) {
|
||||||
|
AppLog.log('订阅已存在,避免重复初始化');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
|
AppLog.log('输出了listen:${_replySubscription.hashCode}');
|
||||||
|
if (reply is SenderReadRegisterKeyCommandReply) {
|
||||||
|
_handleReadRegisterKeyReply(reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reply is GetStarLockStatuInfoReply) {
|
||||||
|
_replyGetStarLockStatusInfo(reply);
|
||||||
|
}
|
||||||
|
if (reply is SenderAuthorizationCodeCommandReply) {
|
||||||
|
_handleAuthorizationCodeReply(reply);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
AppLog.log('创建新订阅:${_replySubscription.hashCode}');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取星锁状态
|
||||||
|
Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
|
||||||
|
final int status = reply.data[2];
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
//成功
|
||||||
|
// AppLog.log('获取锁状态成功');
|
||||||
|
// 厂商名称
|
||||||
|
int index = 3;
|
||||||
|
final List<int> vendor = reply.data.sublist(index, index + 20);
|
||||||
|
final String vendorStr = utf8String(vendor);
|
||||||
|
state.lockInfo['vendor'] = vendorStr;
|
||||||
|
// state.lockInfo["vendor"] = "XL";
|
||||||
|
index = index + 20;
|
||||||
|
// AppLog.log('厂商名称 vendorStr:$vendorStr');
|
||||||
|
|
||||||
|
// 锁设备类型
|
||||||
|
final int product = reply.data[index];
|
||||||
|
state.lockInfo['product'] = product;
|
||||||
|
index = index + 1;
|
||||||
|
// AppLog.log('锁设备类型 product:$product');
|
||||||
|
|
||||||
|
// 产品名称
|
||||||
|
final List<int> model = reply.data.sublist(index, index + 20);
|
||||||
|
final String modelStr = utf8String(model);
|
||||||
|
state.lockInfo['model'] = modelStr;
|
||||||
|
// state.lockInfo["model"] = "JL-BLE-01";
|
||||||
|
index = index + 20;
|
||||||
|
// AppLog.log('产品名称 mmodelStr:$modelStr');
|
||||||
|
|
||||||
|
// 软件版本
|
||||||
|
final List<int> fwVersion = reply.data.sublist(index, index + 20);
|
||||||
|
final String fwVersionStr = utf8String(fwVersion);
|
||||||
|
state.lockInfo['fwVersion'] = fwVersionStr;
|
||||||
|
index = index + 20;
|
||||||
|
// AppLog.log('软件版本 fwVersionStr:$fwVersionStr');
|
||||||
|
|
||||||
|
// 硬件版本
|
||||||
|
final List<int> hwVersion = reply.data.sublist(index, index + 20);
|
||||||
|
final String hwVersionStr = utf8String(hwVersion);
|
||||||
|
state.lockInfo['hwVersion'] = hwVersionStr;
|
||||||
|
index = index + 20;
|
||||||
|
// AppLog.log('硬件版本 hwVersionStr:$hwVersionStr');
|
||||||
|
|
||||||
|
// 厂商序列号
|
||||||
|
final List<int> serialNum0 = reply.data.sublist(index, index + 16);
|
||||||
|
final String serialNum0Str = utf8String(serialNum0);
|
||||||
|
state.lockInfo['serialNum0'] = serialNum0Str;
|
||||||
|
// state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}";
|
||||||
|
index = index + 16;
|
||||||
|
// AppLog.log('厂商序列号 serialNum0Str:$serialNum0Str');
|
||||||
|
final response = await StartCompanyApi.to.getAuthorizationCode(
|
||||||
|
registerKey: state.registerKey.value,
|
||||||
|
model: modelStr,
|
||||||
|
serialNum0: serialNum0Str,
|
||||||
|
platform: 1,
|
||||||
|
);
|
||||||
|
if (response.errorCode!.codeIsSuccessful) {
|
||||||
|
BlueManage().blueSendData(
|
||||||
|
BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState connectionState) async {
|
||||||
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
|
IoSenderManage.sendAuthorizationCode(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
uuid: response.data?.extraParams?['uuid'],
|
||||||
|
key: response.data?.authCode,
|
||||||
|
mac: response.data?.extraParams?['mac'],
|
||||||
|
platform: 1,
|
||||||
|
utcTimeStamp: getUTCNetTime(),
|
||||||
|
);
|
||||||
|
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isAddEquipment: true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
|
//无权限
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
utcTimeStamp: 0,
|
||||||
|
unixTimeStamp: 0,
|
||||||
|
isBeforeAddUser: false,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void savePlatFormSetting() {
|
||||||
|
if (state.selectPlatFormIndex.value == 1) {
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(
|
||||||
|
BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState connectionState) async {
|
||||||
|
if (connectionState == BluetoothConnectionState.connected) {
|
||||||
|
IoSenderManage.readRegisterKey(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
);
|
||||||
|
} else if (connectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
showToast('目前只支持切换至涂鸦智能协议'.tr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 查询TPP支持
|
||||||
|
Future<void> getActivateInfo() async {
|
||||||
|
final model = state.lockSetInfoData.value.lockBasicInfo?.model;
|
||||||
|
if (model != null && model != '') {
|
||||||
|
final response = await StartCompanyApi.to.getTppSupport(model: model);
|
||||||
|
if (response.errorCode!.codeIsSuccessful) {
|
||||||
|
response.data?.forEach((element) {
|
||||||
|
state.tppSupportList.add(element);
|
||||||
|
});
|
||||||
|
state.tppSupportList.refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _handleReadRegisterKeyReply(SenderReadRegisterKeyCommandReply reply) {
|
||||||
|
final int status = reply.data[6];
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
// 提取 RegisterKey (从第7个字节开始,长度为40)
|
||||||
|
final List<int> registerKeyBytes = reply.data.sublist(7, 47);
|
||||||
|
final String registerKey = String.fromCharCodes(registerKeyBytes);
|
||||||
|
|
||||||
|
print('Register Key: $registerKey');
|
||||||
|
state.registerKey.value = registerKey;
|
||||||
|
if (registerKey.isNotEmpty) {
|
||||||
|
_requestAuthorizationCode();
|
||||||
|
}
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _requestAuthorizationCode() async {
|
||||||
|
showEasyLoading();
|
||||||
|
showBlueConnetctToastTimer(action: () {
|
||||||
|
dismissEasyLoading();
|
||||||
|
});
|
||||||
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
IoSenderManage.senderGetStarLockStatuInfo(
|
||||||
|
lockID: BlueManage().connectDeviceName,
|
||||||
|
userID: await Storage.getUid(),
|
||||||
|
utcTimeStamp: 0,
|
||||||
|
unixTimeStamp: 0,
|
||||||
|
isBeforeAddUser: false,
|
||||||
|
privateKey: getPrivateKeyList,
|
||||||
|
);
|
||||||
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
|
//失败
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _handleAuthorizationCodeReply(SenderAuthorizationCodeCommandReply reply) {
|
||||||
|
final int status = reply.data[6];
|
||||||
|
switch (status) {
|
||||||
|
case 0x00:
|
||||||
|
//成功
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
dismissEasyLoading();
|
||||||
|
showToast('操作成功,请在24小时内用涂鸦APP添加门锁,否则将过期'.tr);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
//失败
|
||||||
|
dismissEasyLoading();
|
||||||
|
cancelBlueConnetctToastTimer();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,42 +45,56 @@ class _ThirdPartyPlatformPageState extends State<ThirdPartyPlatformPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildBody() {
|
Widget _buildBody() {
|
||||||
return Stack(
|
return SingleChildScrollView(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minHeight: MediaQuery.of(context).size.height - 100.h,
|
||||||
|
),
|
||||||
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
// 1. 背景或空白区域(可选)
|
// 1. 背景或空白区域(可选)
|
||||||
Container(
|
Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
padding: EdgeInsets.all(16.w),
|
padding: EdgeInsets.all(16.w),
|
||||||
),
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 30.h,
|
||||||
|
left: 50.w,
|
||||||
|
child: Image.asset(
|
||||||
|
'images/other/tuya.png',
|
||||||
|
height: 80.h,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 130.h,
|
||||||
|
left: 150.w,
|
||||||
|
right: 150.w,
|
||||||
|
child: Image.asset(
|
||||||
|
'images/other/2.png',
|
||||||
|
height: 220.h,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
// 2. 顶部图标行:使用 Row 并排显示
|
// 2. 顶部图标行:使用 Row 并排显示
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 80.h,
|
top: 400.h,
|
||||||
left: 0,
|
right: 50.w,
|
||||||
right: 0,
|
child: Column(
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, // 均匀分布
|
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
|
||||||
'images/other/tuya.png',
|
|
||||||
height: 50.h,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
Image.asset(
|
|
||||||
'images/other/2.png', // 中间图标
|
|
||||||
height: 80.h,
|
|
||||||
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
Image.asset(
|
Image.asset(
|
||||||
'images/other/matter.png',
|
'images/other/matter.png',
|
||||||
width: 110.w,
|
width: 280.w,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 220.h,
|
top: 530.h,
|
||||||
left: 20.w,
|
left: 20.w,
|
||||||
right: 20.w,
|
right: 20.w,
|
||||||
child: Text(
|
child: Text(
|
||||||
@ -97,7 +111,7 @@ class _ThirdPartyPlatformPageState extends State<ThirdPartyPlatformPage> {
|
|||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
top: 320.h,
|
top: 620.h,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: state.platFormSet.length,
|
itemCount: state.platFormSet.length,
|
||||||
@ -146,6 +160,8 @@ class _ThirdPartyPlatformPageState extends State<ThirdPartyPlatformPage> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:get/get_rx/get_rx.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/lockDetail/ActivateInfoResponse.dart';
|
||||||
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||||
import 'package:star_lock/translations/app_dept.dart';
|
import 'package:star_lock/translations/app_dept.dart';
|
||||||
|
|
||||||
@ -11,6 +13,7 @@ class ThirdPartyPlatformState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
|
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
|
||||||
|
int differentialTime = 0;// 服务器时间即UTC+0时间
|
||||||
|
|
||||||
// 响应式字符串集合(自动触发 UI 更新)
|
// 响应式字符串集合(自动触发 UI 更新)
|
||||||
final RxList<String> platFormSet = List.of({
|
final RxList<String> platFormSet = List.of({
|
||||||
@ -19,7 +22,11 @@ class ThirdPartyPlatformState {
|
|||||||
'Matter'.tr,
|
'Matter'.tr,
|
||||||
}).obs;
|
}).obs;
|
||||||
|
|
||||||
RxInt selectPlatFormIndex = 0.obs;
|
// 响应式字符串集合(自动触发 UI 更新)
|
||||||
|
final RxList<TppSupportInfo> tppSupportList = RxList<TppSupportInfo>([]);
|
||||||
|
|
||||||
|
RxInt selectPlatFormIndex = 1.obs;
|
||||||
|
RxString registerKey = ''.obs;
|
||||||
|
|
||||||
|
Map lockInfo = {};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -300,7 +300,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
'\n' +
|
'\n' +
|
||||||
'有效期'.tr +
|
'有效期'.tr +
|
||||||
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
||||||
'这是单次密码,只能使用一次\n';
|
'${'这是单次密码,只能使用一次'.tr}\n';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
@ -309,8 +309,8 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
':' +
|
':' +
|
||||||
'永久'.tr +
|
'永久'.tr +
|
||||||
'\n' +
|
'\n' +
|
||||||
'\n注:\n' +
|
'\n${'注:'.tr}\n' +
|
||||||
'必需在开始时间24小时内使用一次,否则将失效\n';
|
'${'必需在开始时间24小时内使用一次,否则将失效'.tr}\n';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
@ -324,7 +324,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
||||||
'\n' +
|
'\n' +
|
||||||
'\n注:\n' +
|
'\n注:\n' +
|
||||||
'必需在开始时间24小时内使用一次,否则将失效\n';
|
'${'必需在开始时间24小时内使用一次,否则将失效'.tr}\n';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
@ -453,9 +453,10 @@ class PasswordKeyDetailLogic extends BaseGetXController {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
// return '您好,您的密码是'.tr + ':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}';
|
// return '您好,您的密码是'.tr + ':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}';
|
||||||
return '您好' +
|
return '您好'.tr +
|
||||||
',\n您的开门密码是' +
|
',\n${'您的开门密码是'.tr}' +
|
||||||
':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}\n\n开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标';
|
':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}\n'
|
||||||
|
'\n${'开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标'.tr}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@ -46,32 +46,24 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
} else if (state.widgetType.value == 1) {
|
} else if (state.widgetType.value == 1) {
|
||||||
//限时
|
//限时
|
||||||
// 鑫鸿佳不需要生效时间
|
// 鑫鸿佳不需要生效时间
|
||||||
if (CommonDataManage().currentKeyInfo.vendor ==
|
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XHJ &&
|
||||||
IoModelVendor.vendor_XHJ &&
|
(CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_SYD ||
|
||||||
(CommonDataManage().currentKeyInfo.model ==
|
CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_JL)) {
|
||||||
IoModelVendor.model_XHJ_SYD ||
|
if (endDate <= DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||||
CommonDataManage().currentKeyInfo.model ==
|
|
||||||
IoModelVendor.model_XHJ_JL)) {
|
|
||||||
if (endDate <=
|
|
||||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
|
||||||
showToast('失效时间要大于当前时间'.tr);
|
showToast('失效时间要大于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//endDate 设置当天凌晨 0 点
|
//endDate 设置当天凌晨 0 点
|
||||||
final DateTime now = DateTime.now();
|
final DateTime now = DateTime.now();
|
||||||
startDate =
|
startDate = DateTime(now.year, now.month, now.day).millisecondsSinceEpoch;
|
||||||
DateTime(now.year, now.month, now.day).millisecondsSinceEpoch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 芯连需要生效时间
|
// 芯连需要生效时间
|
||||||
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
||||||
(CommonDataManage().currentKeyInfo.model ==
|
(CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE ||
|
||||||
IoModelVendor.model_XL_BLE ||
|
CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)) {
|
||||||
CommonDataManage().currentKeyInfo.model ==
|
|
||||||
IoModelVendor.model_XL_WIFI)) {
|
|
||||||
//限时
|
//限时
|
||||||
if (startDate <
|
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
|
||||||
showToast('生效时间不能小于当前时间'.tr);
|
showToast('生效时间不能小于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -91,12 +83,9 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
//循环
|
//循环
|
||||||
// 芯连需要结束时间
|
// 芯连需要结束时间
|
||||||
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
||||||
(CommonDataManage().currentKeyInfo.model ==
|
(CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE ||
|
||||||
IoModelVendor.model_XL_BLE ||
|
CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)) {
|
||||||
CommonDataManage().currentKeyInfo.model ==
|
if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||||
IoModelVendor.model_XL_WIFI)) {
|
|
||||||
if (endDate <
|
|
||||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
|
||||||
showToast('结束时间不能小于当前时间'.tr);
|
showToast('结束时间不能小于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -166,10 +155,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
//是否为永久
|
//是否为永久
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
getKeyType = '3';
|
getKeyType = '3';
|
||||||
getEffectiveDateTime =
|
getEffectiveDateTime = DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
|
||||||
DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
|
getFailureDateTime = DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
|
||||||
getFailureDateTime =
|
|
||||||
DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
|
|
||||||
}
|
}
|
||||||
final PasswordKeyEntity entity = await ApiRepository.to.addPasswordKey(
|
final PasswordKeyEntity entity = await ApiRepository.to.addPasswordKey(
|
||||||
lockId: lockId,
|
lockId: lockId,
|
||||||
@ -184,8 +171,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name': BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':
|
'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
|
||||||
'date': DateTool().getNowDateWithType(1),
|
'date': DateTool().getNowDateWithType(1),
|
||||||
'add_password_result': '成功',
|
'add_password_result': '成功',
|
||||||
});
|
});
|
||||||
@ -202,8 +188,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
} else {
|
} else {
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name': BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':
|
'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
|
||||||
'date': DateTool().getNowDateWithType(1),
|
'date': DateTool().getNowDateWithType(1),
|
||||||
'add_password_result': '${entity.errorMsg}',
|
'add_password_result': '${entity.errorMsg}',
|
||||||
});
|
});
|
||||||
@ -230,8 +215,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
showToast('请输入密码'.tr);
|
showToast('请输入密码'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final PasswordKeyEntity entity =
|
final PasswordKeyEntity entity = await ApiRepository.to.checkKeyboardpwdName(
|
||||||
await ApiRepository.to.checkKeyboardpwdName(
|
|
||||||
lockId: state.keyInfo.value.lockId.toString(),
|
lockId: state.keyInfo.value.lockId.toString(),
|
||||||
keyboardPwdName: state.nameController.text,
|
keyboardPwdName: state.nameController.text,
|
||||||
keyboardPwd: state.pwdController.text,
|
keyboardPwd: state.pwdController.text,
|
||||||
@ -246,16 +230,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
|
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription =
|
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
|
||||||
// 设置自定义密码
|
// 设置自定义密码
|
||||||
if ((reply is SenderCustomPasswordsReply) &&
|
if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
||||||
(state.ifCurrentScreen.value == true)) {
|
|
||||||
BuglyTool.uploadException(
|
BuglyTool.uploadException(
|
||||||
message: '添加密码结果,解析数据',
|
message: '添加密码结果,解析数据', detail: '添加密码结果,解析数据:${reply.data}', eventStr: '添加密码事件结果', upload: true);
|
||||||
detail: '添加密码结果,解析数据:${reply.data}',
|
|
||||||
eventStr: '添加密码事件结果',
|
|
||||||
upload: true);
|
|
||||||
|
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@ -305,20 +284,14 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
final List<String> saveStrList = changeIntListToStringList(token);
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
final List<int> getPrivateKeyList =
|
|
||||||
changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? signKey =
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
await Storage.getStringList(saveBlueSignKey);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
final List<int> signKeyDataList =
|
|
||||||
changeStringListToIntList(signKey!);
|
|
||||||
|
|
||||||
int startDate =
|
int startDate = DateTool().dateToTimestamp(state.customBeginTime.value, 1);
|
||||||
DateTool().dateToTimestamp(state.customBeginTime.value, 1);
|
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||||
int endDate =
|
|
||||||
DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
|
||||||
//非永久 须有时限
|
//非永久 须有时限
|
||||||
if (state.isPermanent.value == true) {
|
if (state.isPermanent.value == true) {
|
||||||
startDate = 0;
|
startDate = 0;
|
||||||
@ -367,8 +340,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||||
//非永久 须有时限
|
//非永久 须有时限
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
if (startDate <
|
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) {
|
||||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) {
|
|
||||||
showToast('生效时间需晚于当前时间'.tr);
|
showToast('生效时间需晚于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -382,8 +354,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
endDate = 0;
|
endDate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.pwdController.text.length < 6 ||
|
if (state.pwdController.text.length < 6 || state.pwdController.text.length > 9) {
|
||||||
state.pwdController.text.length > 9) {
|
|
||||||
showToast('请输入6-9位数字'.tr);
|
showToast('请输入6-9位数字'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -396,8 +367,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
@ -424,8 +394,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
final String getMobile = (await Storage.getMobile())!;
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name': BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':
|
'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
|
||||||
'date': DateTool().getNowDateWithType(1),
|
'date': DateTool().getNowDateWithType(1),
|
||||||
'add_password_result': '添加自定义密码超时',
|
'add_password_result': '添加自定义密码超时',
|
||||||
});
|
});
|
||||||
@ -439,17 +408,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||||
(BluetoothConnectionState deviceConnectionState) async {
|
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? signKey =
|
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
await Storage.getStringList(saveBlueSignKey);
|
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey =
|
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
await Storage.getStringList(saveBluePrivateKey);
|
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
final List<int> getPrivateKeyList =
|
|
||||||
changeStringListToIntList(privateKey!);
|
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
@ -469,13 +434,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
} else if (deviceConnectionState ==
|
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||||
BluetoothConnectionState.disconnected) {
|
|
||||||
final String getMobile = (await Storage.getMobile())!;
|
final String getMobile = (await Storage.getMobile())!;
|
||||||
ApmHelper.instance.trackEvent('add_password', {
|
ApmHelper.instance.trackEvent('add_password', {
|
||||||
'lock_name': BlueManage().connectDeviceName,
|
'lock_name': BlueManage().connectDeviceName,
|
||||||
'account':
|
'account': getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
||||||
getMobile.isNotEmpty ? getMobile : (await Storage.getEmail())!,
|
|
||||||
'date': DateTool().getNowDateWithType(1),
|
'date': DateTool().getNowDateWithType(1),
|
||||||
'add_password_result': '添加自定义密码断开',
|
'add_password_result': '添加自定义密码断开',
|
||||||
});
|
});
|
||||||
@ -517,17 +480,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
'\n' +
|
'\n' +
|
||||||
'有效期'.tr +
|
'有效期'.tr +
|
||||||
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
':${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}\n\n' +
|
||||||
'这是单次密码,只能使用一次\n';
|
'${'这是单次密码,只能使用一次'.tr}\n';
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '永久'.tr + '\n' + '\n注:\n' + '${'必需在开始时间24小时内使用一次,否则将失效'.tr}\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'永久'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n注:\n' +
|
|
||||||
'必需在开始时间24小时内使用一次,否则将失效\n';
|
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
@ -540,15 +497,14 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
'有效期'.tr +
|
'有效期'.tr +
|
||||||
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
':${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}' +
|
||||||
'\n' +
|
'\n' +
|
||||||
'\n注:\n' +
|
'\n${'注:'.tr}\n' +
|
||||||
'必需在开始时间24小时内使用一次,否则将失效\n';
|
'${'必需在开始时间24小时内使用一次,否则将失效'.tr}\n';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//自定义
|
//自定义
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
useDateStr = '类型'.tr +
|
useDateStr =
|
||||||
':' +
|
'类型'.tr + ':' + '自定义-限时\n${'有效期'.tr}:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
||||||
'自定义-限时\n${'有效期'.tr}:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
|
||||||
} else {
|
} else {
|
||||||
useDateStr = '类型:自定义-永久'.tr;
|
useDateStr = '类型:自定义-永久'.tr;
|
||||||
}
|
}
|
||||||
@ -559,171 +515,51 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周末'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周末'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '每日'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'每日'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '工作日'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'工作日'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周一'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周一'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周二'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周二'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周三'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周三'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周四'.tr + ' $starHour:00 -$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周四'.tr +
|
|
||||||
' $starHour:00 -$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周五'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周五'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周六'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周六'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
//周日循环 14 每周日开始和结束时间指定时间段内有效
|
//周日循环 14 每周日开始和结束时间指定时间段内有效
|
||||||
useDateStr = '\n' +
|
useDateStr = '\n' + '类型'.tr + ':' + '循环'.tr + '\n' + '\n' + '周日'.tr + ' $starHour:00-$endHour:00' + '\n';
|
||||||
'类型'.tr +
|
|
||||||
':' +
|
|
||||||
'循环'.tr +
|
|
||||||
'\n' +
|
|
||||||
'\n' +
|
|
||||||
'周日'.tr +
|
|
||||||
' $starHour:00-$endHour:00' +
|
|
||||||
'\n';
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
// return '您好,您的密码是'.tr + ':${state.itemData.value.keyboardPwd}\n$useDateStr\n${'密码名字'.tr}:${state.itemData.value.keyboardPwdName}';
|
|
||||||
return '您好' +
|
return '您好'.tr +
|
||||||
',\n您的开门密码是' +
|
',\n${'您的开门密码是'.tr}' +
|
||||||
':${state.getPwdStr.value}\n$useDateStr\n${'密码名字'.tr}:${state.pwdNameStr}\n\n开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标';
|
':${state.getPwdStr.value}\n$useDateStr\n${'密码名字'.tr}:${state.pwdNameStr}\n'
|
||||||
// switch (getPwdType) {
|
'\n${'开锁时,先激活锁键盘,再输入密码,以#号结束,#号键在键盘右下角,有可能是其他图标'.tr}';
|
||||||
// case 0:
|
|
||||||
// // 永久 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
|
||||||
// useDateStr = '类型'.tr + ':' + '永久';
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// //限时 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
|
||||||
// useDateStr = '类型'.tr +
|
|
||||||
// ':' +
|
|
||||||
// '限时\n${'有效期'.tr}:${state.beginTime.value} -- ${state.endTime.value}';
|
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// //单次 只能在开始时间后6小时内使用一次
|
|
||||||
// useDateStr = '类型'.tr +
|
|
||||||
// ':' +
|
|
||||||
// '单次\n${'有效期'.tr}:${state.beginTime.value} -- ${state.endTime.value}';
|
|
||||||
// break;
|
|
||||||
// case 3:
|
|
||||||
// //自定义
|
|
||||||
// if (state.isPermanent.value == false) {
|
|
||||||
// useDateStr = '类型'.tr +
|
|
||||||
// ':' +
|
|
||||||
// '自定义-限时\n${'有效期'.tr}:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
|
||||||
// } else {
|
|
||||||
// useDateStr = '类型:自定义-永久'.tr;
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// case 4:
|
|
||||||
// //周未循环 在周未开始和结束时间指定时间段内有效
|
|
||||||
// useDateStr = '类型'.tr +
|
|
||||||
// ':' +
|
|
||||||
// '循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}';
|
|
||||||
// break;
|
|
||||||
// case 5:
|
|
||||||
// //删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
|
||||||
// useDateStr = '类型:清空';
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// default:
|
|
||||||
// }
|
|
||||||
// return '${'您好,您的密码是'.tr}:${state.getPwdStr.value}\n$useDateStr\n${'密码名字'.tr}:${state.pwdNameStr}';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String addSpaces(String input) {
|
String addSpaces(String input) {
|
||||||
|
|||||||
@ -36,13 +36,13 @@ class _LockListGroupViewState extends State<LockListGroupView> {
|
|||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
// Container(
|
||||||
color: widget.backgroundColor ?? Colors.white,
|
// color: widget.backgroundColor ?? Colors.white,
|
||||||
height: 80.h,
|
// height: 80.h,
|
||||||
child: Row(
|
// child: Row(
|
||||||
children: _buildExpandRowList(),
|
// children: _buildExpandRowList(),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
ClipRect(
|
ClipRect(
|
||||||
child: AnimatedAlign(
|
child: AnimatedAlign(
|
||||||
heightFactor: _isExpanded ? 1.0 : 0.0,
|
heightFactor: _isExpanded ? 1.0 : 0.0,
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/main/lockMian/lockList/lockList_state.dart';
|
import 'package:star_lock/main/lockMian/lockList/lockList_state.dart';
|
||||||
|
|
||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
@ -14,8 +16,7 @@ import 'lockListGroup_view.dart';
|
|||||||
import 'lockList_logic.dart';
|
import 'lockList_logic.dart';
|
||||||
|
|
||||||
class LockListPage extends StatefulWidget {
|
class LockListPage extends StatefulWidget {
|
||||||
const LockListPage({required this.lockListInfoGroupEntity, Key? key})
|
const LockListPage({required this.lockListInfoGroupEntity, Key? key}) : super(key: key);
|
||||||
: super(key: key);
|
|
||||||
final LockListInfoGroupEntity lockListInfoGroupEntity;
|
final LockListInfoGroupEntity lockListInfoGroupEntity;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -30,15 +31,53 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
logic = Get.put(LockListLogic(widget.lockListInfoGroupEntity));
|
logic = Get.put(LockListLogic(widget.lockListInfoGroupEntity));
|
||||||
state = Get
|
state = Get.find<LockListLogic>().state;
|
||||||
.find<LockListLogic>()
|
|
||||||
.state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Obx(() => Scaffold(
|
return Obx(
|
||||||
body: ListView.separated(
|
() => Scaffold(
|
||||||
|
body: SafeArea(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Image.asset('images/icon_main_drlock_1024.png', width: 68.w, height: 68.w),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
F.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
//实现回调函数
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context,
|
||||||
|
Routers.selectLockTypePage,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.add_circle_outline_rounded,
|
||||||
|
size: 48.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ListView.separated(
|
||||||
itemCount: logic.groupDataListFiltered.length,
|
itemCount: logic.groupDataListFiltered.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
final GroupList itemData = logic.groupDataListFiltered[index];
|
final GroupList itemData = logic.groupDataListFiltered[index];
|
||||||
@ -51,20 +90,25 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
height: 1,
|
height: 1,
|
||||||
color: AppColors.greyLineColor,
|
color: AppColors.greyLineColor,
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备多层级列表
|
//设备多层级列表
|
||||||
Widget _buildLockExpandedList(BuildContext context, int index,
|
Widget _buildLockExpandedList(BuildContext context, int index, GroupList itemData, {Key? key}) {
|
||||||
GroupList itemData, {Key? key}) {
|
final List<LockListInfoItemEntity> lockItemList = itemData.lockList ?? <LockListInfoItemEntity>[];
|
||||||
final List<LockListInfoItemEntity> lockItemList =
|
|
||||||
itemData.lockList ?? <LockListInfoItemEntity>[];
|
|
||||||
return LockListGroupView(
|
return LockListGroupView(
|
||||||
key: key,
|
key: key,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
//是否选中组
|
//是否选中组
|
||||||
if (itemData.isChecked) {} else {}
|
if (itemData.isChecked) {
|
||||||
|
} else {}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
typeImgList: const <dynamic>[],
|
typeImgList: const <dynamic>[],
|
||||||
@ -104,8 +148,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
child: lockInfoListItem(keyInfo, isLast, () {
|
child: lockInfoListItem(keyInfo, isLast, () {
|
||||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
(keyInfo.keyStatus ==
|
(keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)) {
|
||||||
XSConstantMacro.keyStatusWaitIneffective)) {
|
|
||||||
logic.showToast('您的钥匙未生效'.tr);
|
logic.showToast('您的钥匙未生效'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -122,8 +165,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
logic.showToast('您的钥匙已过期'.tr);
|
logic.showToast('您的钥匙已过期'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Get.toNamed(Routers.lockDetailMainPage,
|
Get.toNamed(Routers.lockDetailMainPage, arguments: <String, Object>{
|
||||||
arguments: <String, Object>{
|
|
||||||
// "lockMainEntity": widget.lockMainEntity,
|
// "lockMainEntity": widget.lockMainEntity,
|
||||||
'keyInfo': keyInfo,
|
'keyInfo': keyInfo,
|
||||||
'isOnlyOneData': false,
|
'isOnlyOneData': false,
|
||||||
@ -134,8 +176,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget lockInfoListItem(LockListInfoItemEntity keyInfo, bool isLast,
|
Widget lockInfoListItem(LockListInfoItemEntity keyInfo, bool isLast, Function() action) {
|
||||||
Function() action) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -144,14 +185,10 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w)
|
? EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w, bottom: 20.w)
|
||||||
: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: (((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
color: (((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
(keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective ||
|
||||||
(keyInfo.keyStatus ==
|
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen ||
|
||||||
XSConstantMacro.keyStatusWaitIneffective ||
|
keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) ||
|
||||||
keyInfo.keyStatus ==
|
|
||||||
XSConstantMacro.keyStatusFrozen ||
|
|
||||||
keyInfo.keyStatus ==
|
|
||||||
XSConstantMacro.keyStatusExpired)) ||
|
|
||||||
(keyInfo.keyType == XSConstantMacro.keyTypeLong &&
|
(keyInfo.keyType == XSConstantMacro.keyTypeLong &&
|
||||||
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen))
|
keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen))
|
||||||
? AppColors.greyBackgroundColor
|
? AppColors.greyBackgroundColor
|
||||||
@ -193,8 +230,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
SizedBox(width: 2.w),
|
SizedBox(width: 2.w),
|
||||||
Text(
|
Text(
|
||||||
'${keyInfo.electricQuantity!}%',
|
'${keyInfo.electricQuantity!}%',
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
],
|
],
|
||||||
@ -211,10 +247,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
borderRadius: BorderRadius.circular(5.w),
|
borderRadius: BorderRadius.circular(5.w),
|
||||||
color: AppColors.openPassageModeColor,
|
color: AppColors.openPassageModeColor,
|
||||||
),
|
),
|
||||||
child: Text('常开模式开启'.tr,
|
child: Text('常开模式开启'.tr, style: TextStyle(fontSize: 18.sp, color: AppColors.appBarIconColor)),
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18.sp,
|
|
||||||
color: AppColors.appBarIconColor)),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
@ -226,8 +259,7 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
Text(
|
Text(
|
||||||
'远程开锁'.tr,
|
'远程开锁'.tr,
|
||||||
style: TextStyle(
|
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
@ -241,13 +273,11 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
padding: EdgeInsets.only(right: 5.w, left: 5.w),
|
padding: EdgeInsets.only(right: 5.w, left: 5.w),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(5.w),
|
borderRadius: BorderRadius.circular(5.w),
|
||||||
color:
|
color: DateTool().compareTimeIsOvertime(keyInfo.endDate!)
|
||||||
DateTool().compareTimeIsOvertime(keyInfo.endDate!)
|
|
||||||
? AppColors.listTimeYellowColor
|
? AppColors.listTimeYellowColor
|
||||||
: AppColors.mainColor,
|
: AppColors.mainColor,
|
||||||
),
|
),
|
||||||
child: Text(logic.getKeyEffective(keyInfo),
|
child: Text(logic.getKeyEffective(keyInfo), style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
||||||
style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
|
||||||
// child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
// child: Text(logic.compareTimeIsOvertime(keyInfo.endDate!) ? "已过期" : "余${logic.compareTimeGetDaysFromNow(keyInfo.endDate!)}天", style: TextStyle(fontSize: 18.sp, color: Colors.white)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -258,13 +288,8 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
Text(
|
Text(
|
||||||
"${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate,
|
"${logic.getUseKeyTypeStr(keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)}/${keyInfo.isLockOwner == 1 ? '超级管理员'.tr : (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr)}",
|
||||||
keyInfo.keyType)}/${keyInfo.isLockOwner == 1
|
style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||||
? '超级管理员'.tr
|
|
||||||
: (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户"
|
|
||||||
.tr)}",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -286,13 +311,10 @@ class _LockListPageState extends State<LockListPage> with RouteAware {
|
|||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
Get.delete<LockListLogic>();
|
Get.delete<LockListLogic>();
|
||||||
|
|
||||||
/// 取消路由订阅
|
/// 取消路由订阅
|
||||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||||
super
|
super.dispose();
|
||||||
.
|
|
||||||
dispose
|
|
||||||
(
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 从上级界面进入 当前界面即将出现
|
/// 从上级界面进入 当前界面即将出现
|
||||||
|
|||||||
@ -23,8 +23,11 @@ import 'package:star_lock/tools/submitBtn.dart';
|
|||||||
import '../../../appRouters.dart';
|
import '../../../appRouters.dart';
|
||||||
import '../../../baseWidget.dart';
|
import '../../../baseWidget.dart';
|
||||||
import '../../../flavors.dart';
|
import '../../../flavors.dart';
|
||||||
|
import '../../../mine/addLock/selectLockType/selectLockType_logic.dart';
|
||||||
|
import '../../../mine/message/messageList/messageList_page.dart';
|
||||||
import '../../../mine/mine/starLockMine_page.dart';
|
import '../../../mine/mine/starLockMine_page.dart';
|
||||||
import '../../../tools/EasyRefreshTool.dart';
|
import '../../../tools/EasyRefreshTool.dart';
|
||||||
|
import '../../../tools/commonDataManage.dart';
|
||||||
import '../../../tools/eventBusEventManage.dart';
|
import '../../../tools/eventBusEventManage.dart';
|
||||||
import '../../../tools/storage.dart';
|
import '../../../tools/storage.dart';
|
||||||
import '../../../tools/titleAppBar.dart';
|
import '../../../tools/titleAppBar.dart';
|
||||||
@ -34,8 +37,7 @@ import '../lockList/lockList_page.dart';
|
|||||||
import 'lockMain_logic.dart';
|
import 'lockMain_logic.dart';
|
||||||
|
|
||||||
class StarLockMainPage extends StatefulWidget {
|
class StarLockMainPage extends StatefulWidget {
|
||||||
StarLockMainPage({Key? key, this.showAppBar = true, this.showDrawer = true})
|
StarLockMainPage({Key? key, this.showAppBar = true, this.showDrawer = true}) : super(key: key);
|
||||||
: super(key: key);
|
|
||||||
bool showAppBar;
|
bool showAppBar;
|
||||||
bool showDrawer;
|
bool showDrawer;
|
||||||
|
|
||||||
@ -48,16 +50,15 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
final LockMainLogic logic = Get.put(LockMainLogic());
|
final LockMainLogic logic = Get.put(LockMainLogic());
|
||||||
final LockMainState state = Get.find<LockMainLogic>().state;
|
final LockMainState state = Get.find<LockMainLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData(
|
final SelectLockTypeLogic logicType = Get.put(SelectLockTypeLogic());
|
||||||
{bool clearScanDevices = false, bool isUnShowLoading = false}) async {
|
|
||||||
LockListInfoGroupEntity? lockListInfoGroupEntity =
|
Future<void> getHttpData({bool clearScanDevices = false, bool isUnShowLoading = false}) async {
|
||||||
await Storage.getLockMainListData();
|
LockListInfoGroupEntity? lockListInfoGroupEntity = await Storage.getLockMainListData();
|
||||||
if (lockListInfoGroupEntity != null) {
|
if (lockListInfoGroupEntity != null) {
|
||||||
await logic.loadMainDataLogic(lockListInfoGroupEntity);
|
await logic.loadMainDataLogic(lockListInfoGroupEntity);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
lockListInfoGroupEntity =
|
lockListInfoGroupEntity = (await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading)).data;
|
||||||
(await logic.getStarLockInfo(isUnShowLoading: isUnShowLoading)).data;
|
|
||||||
if (lockListInfoGroupEntity != null) {
|
if (lockListInfoGroupEntity != null) {
|
||||||
await logic.loadMainDataLogic(lockListInfoGroupEntity);
|
await logic.loadMainDataLogic(lockListInfoGroupEntity);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -89,7 +90,8 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GetBuilder<LockMainLogic>(builder: (LockMainLogic logic) {
|
return GetBuilder<LockMainLogic>(builder: (LockMainLogic logic) {
|
||||||
Widget child = EasyRefreshTool(
|
Widget child = Obx(
|
||||||
|
() => EasyRefreshTool(
|
||||||
onRefresh: () {
|
onRefresh: () {
|
||||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||||
// 更新状态的代码
|
// 更新状态的代码
|
||||||
@ -98,37 +100,44 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
// child: getDataReturnUI(state.dataLength.value));
|
// child: getDataReturnUI(state.dataLength.value));
|
||||||
child: getDataReturnUI(state.dataLength.value));
|
child: getDataReturnUI(state.dataLength.value),
|
||||||
|
),
|
||||||
|
);
|
||||||
if (widget.showAppBar || widget.showDrawer) {
|
if (widget.showAppBar || widget.showDrawer) {
|
||||||
child = Scaffold(
|
child = Scaffold(
|
||||||
backgroundColor: const Color(0xFFF5F5F5),
|
backgroundColor: Colors.white,
|
||||||
appBar: widget.showAppBar
|
|
||||||
? TitleAppBar(
|
|
||||||
barTitle: F.navTitle,
|
|
||||||
haveBack: false,
|
|
||||||
haveOtherLeftWidget: true,
|
|
||||||
leftWidget: Builder(
|
|
||||||
builder: (BuildContext context) => IconButton(
|
|
||||||
icon: Image.asset(
|
|
||||||
'images/main/mainLeft_menu_icon.png',
|
|
||||||
color: Colors.white,
|
|
||||||
width: 44.w,
|
|
||||||
height: 44.w,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Scaffold.of(context).openDrawer();
|
|
||||||
},
|
|
||||||
)),
|
|
||||||
backgroundColor: AppColors.mainColor,
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
drawer: widget.showDrawer
|
|
||||||
? Drawer(
|
|
||||||
width: 1.sw / 3 * 2,
|
|
||||||
child: const StarLockMinePage(),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
body: child,
|
body: child,
|
||||||
|
bottomNavigationBar: Obx(
|
||||||
|
() => BottomNavigationBar(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
items: <BottomNavigationBarItem>[
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: ImageIcon(
|
||||||
|
AssetImage(state.selectedIndex.value == 0
|
||||||
|
? 'images/icon_device_selected'
|
||||||
|
'.png'
|
||||||
|
: 'images/icon_device_not_selected.png'),
|
||||||
|
), // 使用本地图片
|
||||||
|
label: '设备',
|
||||||
|
),
|
||||||
|
const BottomNavigationBarItem(
|
||||||
|
icon: Icon(Icons.notifications),
|
||||||
|
label: '消息',
|
||||||
|
),
|
||||||
|
const BottomNavigationBarItem(
|
||||||
|
icon: Icon(Icons.person),
|
||||||
|
label: '我的',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onTap: (index) {
|
||||||
|
state.selectedIndex.value = index;
|
||||||
|
},
|
||||||
|
currentIndex: state.selectedIndex.value,
|
||||||
|
selectedItemColor: AppColors.mainColor,
|
||||||
|
unselectedItemColor: Colors.grey,
|
||||||
|
showUnselectedLabels: true, // 显示未选中项的标签
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
child = F.sw(
|
child = F.sw(
|
||||||
@ -149,41 +158,52 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
Widget getDataReturnUI(int type) {
|
Widget getDataReturnUI(int type) {
|
||||||
Widget returnWidget;
|
Widget returnWidget;
|
||||||
|
|
||||||
|
if (state.selectedIndex.value == 0) {
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
type = F.sw(skyCall: () => 1, xhjCall: () => 2);
|
type = F.sw(skyCall: () => 1, xhjCall: () => 2);
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0:
|
case 0:
|
||||||
// 显示无数据模式
|
// 显示无数据模式
|
||||||
returnWidget = unHaveData();
|
returnWidget = MainBg(child: unHaveData());
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// 只有一条数据
|
// 只有一条数据
|
||||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||||
returnWidget = LockDetailPage(
|
returnWidget = MainBg(child: LockDetailPage(
|
||||||
isOnlyOneData: true,
|
isOnlyOneData: true,
|
||||||
lockListInfoItemEntity:
|
lockListInfoItemEntity: state.lockListInfoGroupEntity.value.groupList![0].lockList![0]));
|
||||||
state.lockListInfoGroupEntity.value.groupList![0].lockList![0]);
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// 有多条数据
|
// 有多条数据
|
||||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||||
returnWidget = F.sw(
|
returnWidget = F.sw(
|
||||||
skyCall: () => LockListPage(
|
skyCall: () => MainBg(child: LockListPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)),
|
||||||
lockListInfoGroupEntity: state.lockListInfoGroupEntity.value),
|
xhjCall: () => MainBg(child: LockListXHJPage(lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)));
|
||||||
xhjCall: () => LockListXHJPage(
|
|
||||||
lockListInfoGroupEntity: state.lockListInfoGroupEntity.value));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
returnWidget = NoData();
|
returnWidget = MainBg(child: NoData());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} else if (state.selectedIndex.value == 1) {
|
||||||
|
returnWidget = MainBg(child: MessageListPage());
|
||||||
|
} else {
|
||||||
|
returnWidget = MainBg(child: StarLockMinePage());
|
||||||
|
}
|
||||||
return returnWidget;
|
return returnWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
//鑫泓佳背景
|
//背景
|
||||||
Widget XHJBg({required Widget child}) {
|
Widget MainBg({required Widget child}) {
|
||||||
return Container();
|
return Container(
|
||||||
|
child: child,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage('images/lockMain_bg.jpg'),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget unHaveData() {
|
Widget unHaveData() {
|
||||||
@ -192,6 +212,48 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Image.asset('images/icon_main_drlock_1024.png', width: 68.w, height: 68.w),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
F.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 28.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
//实现回调函数
|
||||||
|
// Navigator.pushNamed(
|
||||||
|
// context,
|
||||||
|
// Routers.selectLockTypePage,
|
||||||
|
// );
|
||||||
|
|
||||||
|
// 跳转到扫描设备页
|
||||||
|
CommonDataManage().seletLockType = 0;
|
||||||
|
logicType.getNearByLimits();
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.add_circle_outline_rounded,
|
||||||
|
size: 48.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 160.h,
|
height: 160.h,
|
||||||
),
|
),
|
||||||
@ -211,10 +273,14 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
//实现回调函数
|
//实现回调函数
|
||||||
Navigator.pushNamed(
|
// Navigator.pushNamed(
|
||||||
context,
|
// context,
|
||||||
Routers.selectLockTypePage,
|
// Routers.selectLockTypePage,
|
||||||
);
|
// );
|
||||||
|
|
||||||
|
// 跳转到扫描设备页
|
||||||
|
CommonDataManage().seletLockType = 0;
|
||||||
|
logicType.getNearByLimits();
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
@ -288,13 +354,9 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
late StreamSubscription _teamEvent;
|
late StreamSubscription _teamEvent;
|
||||||
|
|
||||||
void _initLoadDataAction() {
|
void _initLoadDataAction() {
|
||||||
_teamEvent = eventBus
|
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((RefreshLockListInfoDataEvent event) {
|
||||||
.on<RefreshLockListInfoDataEvent>()
|
|
||||||
.listen((RefreshLockListInfoDataEvent event) {
|
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
getHttpData(
|
getHttpData(clearScanDevices: event.clearScanDevices, isUnShowLoading: event.isUnShowLoading);
|
||||||
clearScanDevices: event.clearScanDevices,
|
|
||||||
isUnShowLoading: event.isUnShowLoading);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,8 +366,7 @@ class _StarLockMainPageState extends State<StarLockMainPage>
|
|||||||
ByteData byteData = await rootBundle.load(assetPath);
|
ByteData byteData = await rootBundle.load(assetPath);
|
||||||
|
|
||||||
// 将 ByteData 转换为 Uint8List
|
// 将 ByteData 转换为 Uint8List
|
||||||
Uint8List uint8List =
|
Uint8List uint8List = Uint8List.sublistView(byteData); //byteData.buffer.asUint8List();
|
||||||
Uint8List.sublistView(byteData); //byteData.buffer.asUint8List();
|
|
||||||
|
|
||||||
// 返回字节数组
|
// 返回字节数组
|
||||||
return uint8List.toList();
|
return uint8List.toList();
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import '../entity/lockListInfo_entity.dart';
|
import '../entity/lockListInfo_entity.dart';
|
||||||
|
|
||||||
class LockMainState {
|
class LockMainState {
|
||||||
|
|
||||||
// 0是无数据 1是有一条数据 2是有很多条数据
|
// 0是无数据 1是有一条数据 2是有很多条数据
|
||||||
RxInt dataLength = 100.obs;
|
RxInt dataLength = 100.obs;
|
||||||
Rx<LockListInfoGroupEntity> lockListInfoGroupEntity = LockListInfoGroupEntity().obs;
|
Rx<LockListInfoGroupEntity> lockListInfoGroupEntity = LockListInfoGroupEntity().obs;
|
||||||
@ -13,5 +11,6 @@ class LockMainState {
|
|||||||
// 网络连接状态 0没有网络 1有网络
|
// 网络连接状态 0没有网络 1有网络
|
||||||
RxInt networkConnectionStatus = 0.obs;
|
RxInt networkConnectionStatus = 0.obs;
|
||||||
|
|
||||||
|
RxInt selectedIndex = 0.obs;
|
||||||
// late Timer timer;
|
// late Timer timer;
|
||||||
}
|
}
|
||||||
@ -29,6 +29,38 @@ class _MessageListPageState extends State<MessageListPage>
|
|||||||
final MessageListLogic logic = Get.put(MessageListLogic());
|
final MessageListLogic logic = Get.put(MessageListLogic());
|
||||||
final MessageListState state = Get.find<MessageListLogic>().state;
|
final MessageListState state = Get.find<MessageListLogic>().state;
|
||||||
|
|
||||||
|
// 修改 _showCheckboxes 状态变量为可观察状态
|
||||||
|
final RxBool _showCheckboxes = false.obs;
|
||||||
|
|
||||||
|
// 添加选中状态
|
||||||
|
final RxList<bool> _selectedItems = <bool>[].obs;
|
||||||
|
|
||||||
|
// 添加控制通知横幅显示的状态
|
||||||
|
bool showNotificationBanner = true;
|
||||||
|
|
||||||
|
// 添加设置状态变量
|
||||||
|
final RxBool _pushNotificationEnabled = false.obs;
|
||||||
|
|
||||||
|
// 删除方法
|
||||||
|
void deleteSelectedMessages() {
|
||||||
|
final List<MessageItemEntity> selectedMessages = [];
|
||||||
|
for (int i = 0; i < state.itemDataList.value.length; i++) {
|
||||||
|
if (_selectedItems[i]) {
|
||||||
|
selectedMessages.add(state.itemDataList.value[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用删除接口
|
||||||
|
//logic.deletMessageDataRequest(selectedMessages);
|
||||||
|
|
||||||
|
// 清空选中状态
|
||||||
|
_selectedItems.clear();
|
||||||
|
_selectedItems.addAll(
|
||||||
|
List.generate(state.itemDataList.value.length, (index) => false));
|
||||||
|
_showCheckboxes.value = false;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
void getHttpData() {
|
void getHttpData() {
|
||||||
logic.messageListDataRequest().then((MessageListEntity value) {
|
logic.messageListDataRequest().then((MessageListEntity value) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -39,9 +71,31 @@ class _MessageListPageState extends State<MessageListPage>
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
// 获取当前消息推送设置状态
|
||||||
|
_loadPushNotificationStatus();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 加载消息推送状态
|
||||||
|
void _loadPushNotificationStatus() async {
|
||||||
|
final bool? enabled = await Storage.getBool('push_notification_enabled');
|
||||||
|
_pushNotificationEnabled.value = enabled ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加以时间分组的方法
|
||||||
|
Map<String, List<MessageItemEntity>> _groupMessagesByDate() {
|
||||||
|
Map<String, List<MessageItemEntity>> grouped = {};
|
||||||
|
state.itemDataList.forEach((item) {
|
||||||
|
String date = DateTool().dateToYMDString(item.createdAt!.toString());
|
||||||
|
if (!grouped.containsKey(date)) {
|
||||||
|
grouped[date] = [];
|
||||||
|
}
|
||||||
|
grouped[date]!.add(item);
|
||||||
|
});
|
||||||
|
return grouped;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -80,20 +134,228 @@ class _MessageListPageState extends State<MessageListPage>
|
|||||||
}, child: Obx(() {
|
}, child: Obx(() {
|
||||||
return state.itemDataList.value.isEmpty
|
return state.itemDataList.value.isEmpty
|
||||||
? NoData()
|
? NoData()
|
||||||
: SlidableAutoCloseBehavior(
|
: Stack(
|
||||||
|
children: [
|
||||||
|
Positioned(
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
child: Container(
|
||||||
|
height: showNotificationBanner ? 100 : 70,
|
||||||
|
child: Column(children: [
|
||||||
|
showNotificationBanner
|
||||||
|
? Container(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(left: 10, right: 10),
|
||||||
|
color: AppColors.messageTipsColor,
|
||||||
|
height: 30,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('开启消息通知开关,及时获取通知',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 20.sp)),
|
||||||
|
Row(children: [
|
||||||
|
!_pushNotificationEnabled.value
|
||||||
|
? GestureDetector(child: Text('去开启',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.blue,
|
||||||
|
fontSize: 20.sp)),
|
||||||
|
onTap: (){
|
||||||
|
|
||||||
|
}) : SizedBox.shrink(),
|
||||||
|
SizedBox(width: 10),
|
||||||
|
InkWell(
|
||||||
|
child: Image.asset(
|
||||||
|
'images/mine/icon_message_close.png',
|
||||||
|
width: 24.w,
|
||||||
|
height: 24.w),
|
||||||
|
onTap: () {
|
||||||
|
// 可以通过控制一个状态变量来隐藏整个通知栏
|
||||||
|
setState(() {
|
||||||
|
showNotificationBanner =
|
||||||
|
false;
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
]))
|
||||||
|
: SizedBox.shrink(),
|
||||||
|
Container(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(left: 15.w, right: 24.w, top: 20.h),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('告警',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
fontSize: 30.sp)),
|
||||||
|
// 点击多选可以进行删除
|
||||||
|
// GestureDetector(
|
||||||
|
// onTap: () {
|
||||||
|
// // 没有多选删除的 api接口,无法使用
|
||||||
|
// // if (_showCheckboxes.value) {
|
||||||
|
// // deleteSelectedMessages();
|
||||||
|
// // } else {
|
||||||
|
// // setState(() {
|
||||||
|
// // _showCheckboxes.value =
|
||||||
|
// // !_showCheckboxes.value;
|
||||||
|
// // });
|
||||||
|
// // }
|
||||||
|
// },
|
||||||
|
// child: _showCheckboxes.value
|
||||||
|
// ? Text('删除',
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 24.sp,
|
||||||
|
// color: Colors.red))
|
||||||
|
// : Image.asset(
|
||||||
|
// 'images/mine/icon_message_checbox.png',
|
||||||
|
// width: 30.w,
|
||||||
|
// height: 30.h),
|
||||||
|
// )
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
]))),
|
||||||
|
Container(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
top: showNotificationBanner ? 80 : 50),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: state.itemDataList.value.length,
|
itemCount: _buildGroupedListItems().length,
|
||||||
itemBuilder: (BuildContext c, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
final MessageItemEntity messageItemEntity =
|
var item = _buildGroupedListItems()[index];
|
||||||
state.itemDataList.value[index];
|
|
||||||
return Slidable(
|
if (item is String) {
|
||||||
key: ValueKey(messageItemEntity.id),
|
// 日期标题
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 16.w, vertical: 10.h),
|
||||||
|
color: AppColors.mainBackgroundColor,
|
||||||
|
child: RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: item.substring(8, 10),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.black,
|
||||||
|
fontSize: 36.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: ' ',
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: item.substring(5, 7),
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.grey, fontSize: 20.sp, fontWeight: FontWeight.w400),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (item is MessageItemEntity) {
|
||||||
|
// 消息项
|
||||||
|
return _messageListItem(item, () {
|
||||||
|
Get.toNamed(Routers.messageDetailPage,
|
||||||
|
arguments: <String, MessageItemEntity>{
|
||||||
|
'messageItemEntity': item
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
})),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建分组列表
|
||||||
|
List<dynamic> _buildGroupedListItems() {
|
||||||
|
List<dynamic> items = [];
|
||||||
|
Map<String, List<MessageItemEntity>> grouped = _groupMessagesByDate();
|
||||||
|
|
||||||
|
grouped.forEach((date, messages) {
|
||||||
|
items.add(date); // 添加日期标题
|
||||||
|
items.addAll(messages.map((message) => message)); // 添加该日期下的所有消息
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化选中状态
|
||||||
|
if (_selectedItems.length != state.itemDataList.value.length) {
|
||||||
|
_selectedItems.clear();
|
||||||
|
_selectedItems.addAll(
|
||||||
|
List.generate(state.itemDataList.value.length, (index) => false));
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _messageListItem(
|
||||||
|
MessageItemEntity messageItemEntity, Function() action) {
|
||||||
|
final int index = state.itemDataList.value.indexOf(messageItemEntity);
|
||||||
|
|
||||||
|
// 查找当前消息在其所属日期分组中的位置
|
||||||
|
Map<String, List<MessageItemEntity>> grouped = _groupMessagesByDate();
|
||||||
|
bool isLastInGroupSimple = false;
|
||||||
|
|
||||||
|
// 确定当前消息属于哪个日期分组
|
||||||
|
for (var entry in grouped.entries) {
|
||||||
|
int messageIndex = entry.value.indexWhere((msg) => msg.id == messageItemEntity.id);
|
||||||
|
if (messageIndex != -1) {
|
||||||
|
// 如果是该分组的最后一条消息
|
||||||
|
isLastInGroupSimple = messageIndex == entry.value.length - 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
// 如果是多选模式,切换选中状态
|
||||||
|
if (_showCheckboxes.value) {
|
||||||
|
_selectedItems[index] = !_selectedItems[index];
|
||||||
|
setState(() {});
|
||||||
|
} else {
|
||||||
|
// 否则跳转到详情页
|
||||||
|
action();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(left: 10),
|
||||||
|
transform: Matrix4.translationValues(0, 20, 0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
messageItemEntity.readAt! == 0
|
||||||
|
? 'images/mine/icon_message_unread.png'
|
||||||
|
: 'images/mine/icon_message_readed.png',
|
||||||
|
width: 18.w,
|
||||||
|
height: 18.h),
|
||||||
|
// 添加竖线,根据是否是分组最后一条消息来决定是否显示
|
||||||
|
if (!isLastInGroupSimple)
|
||||||
|
Container(
|
||||||
|
width: 0.5,
|
||||||
|
height: 190.h,
|
||||||
|
color: AppColors.placeholderTextColor,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
Expanded(
|
||||||
|
child: Slidable(
|
||||||
|
key: Key(messageItemEntity.id.toString()), // 为每个item添加唯一key
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
extentRatio: 0.2,
|
|
||||||
motion: const ScrollMotion(),
|
motion: const ScrollMotion(),
|
||||||
children: <Widget>[
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context) {
|
onPressed: (context) {
|
||||||
|
// 删除单条消息
|
||||||
logic.deletMessageDataRequest(
|
logic.deletMessageDataRequest(
|
||||||
messageItemEntity.id!, () {
|
messageItemEntity.id!, () {
|
||||||
logic.pageNo = 1;
|
logic.pageNo = 1;
|
||||||
@ -102,94 +364,124 @@ class _MessageListPageState extends State<MessageListPage>
|
|||||||
},
|
},
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
label: '删除'.tr,
|
icon: Icons.delete,
|
||||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
label: '删除',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
), child: Container(
|
||||||
child: _messageListItem(messageItemEntity, () {
|
|
||||||
Get.toNamed(Routers.messageDetailPage,
|
|
||||||
arguments: <String, MessageItemEntity>{
|
|
||||||
'messageItemEntity': messageItemEntity
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
})),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _messageListItem(
|
|
||||||
MessageItemEntity messageItemEntity, Function() action) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: action,
|
|
||||||
child: Container(
|
|
||||||
height: 90.h,
|
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
margin: EdgeInsets.only(bottom: 2.h),
|
margin: EdgeInsets.all(20.h),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
borderRadius: BorderRadius.circular(10.w),
|
borderRadius: BorderRadius.circular(10.w),
|
||||||
),
|
),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 1.sw,
|
width: 1.sw,
|
||||||
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 8.h),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(
|
// SizedBox(height: 4.h),
|
||||||
|
// Row(
|
||||||
|
// children: <Widget>[
|
||||||
|
// Flexible(
|
||||||
|
// child: Text(
|
||||||
|
// // 调用请求标题
|
||||||
|
// '远程开门请求',
|
||||||
|
// maxLines: 1,
|
||||||
|
// overflow: TextOverflow.ellipsis,
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 22.sp,
|
||||||
|
// color: messageItemEntity.readAt! == 0
|
||||||
|
// ? AppColors.blackColor
|
||||||
|
// : AppColors.placeholderTextColor),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// SizedBox(height: 4.h),
|
||||||
|
Wrap(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (messageItemEntity.readAt! == 0)
|
// if (messageItemEntity.readAt! == 0)
|
||||||
|
// Container(
|
||||||
|
// width: 10.w,
|
||||||
|
// height: 10.w,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: Colors.red,
|
||||||
|
// borderRadius: BorderRadius.circular(5.w),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// else
|
||||||
|
// Container(),
|
||||||
|
// if (messageItemEntity.readAt! == 0)
|
||||||
|
// SizedBox(width: 5.w)
|
||||||
|
// else
|
||||||
|
// Container(),
|
||||||
Container(
|
Container(
|
||||||
width: 10.w,
|
margin: EdgeInsets.only(top: 4.h),
|
||||||
height: 10.w,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.red,
|
|
||||||
borderRadius: BorderRadius.circular(5.w),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
else
|
|
||||||
Container(),
|
|
||||||
if (messageItemEntity.readAt! == 0)
|
|
||||||
SizedBox(width: 5.w)
|
|
||||||
else
|
|
||||||
Container(),
|
|
||||||
Flexible(
|
|
||||||
child: Text(
|
child: Text(
|
||||||
messageItemEntity.data!,
|
DateTool().dateToHnString(messageItemEntity.createdAt!.toString()),
|
||||||
maxLines: 1,
|
style: TextStyle(
|
||||||
|
fontSize: 20.sp,
|
||||||
|
color: messageItemEntity.readAt! == 0
|
||||||
|
? AppColors.blackColor
|
||||||
|
: AppColors.placeholderTextColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: 1,
|
||||||
|
height: 10,
|
||||||
|
margin: EdgeInsets.only(left: 5.w, right: 5.w, top: 10.h),
|
||||||
|
color: messageItemEntity.readAt! == 0
|
||||||
|
? AppColors.blackColor
|
||||||
|
: AppColors.placeholderTextColor,
|
||||||
|
),
|
||||||
|
Container(transform: Matrix4.translationValues(0, -18, 0),
|
||||||
|
child: Text(' ${messageItemEntity.data!}',
|
||||||
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp,
|
fontSize: 20.sp,
|
||||||
color: messageItemEntity.readAt! == 0
|
color: messageItemEntity.readAt! == 0
|
||||||
? AppColors.blackColor
|
? AppColors.blackColor
|
||||||
: AppColors.placeholderTextColor),
|
: AppColors.placeholderTextColor,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
|
Container(transform: Matrix4.translationValues(0, -8, 0), child: GestureDetector(
|
||||||
|
child: Text('点击查看', style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20.sp, color: AppColors.mainColor),),
|
||||||
|
),alignment: Alignment.centerRight,)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 10.h),
|
// SizedBox(height: 5.h),
|
||||||
Row(
|
// Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
// mainAxisAlignment: MainAxisAlignment.start,
|
||||||
children: <Widget>[
|
// children: <Widget>[
|
||||||
// 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: 40.w, height: 40.w,),
|
||||||
// SizedBox(width: 10.w,),
|
// // SizedBox(width: 10.w,),
|
||||||
Text(
|
// Text(
|
||||||
DateTool().dateToYMDHNString(
|
// DateTool().dateToHnString(messageItemEntity
|
||||||
messageItemEntity.createdAt!.toString()),
|
// .createdAt!
|
||||||
style: TextStyle(
|
// .toString()),
|
||||||
fontSize: 18.sp,
|
// style: TextStyle(
|
||||||
color: messageItemEntity.readAt! == 0
|
// fontSize: 18.sp,
|
||||||
? AppColors.blackColor
|
// color: messageItemEntity.readAt! == 0
|
||||||
: AppColors.placeholderTextColor)),
|
// ? AppColors.blackColor
|
||||||
],
|
// : AppColors.placeholderTextColor)),
|
||||||
),
|
// ],
|
||||||
SizedBox(width: 20.h),
|
// ),
|
||||||
],
|
// SizedBox(width: 20.h),
|
||||||
),
|
]))))),
|
||||||
),
|
// 显示选中状态的复选框
|
||||||
),
|
if (_showCheckboxes.value)
|
||||||
);
|
Checkbox(
|
||||||
|
value: _selectedItems[index],
|
||||||
|
activeColor: Colors.blue,
|
||||||
|
onChanged: (val) {
|
||||||
|
_selectedItems[index] = val!;
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
)
|
||||||
|
]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,22 +1,34 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
||||||
|
import 'package:star_lock/tools/storage.dart';
|
||||||
import 'package:star_lock/tools/wechat/customer_tool.dart';
|
import 'package:star_lock/tools/wechat/customer_tool.dart';
|
||||||
|
|
||||||
import '../../appRouters.dart';
|
import '../../appRouters.dart';
|
||||||
import '../../app_settings/app_colors.dart';
|
import '../../app_settings/app_colors.dart';
|
||||||
import '../../baseWidget.dart';
|
import '../../baseWidget.dart';
|
||||||
|
import '../../tools/commonItem.dart';
|
||||||
import '../../tools/customNetworkImage.dart';
|
import '../../tools/customNetworkImage.dart';
|
||||||
|
import '../../tools/showTipView.dart';
|
||||||
import '../../tools/submitBtn.dart';
|
import '../../tools/submitBtn.dart';
|
||||||
import '../../tools/wechat/wechatManageTool.dart';
|
import '../../tools/wechat/wechatManageTool.dart';
|
||||||
import '../../tools/wechat/wx_push_miniProgram/wx_push_miniProgram.dart';
|
import '../../tools/wechat/wx_push_miniProgram/wx_push_miniProgram.dart';
|
||||||
|
import '../../translations/app_dept.dart';
|
||||||
|
import '../../translations/current_locale_tool.dart';
|
||||||
|
import '../mineSet/mineSet/mineSet_logic.dart';
|
||||||
|
import '../mineSet/mineSet/mineSet_state.dart';
|
||||||
import 'starLockMine_logic.dart';
|
import 'starLockMine_logic.dart';
|
||||||
|
|
||||||
class StarLockMinePage extends StatefulWidget {
|
class StarLockMinePage extends StatefulWidget {
|
||||||
const StarLockMinePage({Key? key}) : super(key: key);
|
const StarLockMinePage({Key? key, this.showAppBar = true, this.showAbout = true}) : super(key: key);
|
||||||
|
final bool showAppBar;
|
||||||
|
final bool showAbout;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StarLockMinePage> createState() => StarLockMinePageState();
|
State<StarLockMinePage> createState() => StarLockMinePageState();
|
||||||
@ -27,103 +39,127 @@ GlobalKey<StarLockMinePageState> starLockMineKey = GlobalKey();
|
|||||||
class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||||
final StarLockMineLogic logic = Get.put(StarLockMineLogic());
|
final StarLockMineLogic logic = Get.put(StarLockMineLogic());
|
||||||
final StarLockMineState state = Get.find<StarLockMineLogic>().state;
|
final StarLockMineState state = Get.find<StarLockMineLogic>().state;
|
||||||
|
late final MineSetState stateSet;
|
||||||
|
late final MineSetLogic logicSet;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
// 确保 MineSetLogic 存在
|
||||||
|
if (!Get.isRegistered<MineSetLogic>()) {
|
||||||
|
Get.put(MineSetLogic());
|
||||||
|
}
|
||||||
|
logicSet = Get.find<MineSetLogic>();
|
||||||
|
stateSet = logicSet.state;
|
||||||
|
logicSet.userSettingsInfoRequest();
|
||||||
|
|
||||||
logic.getUserInfoRequest();
|
logic.getUserInfoRequest();
|
||||||
|
|
||||||
|
// 初始化时检查推送权限状态
|
||||||
|
_checkNotificationPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: const Color(0xFFFFFFFF),
|
body: SafeArea(
|
||||||
body: Column(
|
child: SingleChildScrollView(child: Container(
|
||||||
children: <Widget>[
|
margin: EdgeInsets.only(bottom: 20.h),
|
||||||
topWidget(),
|
padding: EdgeInsets.symmetric(horizontal: 20.w),
|
||||||
bottomListWidget(),
|
|
||||||
SizedBox(
|
|
||||||
height: 80.h,
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
WechatManageTool.getAppInfo(() {
|
|
||||||
WxPushWeChatMiniProgramTool.pushWeChatMiniProgram(
|
|
||||||
F.wechatAppInfo.wechatAppId, F.wechatAppInfo.universalLink);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
|
||||||
child: Image.asset(
|
|
||||||
'images/mine/icon_mine_wan_miniprogram.png',
|
|
||||||
// width: 400.w,
|
|
||||||
// height: 151.h,
|
|
||||||
fit: BoxFit.fill,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget topWidget() {
|
|
||||||
return Container(
|
|
||||||
height: 380.h,
|
|
||||||
width: 1.sw,
|
|
||||||
color: AppColors.mainColor,
|
|
||||||
// color: Colors.red,
|
|
||||||
child: Stack(
|
|
||||||
children: <Widget>[
|
|
||||||
Image.asset(
|
|
||||||
'images/mine/icon_mine_topBg.png',
|
|
||||||
width: 400.w,
|
|
||||||
height: 380.h,
|
|
||||||
fit: BoxFit.fill,
|
|
||||||
),
|
|
||||||
Center(
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 120.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
|
topWidget(),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10.r),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 15.h),
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
Get.back();
|
||||||
|
Get.toNamed(Routers.minePersonInfoPage);
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
Icons.person,
|
||||||
|
size: 32.sp,
|
||||||
|
),
|
||||||
|
SizedBox(width: 15.w),
|
||||||
|
Text(
|
||||||
|
'个人信息'.tr,
|
||||||
|
style: TextStyle(fontSize: 28.sp),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios_rounded,
|
||||||
|
color: Colors.grey[400],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
bottomListWidget(),
|
||||||
|
SizedBox(
|
||||||
|
height: 20.h,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10.r),
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 15.h),
|
||||||
|
child: getListDataView(),
|
||||||
|
)])))));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget topWidget() {
|
||||||
|
return Row(
|
||||||
|
children: <Widget>[
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
Get.toNamed(Routers.minePersonInfoPage);
|
Get.toNamed(Routers.minePersonInfoPage);
|
||||||
},
|
},
|
||||||
child: Obx(() => SizedBox(
|
child: Obx(
|
||||||
width: 105.w,
|
() => SizedBox(
|
||||||
height: 105.w,
|
width: 68.w,
|
||||||
|
height: 68.w,
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius: BorderRadius.circular(52.5.w),
|
borderRadius: BorderRadius.circular(52.5.w),
|
||||||
child: CustomNetworkImage(
|
child: CustomNetworkImage(
|
||||||
url: state.userHeadUrl.value,
|
url: state.userHeadUrl.value,
|
||||||
defaultUrl: 'images/controls_user.png',
|
defaultUrl: 'images/controls_user.png',
|
||||||
width: 105.w,
|
width: 68.w,
|
||||||
height: 105.h,
|
height: 68.h,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
SizedBox(
|
|
||||||
height: 20.h,
|
|
||||||
),
|
),
|
||||||
Obx(() => GestureDetector(
|
),
|
||||||
|
SizedBox(width: 20.w),
|
||||||
|
Obx(
|
||||||
|
() => GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (!state.isVip.value) {
|
if (!state.isVip.value) {
|
||||||
// if (CommonDataManage().currentKeyInfo.isLockOwner !=
|
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: <String, int>{
|
||||||
// 1) {
|
|
||||||
// logic.showToast('请先添加锁');
|
|
||||||
// } else {
|
|
||||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
|
||||||
arguments: <String, int>{
|
|
||||||
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
||||||
});
|
});
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
Get.toNamed(
|
Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
|
||||||
Routers.valueAddedServicesHighFunctionPage);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
@ -134,13 +170,12 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
Text(
|
Text(
|
||||||
state.userNickName.value.isNotEmpty
|
state.userNickName.value.isNotEmpty
|
||||||
? state.userNickName.value
|
? state.userNickName.value
|
||||||
: (state.userMobile.value.isNotEmpty
|
: (state.userMobile.value.isNotEmpty ? state.userMobile.value : state.userEmail.value),
|
||||||
? state.userMobile.value
|
|
||||||
: state.userEmail.value),
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 22.sp,
|
fontSize: 22.sp,
|
||||||
color: Colors.white,
|
color: Colors.black,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 5.w,
|
width: 5.w,
|
||||||
),
|
),
|
||||||
@ -159,67 +194,82 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
))
|
),
|
||||||
|
),
|
||||||
|
// const Spacer(),
|
||||||
|
// Container(
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// color: Colors.white,
|
||||||
|
// borderRadius: BorderRadius.circular(10.r),
|
||||||
|
// ),
|
||||||
|
// padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 10.h),
|
||||||
|
// child: Row(
|
||||||
|
// children: [
|
||||||
|
// if (F.isSKY && Get.locale!.languageCode == 'zh')
|
||||||
|
// GestureDetector(
|
||||||
|
// onTap: () {
|
||||||
|
// Get.back();
|
||||||
|
// WechatManageTool.getAppInfo(CustomerTool.openCustomerService);
|
||||||
|
// },
|
||||||
|
// child: Image.asset(
|
||||||
|
// 'images/mine/icon_mine_main_supportStaff.png',
|
||||||
|
// width: 34.w,
|
||||||
|
// height: 34.w,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// width: 20.w,
|
||||||
|
// ),
|
||||||
|
// GestureDetector(
|
||||||
|
// onTap: () {
|
||||||
|
// Get.back();
|
||||||
|
// Get.toNamed(Routers.messageListPage);
|
||||||
|
// },
|
||||||
|
// child: Image.asset(
|
||||||
|
// 'images/mine/icon_mine_main_message.png',
|
||||||
|
// width: 36.w,
|
||||||
|
// height: 36.w,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bottomListWidget() {
|
Widget bottomListWidget() {
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.only(
|
width: double.infinity,
|
||||||
left: 60.w,
|
decoration: BoxDecoration(
|
||||||
top: 50.h,
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(10.w),
|
||||||
),
|
),
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.w),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
mineItem('images/mine/icon_mine_main_addLock.png', '添加设备'.tr, () {
|
// mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () {
|
||||||
Get.back();
|
// Get.back();
|
||||||
Get.toNamed(Routers.selectLockTypePage);
|
// Get.toNamed(Routers.mineSetPage);
|
||||||
}),
|
|
||||||
// mineItem('images/mine/icon_mine_main_gateway.png',
|
|
||||||
// TranslationLoader.lanKeys!.gateway!.tr, () {
|
|
||||||
// Navigator.pushNamed(context, Routers.gatewayListPage);
|
|
||||||
// }),
|
// }),
|
||||||
mineItem('images/mine/icon_mine_main_message.png', '消息'.tr, () {
|
// SizedBox(height: 20.h),
|
||||||
Get.back();
|
mineItem('images/mine/icon_mine_main_vip.png', '增值服务'.tr, () async {
|
||||||
Get.toNamed(Routers.messageListPage);
|
final bool? isVip = await Storage.getBool(saveIsVip);
|
||||||
// Toast.show(msg: "功能暂未开放");
|
if (isVip == null || !isVip) {
|
||||||
}),
|
// vip状态是和账号绑定,这里判断用户打开的某个锁是不是LockOwner没意义
|
||||||
//删除“客服”行
|
// if (CommonDataManage().currentKeyInfo.isLockOwner != 1) {
|
||||||
// mineItem('images/mine/icon_mine_main_supportStaff.png',
|
// logic.showToast('请先添加锁'.tr);
|
||||||
// TranslationLoader.lanKeys!.supportStaff!.tr, () {
|
// } else {
|
||||||
// Navigator.pushNamed(context, Routers.supportStaffPage);
|
//刷新购买状态
|
||||||
// }),
|
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: <String, int>{
|
||||||
mineItem('images/mine/icon_mine_main_set.png', '设置'.tr, () {
|
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
||||||
Get.back();
|
})?.then((value) => logic.getUserInfoRequest());
|
||||||
Get.toNamed(Routers.mineSetPage);
|
// }
|
||||||
}),
|
} else {
|
||||||
//上架审核
|
Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
|
||||||
// if (F.isLite)
|
}
|
||||||
// Container()
|
|
||||||
// else
|
|
||||||
mineItem('images/mine/icon_mine_main_vip.png', '增值服务'.tr, () {
|
|
||||||
Get.back();
|
|
||||||
Get.toNamed(Routers.valueAddedServicesPage);
|
|
||||||
}),
|
|
||||||
// if (F.isLite)
|
|
||||||
// Container()
|
|
||||||
// else
|
|
||||||
mineItem('images/mine/icon_mine_main_shoppingcart.png', '配件商城'.tr,
|
|
||||||
() {
|
|
||||||
Get.back();
|
|
||||||
Get.toNamed(Routers.lockMallPage);
|
|
||||||
}),
|
|
||||||
if (F.isSKY && Get.locale!.languageCode == 'zh')
|
|
||||||
mineItem('images/mine/icon_mine_main_supportStaff.png', '客服'.tr,
|
|
||||||
() {
|
|
||||||
Get.back();
|
|
||||||
WechatManageTool.getAppInfo(CustomerTool.openCustomerService);
|
|
||||||
}),
|
}),
|
||||||
|
SizedBox(height: 20.h),
|
||||||
mineItem('images/mine/icon_mine_main_about.png', '关于'.tr, () {
|
mineItem('images/mine/icon_mine_main_about.png', '关于'.tr, () {
|
||||||
Get.back();
|
Get.back();
|
||||||
Get.toNamed(Routers.aboutPage);
|
Get.toNamed(Routers.aboutPage);
|
||||||
@ -229,52 +279,9 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget keyBottomWidget() {
|
Widget mineItem(String lockTypeIcon, String lockTypeTitle, Function() action) {
|
||||||
// return Column(
|
|
||||||
// children: <Widget>[
|
|
||||||
// SubmitBtn(
|
|
||||||
// btnName: '退出'.tr,
|
|
||||||
// borderRadius: 20.w,
|
|
||||||
// fontSize: 32.sp,
|
|
||||||
// margin: EdgeInsets.only(left: 60.w, right: 60.w),
|
|
||||||
// padding: EdgeInsets.only(top: 15.w, bottom: 15.w),
|
|
||||||
// onClick: () {}),
|
|
||||||
// Container(
|
|
||||||
// padding: EdgeInsets.only(right: 30.w),
|
|
||||||
// // color: Colors.red,
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
// children: <Widget>[
|
|
||||||
// TextButton(
|
|
||||||
// child: Text(
|
|
||||||
// '删除账号'.tr,
|
|
||||||
// style: TextStyle(
|
|
||||||
// color: AppColors.mainColor, fontWeight: FontWeight.w500),
|
|
||||||
// ),
|
|
||||||
// onPressed: () {},
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// SizedBox(
|
|
||||||
// height: 30.h,
|
|
||||||
// )
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
Widget mineItem(
|
|
||||||
String lockTypeIcon, String lockTypeTitle, Function() action) {
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: action,
|
onTap: action,
|
||||||
child: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Center(
|
|
||||||
child: Container(
|
|
||||||
// height: 80.h,
|
|
||||||
width: 330.w,
|
|
||||||
padding: EdgeInsets.all(20.h),
|
|
||||||
color: Colors.white,
|
|
||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Image.asset(
|
Image.asset(
|
||||||
@ -285,15 +292,422 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
|||||||
SizedBox(width: 15.w),
|
SizedBox(width: 15.w),
|
||||||
Text(
|
Text(
|
||||||
lockTypeTitle,
|
lockTypeTitle,
|
||||||
style: TextStyle(fontSize: 22.sp),
|
style: TextStyle(fontSize: 28.sp),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
Icon(
|
||||||
|
Icons.arrow_forward_ios_rounded,
|
||||||
|
color: Colors.grey[400],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Widget getListDataView() {
|
||||||
|
// 检测系统语言是否为中文
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
/* 2024-01-12 会议确定去掉“提示音、触摸开锁” by DaisyWu
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.prompTone!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w,
|
||||||
|
height: 50.h,
|
||||||
|
child: Obx(() => _isPrompToneSwitch()))),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.touchUnlock!.tr,
|
||||||
|
rightTitle: "",
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w,
|
||||||
|
height: 50.h,
|
||||||
|
child: Obx(() => _isTouchUnlockSwitch()))),
|
||||||
|
*/
|
||||||
|
F.sw(
|
||||||
|
skyCall: () => const SizedBox(),
|
||||||
|
xhjCall: () => CommonItem(
|
||||||
|
leftTitel: '个人信息'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.minePersonInfoPage);
|
||||||
|
})),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '消息推送'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
isHaveLine: F.sw(
|
||||||
|
skyCall: () => F.appFlavor == Flavor.sky, xhjCall: () => true),
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w,
|
||||||
|
height: 50.h,
|
||||||
|
child: Obx(_isPushNotificationSwitch)
|
||||||
|
)),
|
||||||
|
// if (F.appFlavor == Flavor.sky)
|
||||||
|
Visibility(
|
||||||
|
visible: stateSet.currentLanguageCode == 'zh_CN',
|
||||||
|
child: CommonItem(
|
||||||
|
leftTitel: '微信公众号推送'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveRightWidget: true,
|
||||||
|
rightWidget: SizedBox(
|
||||||
|
width: 60.w,
|
||||||
|
height: 50.h,
|
||||||
|
child: Obx(_isWechatPublicAccountPushSwitch),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '锁用户管理'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.lockUserManageLisPage);
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '授权管理员'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.authorizedAdministratorListPage);
|
||||||
|
}),
|
||||||
|
//by DaisyWu 新增--批量授权
|
||||||
|
if (!F.isProductionEnv)
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '批量授权'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.authorityManagementPage);
|
||||||
|
// Toast.show(msg: "功能暂未开放");
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '网关'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.gatewayListPage);
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '锁分组'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.lockGroupListPage);
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '转移智能锁'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.transferSmartLockPage);
|
||||||
|
}),
|
||||||
|
//暂无网关屏蔽
|
||||||
|
// CommonItem(
|
||||||
|
// leftTitel: '转移网关'.tr,
|
||||||
|
// rightTitle: '',
|
||||||
|
// isHaveLine: true,
|
||||||
|
// isHaveDirection: true,
|
||||||
|
// action: () {
|
||||||
|
// Get.toNamed(Routers.selectGetewayListPage);
|
||||||
|
// }),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
|
||||||
|
// AppLog.log('state.currentLanguageName: ${state.currentLanguageName} state.currentLanguage.value: ${state.currentLanguage.value}');
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '多语言'.tr,
|
||||||
|
rightTitle: stateSet.currentLanguageName,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () async {
|
||||||
|
// Get.toNamed(Routers.mineMultiLanguagePage);
|
||||||
|
await Get.toNamed(Routers.mineMultiLanguagePage)!.then((value) {
|
||||||
|
setState(() {
|
||||||
|
if (value.containsKey('currentLanguage')) {
|
||||||
|
stateSet.currentLanguage.value = value['currentLanguage'];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
/* 2024-01-12 会议确定去掉“锁屏” by DaisyWu
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: TranslationLoader.lanKeys!.lockScreen!.tr,
|
||||||
|
rightTitle: (state.lockScreen.value == 1
|
||||||
|
? TranslationLoader.lanKeys!.opened!.tr
|
||||||
|
: TranslationLoader.lanKeys!.closed!.tr),
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(context, Routers.lockScreenPage,
|
||||||
|
arguments: {'isOn': state.lockScreen.value}).then((value) {
|
||||||
|
logic.userSettingsInfoRequest();
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
*/
|
||||||
|
Obx(() => CommonItem(
|
||||||
|
leftTitel: '隐藏无效开锁权限'.tr,
|
||||||
|
rightTitle:
|
||||||
|
(stateSet.hideExpiredAccessFlag.value == 1 ? '已开启'.tr : '已关闭'.tr),
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.hideInvalidUnlockPermissionsPage,
|
||||||
|
arguments: <String, int>{
|
||||||
|
'isOn': stateSet.hideExpiredAccessFlag.value
|
||||||
|
}).then((Object? value) {
|
||||||
|
logicSet.userSettingsInfoRequest();
|
||||||
|
});
|
||||||
|
})),
|
||||||
|
otherItem(
|
||||||
|
leftTitle: 'APP开锁时需手机连网的锁'.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
action: () {
|
||||||
|
Navigator.pushNamed(
|
||||||
|
context, Routers.aPPUnlockNeedMobileNetworkingLockPage);
|
||||||
|
}),
|
||||||
|
if (!F.isSKY)
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '增值服务'.tr,
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.back();
|
||||||
|
Get.toNamed(Routers.valueAddedServicesPage);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 10.h,
|
||||||
|
),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: 'Amazon Alexa'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.amazonAlexaPage, arguments: <String, dynamic>{
|
||||||
|
'isAmazonAlexa': stateSet.isAmazonAlexa.value,
|
||||||
|
'amazonAlexaData': stateSet.amazonAlexaData.value
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: 'Google Home'.tr,
|
||||||
|
rightTitle: '',
|
||||||
|
isHaveLine: true,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.toNamed(Routers.googleHomePage, arguments: <String, dynamic>{
|
||||||
|
'isGoogleHome': stateSet.isGoogleHome.value,
|
||||||
|
'googleHomeData': stateSet.googleHomeData.value
|
||||||
|
})?.then((Object? value) {
|
||||||
|
logicSet.userSettingsInfoRequest();
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
// if (!F.isProductionEnv)
|
||||||
|
// CommonItem(
|
||||||
|
// leftTitel: '小米IOT平台'.tr,
|
||||||
|
// rightTitle: '',
|
||||||
|
// isHaveLine: widget.showAbout,
|
||||||
|
// isHaveDirection: true,
|
||||||
|
// action: () {
|
||||||
|
// logic.showToast('功能暂未开放'.tr);
|
||||||
|
// }),
|
||||||
|
if (!F.isSKY)
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '客服'.tr,
|
||||||
|
isHaveLine: widget.showAbout,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
WechatManageTool.getAppInfo(CustomerTool.openCustomerService);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (widget.showAbout)
|
||||||
|
CommonItem(
|
||||||
|
leftTitel: '关于'.tr,
|
||||||
|
isHaveLine: false,
|
||||||
|
isHaveDirection: true,
|
||||||
|
action: () {
|
||||||
|
Get.back();
|
||||||
|
Get.toNamed(Routers.aboutPage);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
|
||||||
|
//
|
||||||
|
// }),
|
||||||
|
SizedBox(
|
||||||
|
height: F.sw(skyCall: () => 50.h, xhjCall: () => 0.0),
|
||||||
|
),
|
||||||
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.about!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
|
//
|
||||||
|
// }),
|
||||||
|
// SizedBox(height: 10.h,),
|
||||||
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.userAgreement!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
|
//
|
||||||
|
// }),
|
||||||
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.privacyPolicy!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
|
//
|
||||||
|
// }),
|
||||||
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.personalInformationCollectionList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
|
//
|
||||||
|
// }),
|
||||||
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.applicationPermissionDescription!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
|
//
|
||||||
|
// }),
|
||||||
|
// CommonItem(leftTitel:TranslationLoader.lanKeys!.thirdPartyInformationSharingList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||||
|
//
|
||||||
|
// }),
|
||||||
|
F.sw(skyCall: keyBottomWidget, xhjCall: () => const SizedBox())
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//微信公众号推送开关
|
||||||
|
CupertinoSwitch _isWechatPublicAccountPushSwitch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: stateSet.isWechatPublicAccountPush.value,
|
||||||
|
onChanged: (bool value) {
|
||||||
|
stateSet.isWechatPublicAccountPush.value =
|
||||||
|
!stateSet.isWechatPublicAccountPush.value;
|
||||||
|
logicSet.setMpWechatPushSwitchRequest(context);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
CupertinoSwitch _isPushNotificationSwitch() {
|
||||||
|
return CupertinoSwitch(
|
||||||
|
activeColor: CupertinoColors.activeBlue,
|
||||||
|
trackColor: CupertinoColors.systemGrey5,
|
||||||
|
thumbColor: CupertinoColors.white,
|
||||||
|
value: stateSet.isPushNotification.value,
|
||||||
|
onChanged: (bool value) async {
|
||||||
|
// stateSet.isPushNotification.value = !stateSet.isPushNotification.value;
|
||||||
|
openAppSettings();
|
||||||
|
final PermissionStatus newStatus = await Permission.notification.status;
|
||||||
|
stateSet.isPushNotification.value = newStatus.isGranted;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _checkNotificationPermission() async {
|
||||||
|
final PermissionStatus status = await Permission.notification.status;
|
||||||
|
stateSet.isPushNotification.value = status.isGranted;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget otherItem(
|
||||||
|
{String? leftTitle,
|
||||||
|
bool? isHaveLine,
|
||||||
|
Function()? action,
|
||||||
|
double? allHeight}) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: action,
|
||||||
|
child: Container(
|
||||||
|
width: 1.sw,
|
||||||
|
padding:
|
||||||
|
EdgeInsets.only(left: 20.w, top: 15.h, bottom: 15.h, right: 10.w),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
border: isHaveLine!
|
||||||
|
? Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: AppColors.greyLineColor, // 设置边框颜色
|
||||||
|
width: 2.0.h, // 设置边框宽度
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: Text(leftTitle!, style: TextStyle(fontSize: 22.sp))),
|
||||||
|
SizedBox(width: 10.w),
|
||||||
|
if (CurrentLocaleTool.getCurrentLocaleString() ==
|
||||||
|
ExtensionLanguageType.fromLanguageType(LanguageType.hebrew)
|
||||||
|
.toString() ||
|
||||||
|
CurrentLocaleTool.getCurrentLocaleString() ==
|
||||||
|
ExtensionLanguageType.fromLanguageType(LanguageType.arabic)
|
||||||
|
.toString())
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_left_grey.png',
|
||||||
|
width: 21.w,
|
||||||
|
height: 21.w,
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Image.asset(
|
||||||
|
'images/icon_right_grey.png',
|
||||||
|
width: 12.w,
|
||||||
|
height: 21.w,
|
||||||
|
),
|
||||||
|
SizedBox(width: 5.w),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget keyBottomWidget() {
|
||||||
|
return Padding(
|
||||||
|
padding: F.sw(
|
||||||
|
skyCall: () => EdgeInsets.zero,
|
||||||
|
xhjCall: () => EdgeInsets.symmetric(horizontal: 15.w)),
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
SubmitBtn(
|
||||||
|
btnName: '退出'.tr,
|
||||||
|
isDelete: true,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 15.w),
|
||||||
|
onClick: () {
|
||||||
|
//退出登录
|
||||||
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
'确定要退出吗?'.tr, () async {
|
||||||
|
await logicSet.userLogoutRequest();
|
||||||
|
// showLoginOutAlertTipDialog();
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.only(left: 30.w, top: 30.h),
|
||||||
|
// color: Colors.red,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text(
|
||||||
|
'删除账号'.tr,
|
||||||
|
style: TextStyle(
|
||||||
|
color: AppColors.darkGrayTextColor, fontSize: 18.sp),
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
'删除账号后,你的所有信息及相关记录都会从平台彻底删除,且不可恢复,是否删除?'.tr, () {
|
||||||
|
//安全验证
|
||||||
|
Get.toNamed(Routers.safeVerifyPage);
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
Container(
|
height: 30.h,
|
||||||
height: 0.5.h,
|
|
||||||
color: Colors.grey,
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@ -305,6 +305,8 @@ abstract class Api {
|
|||||||
'/lockSetting/updateLockSetting'; // 设置语音包
|
'/lockSetting/updateLockSetting'; // 设置语音包
|
||||||
final String reportBuyRequestURL =
|
final String reportBuyRequestURL =
|
||||||
'/service/reportBuyRequest'; // 上报增值服务购买请求
|
'/service/reportBuyRequest'; // 上报增值服务购买请求
|
||||||
final String getActivateInfoURL =
|
final String getTppSupportURL =
|
||||||
'/api/authCode/getTppSupport'; // 查询ttp
|
'/api/authCode/getTppSupport'; // 查询ttp
|
||||||
|
final String getActivateInfoURL =
|
||||||
|
'/api/authCode/getActivateInfo'; // 查询ttp
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,28 +10,48 @@ import 'package:star_lock/talk/starChart/entity/star_chart_register_node_entity.
|
|||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
|
||||||
class StartCompanyApi extends BaseProvider {
|
class StartCompanyApi extends BaseProvider {
|
||||||
// 星图url
|
// 星启url
|
||||||
String _startChartHost = 'https://company.skychip.top';
|
String _startChartHost = 'https://company.skychip.top';
|
||||||
|
|
||||||
static StartCompanyApi get to => Get.put(StartCompanyApi());
|
static StartCompanyApi get to => Get.put(StartCompanyApi());
|
||||||
|
|
||||||
// 设置星图host
|
// 设置星启host
|
||||||
set startChartHost(String value) {
|
set startChartHost(String value) {
|
||||||
_startChartHost = value;
|
_startChartHost = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取星图host
|
// 获取星启host
|
||||||
String get startChartHost => _startChartHost;
|
String get startChartHost => _startChartHost;
|
||||||
|
|
||||||
// ttp查询
|
// ttp查询
|
||||||
Future<ActivateInfoResponse> getActivateInfo({
|
Future<TppSupportResponse> getTppSupport({
|
||||||
required String model,
|
required String model,
|
||||||
|
}) async {
|
||||||
|
final response = await post(
|
||||||
|
_startChartHost + getTppSupportURL.toUrl,
|
||||||
|
jsonEncode(<String, dynamic>{
|
||||||
|
'model': model,
|
||||||
|
}),
|
||||||
|
isUnShowLoading: true,
|
||||||
|
isUserBaseUrl: false,
|
||||||
|
);
|
||||||
|
return TppSupportResponse.fromJson(response.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取授权码
|
||||||
|
Future<ActivateInfoResponse> getAuthorizationCode({
|
||||||
|
required String registerKey,
|
||||||
|
required String model,
|
||||||
|
required String serialNum0,
|
||||||
|
required int platform,
|
||||||
}) async {
|
}) async {
|
||||||
final response = await post(
|
final response = await post(
|
||||||
_startChartHost + getActivateInfoURL.toUrl,
|
_startChartHost + getActivateInfoURL.toUrl,
|
||||||
jsonEncode(<String, dynamic>{
|
jsonEncode(<String, dynamic>{
|
||||||
|
'register_key': registerKey,
|
||||||
|
'platform': platform,
|
||||||
'model': model,
|
'model': model,
|
||||||
|
'serial_num0': serialNum0,
|
||||||
}),
|
}),
|
||||||
isUnShowLoading: true,
|
isUnShowLoading: true,
|
||||||
isUserBaseUrl: false,
|
isUserBaseUrl: false,
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class CommonItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
leftTitel!,
|
leftTitel!,
|
||||||
style: leftTitleStyle ?? TextStyle(fontSize: 22.sp),
|
style: leftTitleStyle ?? TextStyle(fontSize: 28.sp),
|
||||||
overflow: TextOverflow.ellipsis, // 超出部分显示省略号
|
overflow: TextOverflow.ellipsis, // 超出部分显示省略号
|
||||||
maxLines: 3, // 最多显示2行
|
maxLines: 3, // 最多显示2行
|
||||||
),
|
),
|
||||||
|
|||||||
@ -194,6 +194,45 @@ class DateTool {
|
|||||||
return appointmentDate;
|
return appointmentDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 将时间戳传化为月
|
||||||
|
String dateToMMString(String? timestamp) {
|
||||||
|
timestamp ??= '0';
|
||||||
|
int time = int.parse(timestamp);
|
||||||
|
if (timestamp.length == 10) {
|
||||||
|
time = time * 1000;
|
||||||
|
}
|
||||||
|
final DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||||
|
final String appointmentDate =
|
||||||
|
formatDate(nowDate, <String>[mm]);
|
||||||
|
return appointmentDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 将时间戳传化为日
|
||||||
|
String dateToDDString(String? timestamp) {
|
||||||
|
timestamp ??= '0';
|
||||||
|
int time = int.parse(timestamp);
|
||||||
|
if (timestamp.length == 10) {
|
||||||
|
time = time * 1000;
|
||||||
|
}
|
||||||
|
final DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||||
|
final String appointmentDate =
|
||||||
|
formatDate(nowDate, <String>[dd]);
|
||||||
|
return appointmentDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 将时间戳传化为时分
|
||||||
|
String dateToHnString(String? timestamp) {
|
||||||
|
timestamp ??= '0';
|
||||||
|
int time = int.parse(timestamp);
|
||||||
|
if (timestamp.length == 10) {
|
||||||
|
time = time * 1000;
|
||||||
|
}
|
||||||
|
final DateTime nowDate = DateTime.fromMillisecondsSinceEpoch(time);
|
||||||
|
final String appointmentDate =
|
||||||
|
formatDate(nowDate, <String>[HH, ':', nn]);
|
||||||
|
return appointmentDate;
|
||||||
|
}
|
||||||
|
|
||||||
/// 将时间戳传化为年月日 (年-月-日 时:分)
|
/// 将时间戳传化为年月日 (年-月-日 时:分)
|
||||||
String dateIntToYMDHNString(int? time) {
|
String dateIntToYMDHNString(int? time) {
|
||||||
time ??= 0;
|
time ??= 0;
|
||||||
|
|||||||
@ -261,7 +261,7 @@ dependencies:
|
|||||||
|
|
||||||
jverify: 3.0.0
|
jverify: 3.0.0
|
||||||
#<cn>
|
#<cn>
|
||||||
umeng_common_sdk: 1.2.8
|
# umeng_common_sdk: 1.2.8
|
||||||
#</cn>
|
#</cn>
|
||||||
#<com>
|
#<com>
|
||||||
firebase_analytics: 11.3.0
|
firebase_analytics: 11.3.0
|
||||||
@ -323,6 +323,7 @@ flutter:
|
|||||||
- images/
|
- images/
|
||||||
- images/tabbar/
|
- images/tabbar/
|
||||||
- images/guide/
|
- images/guide/
|
||||||
|
- images/other/
|
||||||
- images/main/
|
- images/main/
|
||||||
- images/main/addFingerprint/
|
- images/main/addFingerprint/
|
||||||
- images/mine/
|
- images/mine/
|
||||||
|
|||||||