Merge branch 'release' of https://gitee.com/starlock-cn/app-starlock into release
# Conflicts: # lib/appRouters.dart # lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart
This commit is contained in:
commit
ad29462882
@ -27,6 +27,7 @@ apply plugin: 'kotlin-android'
|
||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||
apply plugin: 'com.android.application'
|
||||
apply plugin: 'android-junk-code'
|
||||
apply plugin: 'com.huawei.agconnect'
|
||||
|
||||
androidJunkCode {
|
||||
variantConfig {
|
||||
@ -51,10 +52,14 @@ android {
|
||||
// 这里“debug”不是一个自定义变量,而是一个特定的关键词,凡是使用--debug模式,都会引用到这里
|
||||
// 目前看来,debug模式没办法在buildTypes里面按flavors指定编译签名,所有口味的debug模式只能用同一个签名
|
||||
debug {
|
||||
storeFile file("starlock.keystore")
|
||||
storePassword '123456'
|
||||
keyAlias = 'starlock'
|
||||
keyPassword '123456'
|
||||
// storeFile file("starlock.keystore")
|
||||
// storePassword '123456'
|
||||
// keyAlias = 'starlock'
|
||||
// keyPassword '123456'
|
||||
storeFile file("xhj.jks")
|
||||
storePassword 'xhj8872'
|
||||
keyAlias = 'upload'
|
||||
keyPassword 'xhj8872'
|
||||
}
|
||||
sky {
|
||||
// CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown
|
||||
@ -161,13 +166,23 @@ android {
|
||||
manifestPlaceholders = [
|
||||
JPUSH_PKGNAME : "这里不重要,在口味配置",
|
||||
//JPush 上注册的包名对应的 Appkey.
|
||||
JPUSH_APPKEY : "7ff37d174c1a568a89e98dad",
|
||||
//暂时填写默认值即可.
|
||||
// JPUSH_APPKEY : "7ff37d174c1a568a89e98dad",//--skyAppKey
|
||||
JPUSH_APPKEY : "251fc8074820d122b6de58d2",//--鑫泓佳AppKey
|
||||
JPUSH_CHANNEL : "flutter_channel",
|
||||
|
||||
//若不集成厂商通道,可直接跳过以下配置
|
||||
XIAOMI_APPID : "MI-2882303761520287291",
|
||||
XIAOMI_APPKEY : "MI-5352028744291",
|
||||
//以下为sky的配置
|
||||
// XIAOMI_APPID : "MI-2882303761520287291",
|
||||
// XIAOMI_APPKEY : "MI-5352028744291",
|
||||
//以下均为鑫泓佳的配置
|
||||
XIAOMI_APPID : "MI-2882303761520314939",
|
||||
XIAOMI_APPKEY : "MI-5312031456939",
|
||||
OPPO_APPKEY : "OP-47f668c9943248118502aa58d066393b",
|
||||
OPPO_APPID : "OP-31726001",
|
||||
OPPO_APPSECRET : "OP-05723986bba64183a71530b496922450",
|
||||
// VIVO_APPKEY : "vivo的APPKEY",
|
||||
// VIVO_APPID : "vivo的APPID",
|
||||
HONOR_APPID : "110798531",
|
||||
]
|
||||
splits {
|
||||
abi {
|
||||
@ -208,7 +223,10 @@ dependencies {
|
||||
implementation('com.amap.api:3dmap:8.1.0')
|
||||
|
||||
implementation 'cn.jiguang.sdk:jpush:5.2.3'
|
||||
// 接入华为厂商
|
||||
implementation 'com.huawei.agconnect:agconnect-core:1.8.1.300'
|
||||
implementation 'com.huawei.hms:push:6.12.0.300'
|
||||
implementation 'cn.jiguang.sdk.plugin:huawei:5.2.3'
|
||||
|
||||
implementation 'cn.jiguang.sdk.plugin:xiaomi:5.2.3'
|
||||
}
|
||||
|
||||
@ -54,6 +54,12 @@
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
android:value="1"/> <!-- 将您的通知渠道ID替换为您的实际ID -->
|
||||
<meta-data
|
||||
android:name="com.huawei.hms.client.appid"
|
||||
android:value="110798531"/>
|
||||
<meta-data
|
||||
android:name="com.huawei.hms.client.cpid"
|
||||
android:value="1406555529261648640"/>
|
||||
<!-- 配置定位Service -->
|
||||
<service android:name="com.amap.api.location.APSService"/>
|
||||
<activity android:name="com.skychip.lock.MainActivity" android:exported="true" android:screenOrientation="portrait" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
|
||||
|
||||
96
android/app/src/xhj/agconnect-services.json
Normal file
96
android/app/src/xhj/agconnect-services.json
Normal file
@ -0,0 +1,96 @@
|
||||
{
|
||||
"agcgw":{
|
||||
"backurl":"connect-drcn.hispace.hicloud.com",
|
||||
"url":"connect-drcn.dbankcloud.cn",
|
||||
"websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com",
|
||||
"websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn"
|
||||
},
|
||||
"agcgw_all":{
|
||||
"CN":"connect-drcn.dbankcloud.cn",
|
||||
"CN_back":"connect-drcn.hispace.hicloud.com",
|
||||
"DE":"connect-dre.dbankcloud.cn",
|
||||
"DE_back":"connect-dre.hispace.hicloud.com",
|
||||
"RU":"connect-drru.hispace.dbankcloud.ru",
|
||||
"RU_back":"connect-drru.hispace.dbankcloud.cn",
|
||||
"SG":"connect-dra.dbankcloud.cn",
|
||||
"SG_back":"connect-dra.hispace.hicloud.com"
|
||||
},
|
||||
"websocketgw_all":{
|
||||
"CN":"connect-ws-drcn.hispace.dbankcloud.cn",
|
||||
"CN_back":"connect-ws-drcn.hispace.dbankcloud.com",
|
||||
"DE":"connect-ws-dre.hispace.dbankcloud.cn",
|
||||
"DE_back":"connect-ws-dre.hispace.dbankcloud.com",
|
||||
"RU":"connect-ws-drru.hispace.dbankcloud.ru",
|
||||
"RU_back":"connect-ws-drru.hispace.dbankcloud.cn",
|
||||
"SG":"connect-ws-dra.hispace.dbankcloud.cn",
|
||||
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
|
||||
},
|
||||
"client":{
|
||||
"cp_id":"30086000752967166",
|
||||
"product_id":"388421841222116270",
|
||||
"client_id":"1406555529261648640",
|
||||
"client_secret":"843E8191B02B692239726CF0ED990E1EC2B31928F825AA012B932A128FD2C516",
|
||||
"project_id":"388421841222116270",
|
||||
"app_id":"110798531",
|
||||
"api_key":"DQEDAALnPCtuCgoYOyZfsIDa9/YZZhQ+buDGpypeurXhQUGMajWcVyYLQgXXqV3x2HbI6oyG+Wm2Gf+1hPs6j+wA3B6ylYAXG4aAQA==",
|
||||
"package_name":"com.xhjcn.lock"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_id":"110798531",
|
||||
"client_type":1
|
||||
},
|
||||
"app_info":{
|
||||
"app_id":"110798531",
|
||||
"package_name":"com.xhjcn.lock"
|
||||
},
|
||||
"service":{
|
||||
"analytics":{
|
||||
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||
"collector_url_ru":"datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com",
|
||||
"collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn",
|
||||
"collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
|
||||
"collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||
"resource_id":"p1",
|
||||
"channel_id":""
|
||||
},
|
||||
"edukit":{
|
||||
"edu_url":"edukit.cloud.huawei.com.cn",
|
||||
"dh_url":"edukit.cloud.huawei.com.cn"
|
||||
},
|
||||
"search":{
|
||||
"url":"https://search-drcn.cloud.huawei.com"
|
||||
},
|
||||
"cloudstorage":{
|
||||
"storage_url_sg_back":"https://agc-storage-dra.cloud.huawei.asia",
|
||||
"storage_url_ru_back":"https://agc-storage-drru.cloud.huawei.ru",
|
||||
"storage_url_ru":"https://agc-storage-drru.cloud.huawei.ru",
|
||||
"storage_url_de_back":"https://agc-storage-dre.cloud.huawei.eu",
|
||||
"storage_url_de":"https://ops-dre.agcstorage.link",
|
||||
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn",
|
||||
"storage_url_sg":"https://ops-dra.agcstorage.link",
|
||||
"storage_url_cn_back":"https://agc-storage-drcn.cloud.huawei.com.cn",
|
||||
"storage_url_cn":"https://agc-storage-drcn.platform.dbankcloud.cn"
|
||||
},
|
||||
"ml":{
|
||||
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
|
||||
}
|
||||
},
|
||||
"region":"CN",
|
||||
"configuration_version":"3.0",
|
||||
"appInfos":[
|
||||
{
|
||||
"package_name":"com.xhjcn.lock",
|
||||
"client":{
|
||||
"app_id":"110798531"
|
||||
},
|
||||
"app_info":{
|
||||
"package_name":"com.xhjcn.lock",
|
||||
"app_id":"110798531"
|
||||
},
|
||||
"oauth_client":{
|
||||
"client_type":1,
|
||||
"client_id":"110798531"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,10 +1,13 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.8.20'
|
||||
repositories {
|
||||
maven { url 'https://maven.aliyun.com/repository/public'}
|
||||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}
|
||||
google()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
// hms, 若不集成华为厂商通道,可直接跳过
|
||||
// maven { url 'https://maven.aliyun.com/repository/central'}
|
||||
maven { url 'https://developer.huawei.com/repo/'}
|
||||
// fcm, 若不集成 FCM 通道,可直接跳过
|
||||
maven { url "https://maven.google.com" }
|
||||
@ -25,6 +28,8 @@ buildscript {
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
maven { url 'https://maven.aliyun.com/repository/public'}
|
||||
maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}
|
||||
google()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@ import 'package:star_lock/flavors.dart';
|
||||
class AppColors {
|
||||
// static Color mainColor = const Color(0xFF385DEA);
|
||||
static Color get mainColor => F.sw(
|
||||
defaultCall: () => const Color(0xFF4777EE),
|
||||
skyCall: () => const Color(0xFF4777EE),
|
||||
xhjCall: () => const Color(0xFF68c1b9));
|
||||
|
||||
static Color mainBackgroundColor = const Color(0xFFF5F5F5);
|
||||
|
||||
@ -4,6 +4,7 @@ import 'dart:io';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
|
||||
import 'io_tool/io_model.dart';
|
||||
import 'io_tool/io_tool.dart';
|
||||
@ -17,12 +18,12 @@ typedef ConnectStateCallBack = Function(
|
||||
typedef ScanDevicesCallBack = Function(List<ScanResult>);
|
||||
|
||||
class BlueManage {
|
||||
|
||||
factory BlueManage() => shareManager()!;
|
||||
|
||||
BlueManage._init() {
|
||||
_initBlue();
|
||||
}
|
||||
|
||||
final List<ScanResult> scanDevices = <ScanResult>[];
|
||||
|
||||
// 用来写入的服务id
|
||||
@ -70,6 +71,7 @@ class BlueManage {
|
||||
// 保存上一次的数据,用来判断是否收到重复的数据
|
||||
List<int> lastTimeData = <int>[];
|
||||
int? dataLen;
|
||||
Timer? scanSingleTimer;
|
||||
|
||||
static BlueManage? _manager;
|
||||
|
||||
@ -311,10 +313,24 @@ class BlueManage {
|
||||
{bool isAddEquipment = false}) async {
|
||||
connectDeviceName = deviceName;
|
||||
final List<ScanResult> devicesList = scanDevices;
|
||||
|
||||
final bool isExistDevice = isExistScanDevices(connectDeviceName);
|
||||
final bool isCurrentDevice =
|
||||
CommonDataManage().currentKeyInfo.lockName == deviceName;
|
||||
final String? mac = CommonDataManage().currentKeyInfo.mac;
|
||||
|
||||
if (isAddEquipment == false && isExistDevice == false) {
|
||||
AppLog.log('开始连接 是否存在缓存:$isExistDevice 是否是当前设备:$isCurrentDevice mac:$mac');
|
||||
if (GetPlatform.isAndroid &&
|
||||
!isExistDevice &&
|
||||
isCurrentDevice &&
|
||||
mac != null) {
|
||||
scanSingleTimer?.cancel();
|
||||
//兼容android 的低配手机
|
||||
await doNotSearchBLE(mac, connectStateCallBack);
|
||||
scanSingleTimer = Timer(3.seconds, () {
|
||||
scanSingleTimer?.cancel();
|
||||
startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) => null);
|
||||
});
|
||||
} else if (isAddEquipment == false && isExistDevice == false) {
|
||||
//取消缓存直接使用,存在配对场景设备信息会更变
|
||||
startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) {
|
||||
_connectDevice(scanDevices, deviceName, connectStateCallBack,
|
||||
@ -421,7 +437,51 @@ class BlueManage {
|
||||
}
|
||||
}
|
||||
|
||||
//直接给蓝牙设备写入
|
||||
Future<void> doNotSearchBLE(
|
||||
String masAdds, ConnectStateCallBack connectStateCallBack) async {
|
||||
await FlutterBluePlus.stopScan();
|
||||
final BluetoothDevice device = BluetoothDevice.fromId(masAdds);
|
||||
// 重连三次
|
||||
const int maxAttempts = 3;
|
||||
bool connected = false;
|
||||
int attempt = 0;
|
||||
while (attempt < maxAttempts && !connected) {
|
||||
try {
|
||||
await device.connect();
|
||||
connected = true;
|
||||
} catch (e, s) {
|
||||
AppLog.log('连接失败 重连了: ${e.toString()} ${s.toString()}');
|
||||
attempt++; // Increase the attempt count
|
||||
if (attempt < maxAttempts) {
|
||||
AppLog.log('重新尝试连接...');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!connected) {
|
||||
connectStateCallBack(BluetoothConnectionState.disconnected);
|
||||
return;
|
||||
}
|
||||
|
||||
bluetoothConnectDevice = device;
|
||||
bluetoothConnectionState = BluetoothConnectionState.connected;
|
||||
final List<BluetoothService> services =
|
||||
await bluetoothConnectDevice!.discoverServices();
|
||||
for (final BluetoothService service in services) {
|
||||
if (service.uuid == _serviceIdConnect) {
|
||||
for (final BluetoothCharacteristic characteristic
|
||||
in service.characteristics) {
|
||||
if (characteristic.characteristicUuid ==
|
||||
_characteristicIdSubscription) {
|
||||
_subScribeToCharacteristic(characteristic);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
connectStateCallBack(BluetoothConnectionState.connected);
|
||||
// writeCharacteristicWithResponse(value);
|
||||
}
|
||||
|
||||
Future<void> _subScribeToCharacteristic(
|
||||
BluetoothCharacteristic characteristic) async {
|
||||
|
||||
@ -32,19 +32,19 @@ class F {
|
||||
|
||||
//便捷判断并返回值
|
||||
static dynamic sw(
|
||||
{required fCallFunction defaultCall, fCallFunction? xhjCall}) {
|
||||
{required fCallFunction skyCall, required fCallFunction? xhjCall}) {
|
||||
if (xhjCall == null) {
|
||||
return defaultCall();
|
||||
return skyCall();
|
||||
}
|
||||
switch (appFlavor) {
|
||||
case Flavor.xhj:
|
||||
return xhjCall();
|
||||
case Flavor.sky:
|
||||
return skyCall();
|
||||
case Flavor.local:
|
||||
case Flavor.dev:
|
||||
case Flavor.pre:
|
||||
case Flavor.sky:
|
||||
case Flavor.xhj:
|
||||
default:
|
||||
return defaultCall();
|
||||
return xhjCall();
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ class F {
|
||||
case Flavor.dev:
|
||||
return '${"starLock".tr}-dev';
|
||||
case Flavor.pre:
|
||||
return "starLock".tr;
|
||||
return 'starLock'.tr;
|
||||
case Flavor.sky:
|
||||
return '锁通通';
|
||||
case Flavor.xhj:
|
||||
|
||||
@ -39,6 +39,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
Future<void> login() async {
|
||||
FocusScope.of(Get.context!).requestFocus(FocusNode()); //关闭键盘
|
||||
final LoginEntity entity = await ApiRepository.to.login(
|
||||
loginType: '1',
|
||||
password: state.pwd.value,
|
||||
@ -49,7 +50,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
||||
Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true);
|
||||
eventBus.fire(MineInfoChangeRefreshUI());
|
||||
XSJPushProvider().initJPushService();
|
||||
XSJPushProvider().initLocalNotification(false);
|
||||
XSJPushProvider().initLocalNotification(isCancelLocalPush: false);
|
||||
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
||||
BlueManage().scanDevices.clear(); //清除设备缓存
|
||||
}
|
||||
|
||||
@ -239,9 +239,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
child: SizedBox(
|
||||
width: 10.sp,
|
||||
)),
|
||||
F.isLite
|
||||
? Container()
|
||||
: GestureDetector(
|
||||
if (F.isLite) Container() else GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/login/login/starLock_login_state.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
@ -22,10 +23,8 @@ class StarLockLoginXHJPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
||||
final logic = Get.put(StarLockLoginLogic());
|
||||
final state = Get
|
||||
.find<StarLockLoginLogic>()
|
||||
.state;
|
||||
final StarLockLoginLogic logic = Get.put(StarLockLoginLogic());
|
||||
final StarLockLoginState state = Get.find<StarLockLoginLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -33,269 +32,291 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.only(top: 120.h, left: 40.w, right: 40.w),
|
||||
children: [
|
||||
Text(
|
||||
'${"欢迎使用".tr}${F.title}',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor,
|
||||
fontSize: 48.sp,
|
||||
padding: EdgeInsets.only(
|
||||
top: 120.h,
|
||||
),
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'${"欢迎使用".tr}${F.title}',
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor,
|
||||
fontSize: 48.sp,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30.h),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
final result =
|
||||
await Get.toNamed(Routers.selectCountryRegionPage);
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
state.countryCode.value = result['code'];
|
||||
state.countryName.value = result['countryName'];
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
Text(
|
||||
TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
),
|
||||
Obx(() {
|
||||
return Text(
|
||||
'${state.countryName.value} +${state.countryCode.value}',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.mainColor),
|
||||
);
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
LoginInput(
|
||||
controller: state.emailOrPhoneController,
|
||||
onchangeAction: (v) {
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
},
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w,
|
||||
bottom: 20.w,
|
||||
),
|
||||
),
|
||||
rightSlot: IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () {},
|
||||
),
|
||||
label: TranslationLoader
|
||||
.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
// keyboardType: TextInputType.number,
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
]),
|
||||
LoginInput(
|
||||
controller: state.pwdController,
|
||||
onchangeAction: (v) {
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
// isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w,
|
||||
bottom: 20.w,
|
||||
),
|
||||
),
|
||||
label:
|
||||
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
SizedBox(height: 10.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30.h),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
var result = await Get.toNamed(Routers.selectCountryRegionPage);
|
||||
if (result != null) {
|
||||
result as Map<String, dynamic>;
|
||||
state.countryCode.value = result['code'];
|
||||
state.countryName.value = result['countryName'];
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
Text(
|
||||
TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
),
|
||||
Obx(() {
|
||||
return Text(
|
||||
'${state.countryName.value} +${state.countryCode
|
||||
.value}',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.mainColor),
|
||||
);
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
LoginInput(
|
||||
controller: state.emailOrPhoneController,
|
||||
onchangeAction: (v) {
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
},
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w,
|
||||
bottom: 20.w,
|
||||
),
|
||||
),
|
||||
rightSlot: IconButton(
|
||||
icon: Icon(Icons.close),
|
||||
onPressed: () {},
|
||||
),
|
||||
label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
// keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(30),
|
||||
]),
|
||||
LoginInput(
|
||||
controller: state.pwdController,
|
||||
onchangeAction: (v) {
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
// isSuffixIcon: 2,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w,
|
||||
bottom: 20.w,
|
||||
),
|
||||
),
|
||||
label:
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!
|
||||
.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
SizedBox(height: 30.h),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
state.agree.value = !state.agree.value;
|
||||
logic.changeAgreeState();
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.h),
|
||||
child: Container(
|
||||
color: Colors.transparent,
|
||||
padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 40.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(
|
||||
() =>
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 5.w,
|
||||
right: 10.w,
|
||||
),
|
||||
child: Image.asset(
|
||||
state.agree.value
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
),
|
||||
),
|
||||
() => Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 5.w,
|
||||
right: 10.w,
|
||||
),
|
||||
child: Image.asset(
|
||||
state.agree.value
|
||||
? 'images/icon_round_select.png'
|
||||
: 'images/icon_round_unSelect.png',
|
||||
width: 20.w,
|
||||
height: 20.w,
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: TranslationLoader.lanKeys!.readAndAgree!.tr,
|
||||
style: TextStyle(
|
||||
color: const Color(0xff333333),
|
||||
fontSize: 20.sp),
|
||||
children: [
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
child: Text(
|
||||
'《${TranslationLoader.lanKeys!
|
||||
.userAgreement!.tr}》',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: {
|
||||
"url": XSConstantMacro
|
||||
.userAgreementURL,
|
||||
"title": '用户协议'.tr
|
||||
});
|
||||
},
|
||||
)),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
child: Text(
|
||||
'《${TranslationLoader.lanKeys!
|
||||
.privacyPolicy!.tr}》',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: {
|
||||
"url": XSConstantMacro
|
||||
.privacyPolicyURL,
|
||||
"title": '隐私政策'.tr
|
||||
});
|
||||
},
|
||||
)),
|
||||
],
|
||||
)),
|
||||
text: TranslationLoader.lanKeys!.readAndAgree!.tr,
|
||||
style: TextStyle(
|
||||
color: const Color(0xff333333), fontSize: 20.sp),
|
||||
children: <InlineSpan>[
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
child: Text(
|
||||
'《${TranslationLoader.lanKeys!.userAgreement!.tr}》',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: <String, String>{
|
||||
'url': XSConstantMacro.userAgreementURL,
|
||||
'title': '用户协议'.tr
|
||||
});
|
||||
},
|
||||
)),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
child: Text(
|
||||
'《${TranslationLoader.lanKeys!.privacyPolicy!.tr}》',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.webviewShowPage,
|
||||
arguments: <String, String>{
|
||||
'url': XSConstantMacro.privacyPolicyURL,
|
||||
'title': '隐私政策'.tr
|
||||
});
|
||||
},
|
||||
)),
|
||||
],
|
||||
)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15.w),
|
||||
Obx(() =>
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.login!.tr,
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
isDisabled: state.canNext.value,
|
||||
onClick: state.canNext.value
|
||||
? () {
|
||||
if (state.agree.value == false) {
|
||||
logic.showToast('请先同意用户协议及隐私政策'.tr);
|
||||
return;
|
||||
} else {
|
||||
logic.login();
|
||||
}
|
||||
}
|
||||
: null)),
|
||||
SizedBox(height: 10.h),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
var data = await Get.toNamed(Routers.starLockRegisterPage);
|
||||
if (data != null) {
|
||||
state.emailOrPhoneController.text = data['phoneOrEmailStr'];
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
state.pwdController.text = data['pwd'];
|
||||
logic.checkNext(state.pwdController);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.mainColor),
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.register!.tr,
|
||||
style: TextStyle(fontSize: 22.sp, color: Colors.white),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(height: 5.w),
|
||||
Obx(() => SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.login!.tr,
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
isDisabled: state.canNext.value,
|
||||
onClick: state.canNext.value
|
||||
? () {
|
||||
if (state.agree.value == false) {
|
||||
logic.showToast('请先同意用户协议及隐私政策'.tr);
|
||||
return;
|
||||
} else {
|
||||
logic.login();
|
||||
}
|
||||
}
|
||||
: null)),
|
||||
SizedBox(height: 10.h),
|
||||
SizedBox(
|
||||
width: Get.width,
|
||||
child: ElevatedButton(
|
||||
onPressed: () async {
|
||||
final dynamic data =
|
||||
await Get.toNamed(Routers.starLockRegisterPage);
|
||||
if (data != null) {
|
||||
state.emailOrPhoneController.text =
|
||||
data['phoneOrEmailStr'];
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
state.pwdController.text = data['pwd'];
|
||||
logic.checkNext(state.pwdController);
|
||||
setState(() {});
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.mainColor),
|
||||
child: Text(
|
||||
'${TranslationLoader.lanKeys!.forgetPassword!.tr}?',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.mainColor)),
|
||||
TranslationLoader.lanKeys!.register!.tr,
|
||||
style: TextStyle(fontSize: 22.sp, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.starLockForgetPasswordPage);
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 10.sp,
|
||||
)),
|
||||
F.isLite
|
||||
? Container()
|
||||
: GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text('演示模式'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.mainColor)),
|
||||
),
|
||||
SizedBox(height: 5.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${TranslationLoader.lanKeys!.forgetPassword!.tr}?',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.mainColor)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.starLockForgetPasswordPage);
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
width: 10.sp,
|
||||
)),
|
||||
if (F.isLite)
|
||||
Container()
|
||||
else
|
||||
GestureDetector(
|
||||
child: SizedBox(
|
||||
// width: 150.w,
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text('演示模式'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: AppColors.mainColor)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.demoModeLockDetailPage);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
Widget loginInput({TextEditingController? controller,
|
||||
List<TextInputFormatter>? inputFormatters,
|
||||
String? hintText,
|
||||
bool? isHaveLeftWidget,
|
||||
Widget? leftWidget,
|
||||
String? label,
|
||||
bool? isPwd,
|
||||
BlockStrCallback? onchangeAction}) {
|
||||
Widget loginInput(
|
||||
{TextEditingController? controller,
|
||||
List<TextInputFormatter>? inputFormatters,
|
||||
String? hintText,
|
||||
bool? isHaveLeftWidget,
|
||||
Widget? leftWidget,
|
||||
String? label,
|
||||
bool? isPwd,
|
||||
BlockStrCallback? onchangeAction}) {
|
||||
return Container(
|
||||
width: 1.sp,
|
||||
color: Colors.transparent,
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
color: Colors.red,
|
||||
child: Image.asset(
|
||||
|
||||
@ -1,36 +1,20 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
import 'package:star_lock/tools/titleAppBar.dart';
|
||||
import 'package:star_lock/widget/flavors_img.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../blue/blue_manage.dart';
|
||||
import '../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import '../../../tools/appRouteObserver.dart';
|
||||
import '../../../tools/commonDataManage.dart';
|
||||
import '../../../tools/dateTool.dart';
|
||||
import '../../../tools/eventBusEventManage.dart';
|
||||
import '../../../tools/storage.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
import '../../lockMian/entity/lockListInfo_entity.dart';
|
||||
import 'lockDetail_logic.dart';
|
||||
|
||||
class LockDetailListPage extends StatefulWidget {
|
||||
|
||||
const LockDetailListPage({required this.title, required this.items, Key? key})
|
||||
: super(key: key);
|
||||
final String title;
|
||||
final List<Widget> items;
|
||||
|
||||
const LockDetailListPage({Key? key, required this.title, required this.items})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<LockDetailListPage> createState() => _LockDetailListPageState();
|
||||
}
|
||||
@ -59,7 +43,7 @@ class _LockDetailListPageState extends State<LockDetailListPage>
|
||||
body: ListView.builder(
|
||||
padding: EdgeInsets.only(top: 15.h),
|
||||
itemCount: widget.items.length,
|
||||
itemBuilder: (context, index) => widget.items[index]),
|
||||
itemBuilder: (BuildContext context, int index) => widget.items[index]),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,8 +504,8 @@ class LockDetailLogic extends BaseGetXController {
|
||||
void resetOpenDoorState() {
|
||||
state.openLockBtnState.value = 0;
|
||||
state.openDoorBtnisUneable.value = false;
|
||||
state.animationController!.reset();
|
||||
state.animationController!.forward();
|
||||
state.animationController?.reset();
|
||||
state.animationController?.forward();
|
||||
eventBus.fire(RefreshLockDetailInfoDataEvent());
|
||||
}
|
||||
|
||||
@ -513,7 +513,6 @@ class LockDetailLogic extends BaseGetXController {
|
||||
Future<void> onReady() async {
|
||||
super.onReady();
|
||||
getServerDatetime();
|
||||
|
||||
await PermissionDialog.request(Permission.location);
|
||||
await PermissionDialog.requestBluetooth();
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
|
||||
isOnlyOneData = obj["isOnlyOneData"];
|
||||
|
||||
return F.sw(
|
||||
defaultCall: () => Scaffold(
|
||||
skyCall: () => Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: F.navTitle,
|
||||
|
||||
@ -145,7 +145,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
loadData();
|
||||
return F.sw(defaultCall: skWidget, xhjCall: xhjWidget);
|
||||
return F.sw(skyCall: skWidget, xhjCall: xhjWidget);
|
||||
}
|
||||
|
||||
//鑫泓佳布局
|
||||
@ -342,56 +342,72 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
adminInfoView(center: false, max: false),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
showElectricIcon(state.electricQuantity.value),
|
||||
width: 30.w,
|
||||
height: 24.w),
|
||||
SizedBox(width: 2.w),
|
||||
Text('${state.electricQuantity.value}%',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
SizedBox(width: 2.w),
|
||||
Icon(
|
||||
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||
color: AppColors.mainColor, // 设置图标颜色为红色
|
||||
size: 25.w, // 设置图标大小为 30
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
ShowTipView().showSureAlertDialog(
|
||||
"${"锁电量更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}");
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
showElectricIcon(state.electricQuantity.value),
|
||||
width: 30.w,
|
||||
height: 24.w),
|
||||
SizedBox(width: 2.w),
|
||||
Text('${state.electricQuantity.value}%',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
SizedBox(width: 2.w),
|
||||
Icon(
|
||||
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||
color: AppColors.mainColor, // 设置图标颜色为红色
|
||||
size: 25.w, // 设置图标大小为 30
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
Visibility(
|
||||
visible: state.keyInfos.value.lockFeature!
|
||||
.isSupportBackupBattery ==
|
||||
1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
FlavorsImg(
|
||||
child: Image.asset(
|
||||
showElectricIcon(
|
||||
state.electricQuantityStandby.value),
|
||||
width: 30.w,
|
||||
height: 24.w),
|
||||
),
|
||||
SizedBox(width: 2.w),
|
||||
Text('${state.electricQuantityStandby.value}%',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
SizedBox(width: 2.w),
|
||||
FlavorsImg(
|
||||
child: Icon(
|
||||
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||
color: AppColors.mainColor, // 设置图标颜色为红色
|
||||
size: 25.w, // 设置图标大小为 30
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
showElectricIcon(state.electricQuantity.value),
|
||||
width: 30.w,
|
||||
height: 24.w),
|
||||
SizedBox(width: 2.w),
|
||||
Text('--%',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor)),
|
||||
SizedBox(width: 2.w),
|
||||
Icon(
|
||||
Icons.info, // 使用内置的 warning 图标,它是一个叹号
|
||||
color: AppColors.mainColor, // 设置图标颜色为红色
|
||||
size: 25.w, // 设置图标大小为 30
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
@ -480,7 +496,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
F.sw(
|
||||
defaultCall: () => SizedBox(height: 50.h),
|
||||
skyCall: () => SizedBox(height: 50.h),
|
||||
xhjCall: () => Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 12.h,
|
||||
@ -574,7 +590,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
],
|
||||
),
|
||||
F.sw(
|
||||
defaultCall: () => SizedBox(height: 30.h),
|
||||
skyCall: () => SizedBox(height: 30.h),
|
||||
xhjCall: () => SizedBox(height: 15.h),
|
||||
),
|
||||
Container(
|
||||
@ -689,7 +705,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
),
|
||||
F.sw(defaultCall: adminInfoView, xhjCall: () => const SizedBox()),
|
||||
F.sw(skyCall: adminInfoView, xhjCall: () => const SizedBox()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
@ -1137,7 +1153,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
Widget bottomItem(
|
||||
String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
|
||||
final Widget child = F.sw(
|
||||
defaultCall: () => Container(
|
||||
skyCall: () => Container(
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
||||
@ -4,6 +4,8 @@ import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart';
|
||||
import 'package:star_lock/tools/showTipView.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
@ -14,7 +16,9 @@ import '../../../../blue/io_reply.dart';
|
||||
import '../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../blue/sender_manage.dart';
|
||||
import '../../../../login/login/entity/LoginEntity.dart';
|
||||
|
||||
import '../../../../flavors.dart';
|
||||
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/baseGetXController.dart';
|
||||
import '../../../../tools/commonDataManage.dart';
|
||||
@ -33,9 +37,10 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
// 监听蓝牙协议返回结果
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
|
||||
void _initReplySubscription() {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
|
||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||
// 删除用户
|
||||
// if (reply is DeletUserReply) {
|
||||
// _replyDeletUserKey(reply);
|
||||
@ -107,8 +112,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
// 恢复出厂设置数据解析
|
||||
Future<void> _replyFactoryDataResetKey(Reply reply) async {
|
||||
var token = reply.data.sublist(2, 6);
|
||||
var saveStrList = changeIntListToStringList(token);
|
||||
List<int> token = reply.data.sublist(2, 6);
|
||||
List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[6];
|
||||
@ -121,13 +126,15 @@ class LockSetLogic extends BaseGetXController {
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<String>? publicKey =
|
||||
await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
IoSenderManage.senderFactoryDataReset(
|
||||
@ -285,13 +292,15 @@ class LockSetLogic extends BaseGetXController {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState connectionState) async {
|
||||
if (connectionState == BluetoothConnectionState.connected) {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<String>? publicKey =
|
||||
await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
IoSenderManage.senderFactoryDataReset(
|
||||
@ -347,18 +356,20 @@ class LockSetLogic extends BaseGetXController {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState connectionState) async {
|
||||
if (connectionState == BluetoothConnectionState.connected) {
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<String>? publicKey =
|
||||
await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
|
||||
|
||||
state.settingUpSupportFeatures = type;
|
||||
|
||||
var featureEnable = 0;
|
||||
int featureEnable = 0;
|
||||
if (type == 55) {
|
||||
// APP开锁时是否需联网
|
||||
featureEnable = state.isOpenLockNeedOnline.value == 1 ? 0 : 1;
|
||||
@ -419,9 +430,9 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 开启考勤获取是否有公司
|
||||
void openCheckingInData(
|
||||
Future<void> openCheckingInData(
|
||||
BlockSetCheckInCallback blockSetCheckInCallback) async {
|
||||
var entity = await ApiRepository.to.openCheckingInData(
|
||||
CheckingInInfoDataEntity entity = await ApiRepository.to.openCheckingInData(
|
||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
@ -430,8 +441,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 设置是否打开考勤
|
||||
void setLockSetGeneralSetting() async {
|
||||
var entity = await ApiRepository.to.setCheckInData(
|
||||
Future<void> setLockSetGeneralSetting() async {
|
||||
LoginEntity entity = await ApiRepository.to.setCheckInData(
|
||||
lockId: state.lockSetInfoData.value.lockId!,
|
||||
attendance: state.isAttendance.value == 1 ? 0 : 1,
|
||||
);
|
||||
@ -448,7 +459,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
// 设置是否打开开锁提醒
|
||||
Future<void> setLockPickingReminder() async {
|
||||
var entity = await ApiRepository.to.setLockPickingReminderData(
|
||||
LoginEntity entity = await ApiRepository.to.setLockPickingReminderData(
|
||||
lockId: state.lockSetInfoData.value.lockId!,
|
||||
unlockReminder: state.isLockPickingReminder.value == 1 ? 0 : 1,
|
||||
);
|
||||
@ -464,8 +475,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 设置是否打开开锁时是否需联网
|
||||
void setLockSetOpenLockNeedOnline() async {
|
||||
var entity = await ApiRepository.to.setOpenLockNeedOnlineData(
|
||||
Future<void> setLockSetOpenLockNeedOnline() async {
|
||||
LoginEntity entity = await ApiRepository.to.setOpenLockNeedOnlineData(
|
||||
lockId: state.lockSetInfoData.value.lockId!,
|
||||
appUnlockOnline: state.isOpenLockNeedOnline.value == 1 ? 0 : 1,
|
||||
);
|
||||
@ -485,16 +496,18 @@ class LockSetLogic extends BaseGetXController {
|
||||
|
||||
// 下级界面修改成功后传递数据
|
||||
StreamSubscription? _passCurrentLockInformationEvent;
|
||||
|
||||
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_passCurrentLockInformationEvent =
|
||||
eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
|
||||
_passCurrentLockInformationEvent = eventBus
|
||||
.on<PassCurrentLockInformationEvent>()
|
||||
.listen((PassCurrentLockInformationEvent event) {
|
||||
getLockSettingInfoData();
|
||||
});
|
||||
}
|
||||
|
||||
void showDeletAlertTipDialog({String? showContent = ''}) {
|
||||
var content = showContent!.isEmpty
|
||||
String content = showContent!.isEmpty
|
||||
? "${"删除设备失败,请确保在设备附近,设备未被连接,设备已打开".tr}${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮".tr : ""}"
|
||||
: showContent;
|
||||
ShowTipView().showSureAlertDialog(content);
|
||||
@ -515,7 +528,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
} else if (state.lockBasicInfo.value.keyRight == 1) {
|
||||
// 授权管理员弹框提示
|
||||
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
|
||||
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (a) {
|
||||
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
|
||||
// 授权管理员删除
|
||||
state.deleteAdministratorIsHaveAllData.value = a;
|
||||
deletKeyData();
|
||||
@ -529,8 +542,8 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 查询账户密码
|
||||
void checkLoginPassword() async {
|
||||
var entity = await ApiRepository.to.checkLoginPassword(
|
||||
Future<void> checkLoginPassword() async {
|
||||
LockListInfoEntity entity = await ApiRepository.to.checkLoginPassword(
|
||||
password: state.passwordTF.text,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
@ -540,21 +553,21 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 当是锁拥有者的时候,删除锁
|
||||
void deletLockInfoData() async {
|
||||
var entity = await ApiRepository.to.deletOwnerLockData(
|
||||
Future<void> deletLockInfoData() async {
|
||||
LockListInfoEntity entity = await ApiRepository.to.deletOwnerLockData(
|
||||
lockId: state.lockSetInfoData.value.lockId!,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
BlueManage().connectDeviceMacAddress = "";
|
||||
BlueManage().connectDeviceMacAddress = '';
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
if(state.isOnlyOneData.value == true){
|
||||
Future.delayed(const Duration(milliseconds: 200)).then((e) {
|
||||
if (state.isOnlyOneData.value == true) {
|
||||
Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) {
|
||||
Get.close(1);
|
||||
});
|
||||
}else{
|
||||
Future.delayed(const Duration(milliseconds: 200)).then((e) {
|
||||
} else {
|
||||
Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) {
|
||||
Get.close(2);
|
||||
});
|
||||
}
|
||||
@ -562,27 +575,27 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 普通用户或者授权管理员删除钥匙
|
||||
void deletKeyData() async {
|
||||
var entity = await ApiRepository.to.deletOwnerKeyData(
|
||||
Future<void> deletKeyData() async {
|
||||
final LockListInfoEntity entity = await ApiRepository.to.deletOwnerKeyData(
|
||||
lockId: state.lockSetInfoData.value.lockId.toString(),
|
||||
keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
|
||||
includeUnderlings: state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0
|
||||
);
|
||||
includeUnderlings:
|
||||
state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
BlueManage().connectDeviceMacAddress = "";
|
||||
BlueManage().connectDeviceMacAddress = '';
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
eventBus.fire(RefreshLockListInfoDataEvent());
|
||||
});
|
||||
if(state.isOnlyOneData.value == true){
|
||||
Future.delayed(const Duration(milliseconds: 200)).then((e) {
|
||||
Get.close(1);
|
||||
});
|
||||
}else{
|
||||
Future.delayed(const Duration(milliseconds: 200)).then((e) {
|
||||
Get.close(2);
|
||||
});
|
||||
}
|
||||
// Get.offAllNamed(Routers.starLockMain);
|
||||
final bool isXHJ = F.isXHJ;
|
||||
final bool isOnlyOneData = state.isOnlyOneData.value == true;
|
||||
Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) {
|
||||
if (isXHJ) {
|
||||
Get.close(3);
|
||||
} else {
|
||||
final int onlyOneDataInt = isOnlyOneData ? 1 : 2;
|
||||
Get.close(onlyOneDataInt);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ class LockUserLogic extends BaseGetXController {
|
||||
searchStr: state.searchController.text,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.lockUserList.clear();
|
||||
//当前钥匙类型 1:电子钥匙 2:密码钥匙 3:指纹钥匙 4:卡钥匙 5:人脸钥匙
|
||||
final LockUserData data1 = entity.data![0];
|
||||
data1.lockUserList?.forEach((LockUserListKeys element) {
|
||||
|
||||
@ -24,14 +24,16 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
// 获取解析后的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||
// 添加卡片开始(重置锁里面所有卡)
|
||||
if((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
||||
if ((reply is SenderCustomPasswordsReply) &&
|
||||
(state.ifCurrentScreen.value == true)) {
|
||||
_replyAddPassword(reply);
|
||||
}
|
||||
|
||||
if((reply is SenderResetPasswordsReply) && (state.ifCurrentScreen.value == true)){
|
||||
if ((reply is SenderResetPasswordsReply) &&
|
||||
(state.ifCurrentScreen.value == true)) {
|
||||
_replyResetPassword(reply);
|
||||
}
|
||||
});
|
||||
@ -41,14 +43,14 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
Future<void> _replyAddPassword(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
//成功
|
||||
cancelBlueConnetctToastTimer();
|
||||
deletePwdRequest();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -60,15 +62,15 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
IoSenderManage.senderCustomPasswordsCommand(
|
||||
keyID:"0",
|
||||
userID:(await Storage.getUid())!,
|
||||
pwdNo:state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
||||
pwd:state.pwd,//state.deletPWD,
|
||||
keyID: "0",
|
||||
userID: (await Storage.getUid())!,
|
||||
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
||||
pwd: state.pwd, //state.deletPWD,
|
||||
operate: state.itemData.isCustom == 1 ? 2 : 3,
|
||||
isAdmin: 0,
|
||||
useCountLimit: 0xffff,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime: 0x11223344,
|
||||
endTime: 0x11223344,
|
||||
needAuthor: 1,
|
||||
isBeforeAddUser: false,
|
||||
signKey: signKeyDataList,
|
||||
@ -85,16 +87,16 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
// 重置密码
|
||||
Future<void> _replyResetPassword(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
switch(status){
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
//成功
|
||||
//成功
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
state.encrpyKey = reply.data.sublist(9, 17);
|
||||
resetPasswordKeyListRequest();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
//无权限
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
@ -106,8 +108,8 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
IoSenderManage.senderResetPasswordsCommand(
|
||||
keyID:"0",
|
||||
userID:(await Storage.getUid())!,
|
||||
keyID: "0",
|
||||
userID: (await Storage.getUid())!,
|
||||
needAuthor: 1,
|
||||
isBeforeAddUser: false,
|
||||
signKey: signKeyDataList,
|
||||
@ -125,10 +127,11 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
// 设置自定义密码 这里用作删除密码
|
||||
Future<void> senderCustomPasswords() async {
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
});
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
@ -140,25 +143,26 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
IoSenderManage.senderCustomPasswordsCommand(
|
||||
keyID:"0",
|
||||
userID:(await Storage.getUid())!,
|
||||
pwdNo:state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
||||
pwd:state.pwd,//state.deletPWD,
|
||||
keyID: "0",
|
||||
userID: (await Storage.getUid())!,
|
||||
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
||||
pwd: state.pwd, //state.deletPWD,
|
||||
operate: state.itemData.isCustom == 1 ? 2 : 3,
|
||||
isAdmin: 0,
|
||||
useCountLimit: 0xffff,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
startTime: 0x11223344,
|
||||
endTime: 0x11223344,
|
||||
needAuthor: 1,
|
||||
isBeforeAddUser: false,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
@ -167,17 +171,18 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
|
||||
// 重置密码
|
||||
Future<void> senderResetPasswords() async {
|
||||
if(state.sureBtnState.value == 1){
|
||||
if (state.sureBtnState.value == 1) {
|
||||
return;
|
||||
}
|
||||
state.sureBtnState.value = 1;
|
||||
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
state.sureBtnState.value = 0;
|
||||
});
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
@ -189,43 +194,80 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
IoSenderManage.senderResetPasswordsCommand(
|
||||
keyID:"0",
|
||||
userID:(await Storage.getUid())!,
|
||||
keyID: "0",
|
||||
userID: (await Storage.getUid())!,
|
||||
needAuthor: 1,
|
||||
isBeforeAddUser: false,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* //请求操作记录列表(门锁日志)
|
||||
void mockNetworkDataRequest({required bool isRefresh}) async {
|
||||
// 如果是下拉刷新,清空已有数据
|
||||
if (isRefresh) {
|
||||
state.lockLogItemList.clear();
|
||||
pageNo = 1;
|
||||
}
|
||||
DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
|
||||
lockId: state.keyInfos.value.lockId!,
|
||||
lockEventType: state.dropdownValue.value,
|
||||
pageNo: pageNo,
|
||||
pageSize: int.parse(pageSize),
|
||||
startDate: state.startDate.value,
|
||||
endDate: state.endDate.value);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
// 更新数据列表
|
||||
state.lockLogItemList.addAll(entity.data!.itemList!);
|
||||
// 更新页码
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//请求密码钥匙列表
|
||||
Future<PasswordKeyListEntity> mockNetworkDataRequest() async {
|
||||
PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList(
|
||||
Future<PasswordKeyListEntity> mockNetworkDataRequest(
|
||||
{required bool isRefresh}) async {
|
||||
// 如果是下拉刷新,清空已有数据
|
||||
if (isRefresh) {
|
||||
state.itemDataList.clear();
|
||||
pageNo = 1;
|
||||
}
|
||||
|
||||
final PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList(
|
||||
state.keyInfo.value.keyStatus.toString(),
|
||||
state.keyInfo.value.lockId.toString(),
|
||||
pageNo.toString(),
|
||||
pageSize.toString(),
|
||||
state.searchController.text);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (pageNo == 1) {
|
||||
state.itemDataList.value.clear();
|
||||
state.itemDataList.value = entity.data!.itemList!;
|
||||
pageNo++;
|
||||
} else {
|
||||
if (entity.data!.itemList!.isNotEmpty) {
|
||||
state.itemDataList.value.addAll(entity.data!.itemList!);
|
||||
pageNo++;
|
||||
}
|
||||
}
|
||||
// 更新数据列表
|
||||
state.itemDataList.addAll(entity.data!.itemList!);
|
||||
// 更新页码
|
||||
pageNo++;
|
||||
|
||||
// if (pageNo == 1) {
|
||||
// state.itemDataList.value.clear();
|
||||
// state.itemDataList.value = entity.data!.itemList!;
|
||||
// pageNo++;
|
||||
// } else {
|
||||
// if (entity.data!.itemList!.isNotEmpty) {
|
||||
// state.itemDataList.value.addAll(entity.data!.itemList!);
|
||||
// pageNo++;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
@ -233,13 +275,12 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
//密码钥匙重置请求
|
||||
Future<void> resetPasswordKeyListRequest() async {
|
||||
PasswordKeyListEntity entity = await ApiRepository.to.keyboardPwdReset(
|
||||
lockId:state.keyInfo.value.lockId.toString(),
|
||||
passwordKey: state.encrpyKey
|
||||
);
|
||||
lockId: state.keyInfo.value.lockId.toString(),
|
||||
passwordKey: state.encrpyKey);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("重置成功".tr, something: (){
|
||||
showToast("重置成功".tr, something: () {
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
mockNetworkDataRequest(isRefresh: true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -247,13 +288,13 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
//删除密码请求 deleteType:1-蓝牙 2-网关
|
||||
Future<void> deletePwdRequest() async {
|
||||
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
||||
lockId:state.itemData.lockId!.toString(),
|
||||
keyboardPwdId:state.itemData.keyboardPwdId!.toString(),
|
||||
deleteType:1);
|
||||
lockId: state.itemData.lockId!.toString(),
|
||||
keyboardPwdId: state.itemData.keyboardPwdId!.toString(),
|
||||
deleteType: 1);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
showToast("删除成功".tr, something: (){
|
||||
showToast("删除成功".tr, something: () {
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
mockNetworkDataRequest(isRefresh: true);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -262,80 +303,76 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
String getUseDateStr(PasswordKeyListItem indexEntity) {
|
||||
int? getPwdType = indexEntity.keyboardPwdType;
|
||||
String useDateStr = '';
|
||||
DateTime sendDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||
DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||
DateTime sendDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||
DateTime startDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||
DateTime endDateStr =
|
||||
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||
int starHour = indexEntity.hoursStart!;
|
||||
int endHour = indexEntity.hoursEnd!;
|
||||
// AppLog.log('indexEntity.keyboardPwdName:${indexEntity.keyboardPwdName} indexEntity.keyboardPwdStatus:${indexEntity.keyboardPwdStatus} indexEntity.startDate!${indexEntity.startDate!} indexEntity.endDate!${indexEntity.endDate!} starHour:$starHour endHour:$endHour');
|
||||
|
||||
switch (getPwdType) {
|
||||
case 1:
|
||||
//单次 1 只能在开始时间后6小时内使用一次
|
||||
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
|
||||
//单次 1 只能在开始时间后6小时内使用一次
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
|
||||
break;
|
||||
case 2:
|
||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr} ${indexEntity.isCustom! == 1? "自定义".tr : ""}';
|
||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr =
|
||||
'${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr} ${indexEntity.isCustom! == 1 ? "自定义".tr : ""}';
|
||||
break;
|
||||
case 3:
|
||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} ${"限时".tr} ${indexEntity.isCustom! == 1? "自定义".tr : ""}';
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} ${"限时".tr} ${indexEntity.isCustom! == 1 ? "自定义".tr : ""}';
|
||||
break;
|
||||
case 4:
|
||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
|
||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
useDateStr =
|
||||
'${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
|
||||
break;
|
||||
case 5:
|
||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||
useDateStr = '${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 6:
|
||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
|
||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||
useDateStr = '${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
|
||||
break;
|
||||
case 7:
|
||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||
useDateStr =
|
||||
'${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||
useDateStr = '${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 8:
|
||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||
useDateStr = '${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 9:
|
||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||
useDateStr = '${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 10:
|
||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||
useDateStr = '${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 11:
|
||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||
useDateStr = '${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 12:
|
||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||
useDateStr = '${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 13:
|
||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||
useDateStr = '${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
case 14:
|
||||
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||
useDateStr =
|
||||
'${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||
useDateStr = '${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -347,9 +384,9 @@ class PasswordKeyListLogic extends BaseGetXController {
|
||||
StreamSubscription? _getPasswordListRefreshUIEvent;
|
||||
void _getPasswordListRefreshUIAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_getPasswordListRefreshUIEvent = eventBus.on<GetPasswordListRefreshUI>().listen((event) {
|
||||
pageNo = 1;
|
||||
mockNetworkDataRequest();
|
||||
_getPasswordListRefreshUIEvent =
|
||||
eventBus.on<GetPasswordListRefreshUI>().listen((event) {
|
||||
mockNetworkDataRequest(isRefresh: true);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
@ -24,14 +23,17 @@ class PasswordKeyListPage extends StatefulWidget {
|
||||
State<PasswordKeyListPage> createState() => _PasswordKeyListPageState();
|
||||
}
|
||||
|
||||
class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAware {
|
||||
class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
||||
with RouteAware {
|
||||
final logic = Get.put(PasswordKeyListLogic());
|
||||
final state = Get.find<PasswordKeyListLogic>().state;
|
||||
|
||||
Future<void> getHttpData() async {
|
||||
Future<void> getHttpData({required bool isRefresh}) async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
logic.mockNetworkDataRequest().then((PasswordKeyListEntity value){
|
||||
logic
|
||||
.mockNetworkDataRequest(isRefresh: isRefresh)
|
||||
.then((PasswordKeyListEntity value) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
@ -41,7 +43,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
getHttpData();
|
||||
getHttpData(isRefresh: true);
|
||||
}
|
||||
|
||||
@override
|
||||
@ -61,11 +63,12 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
||||
onPressed: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if (isDemoMode == false) {
|
||||
if(state.itemDataList.isEmpty){
|
||||
if (state.itemDataList.isEmpty) {
|
||||
logic.showToast("暂无密码,无需重置".tr);
|
||||
return;
|
||||
}
|
||||
ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, () {
|
||||
ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr,
|
||||
() {
|
||||
logic.senderResetPasswords();
|
||||
});
|
||||
} else {
|
||||
@ -76,12 +79,11 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
||||
],
|
||||
),
|
||||
body: EasyRefreshTool(
|
||||
onRefresh: (){
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
onRefresh: () {
|
||||
getHttpData(isRefresh: true);
|
||||
},
|
||||
onLoad: (){
|
||||
getHttpData();
|
||||
onLoad: () {
|
||||
getHttpData(isRefresh: false);
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
@ -89,26 +91,25 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
||||
KeySearchWidget(
|
||||
editingController: state.searchController,
|
||||
onSubmittedAction: () {
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
getHttpData(isRefresh: true);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Expanded(
|
||||
child: _buildMainUI()),
|
||||
Expanded(child: _buildMainUI()),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
AddBottomWhiteBtn(
|
||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||
onClick: () {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyPerpetualPage,
|
||||
arguments: {"keyInfo": state.keyInfo.value}).then((val) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.passwordKeyPerpetualPage,
|
||||
arguments: {"keyInfo": state.keyInfo.value})
|
||||
.then((val) {
|
||||
if (val != null) {
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
getHttpData(isRefresh: true);
|
||||
}
|
||||
});
|
||||
}),
|
||||
@ -122,58 +123,68 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
||||
|
||||
Widget _buildMainUI() {
|
||||
return Obx(() => state.itemDataList.value.isEmpty
|
||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
||||
? NoData(
|
||||
noDataHeight: 1.sh -
|
||||
ScreenUtil().statusBarHeight -
|
||||
ScreenUtil().bottomBarHeight -
|
||||
190.h -
|
||||
64.h)
|
||||
: SlidableAutoCloseBehavior(
|
||||
child: ListView.separated(
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
PasswordKeyListItem passwordKeyListItem = state.itemDataList.value[index];
|
||||
String useDateStr = logic.getUseDateStr(passwordKeyListItem);// 使用期限
|
||||
child: ListView.separated(
|
||||
itemCount: state.itemDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
PasswordKeyListItem passwordKeyListItem =
|
||||
state.itemDataList.value[index];
|
||||
String useDateStr =
|
||||
logic.getUseDateStr(passwordKeyListItem); // 使用期限
|
||||
|
||||
return Slidable(
|
||||
key:ValueKey(passwordKeyListItem.keyboardPwdId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async {
|
||||
state.itemData = passwordKeyListItem;
|
||||
state.pwdNo = passwordKeyListItem.pwdUserNo!;
|
||||
state.pwd = passwordKeyListItem.keyboardPwd!;
|
||||
logic.senderCustomPasswords();
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除'.tr,
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
return Slidable(
|
||||
key: ValueKey(passwordKeyListItem.keyboardPwdId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context) {
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
"确定要删除吗?".tr, () async {
|
||||
state.itemData = passwordKeyListItem;
|
||||
state.pwdNo = passwordKeyListItem.pwdUserNo!;
|
||||
state.pwd = passwordKeyListItem.keyboardPwd!;
|
||||
logic.senderCustomPasswords();
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除'.tr,
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
child: _electronicKeyItem(index, 'images/icon_password.png', passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||
arguments: {"itemData": passwordKeyListItem}).then((val) {
|
||||
if (val != null) {
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
}
|
||||
});
|
||||
}),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
));
|
||||
child: _electronicKeyItem(index, 'images/icon_password.png',
|
||||
passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||
arguments: {"itemData": passwordKeyListItem})
|
||||
.then((val) {
|
||||
if (val != null) {
|
||||
getHttpData(isRefresh: true);
|
||||
}
|
||||
});
|
||||
}),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, String lockTypeTitle, String useDateStr, Function()? action) {
|
||||
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon,
|
||||
String lockTypeTitle, String useDateStr, Function()? action) {
|
||||
PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
||||
|
||||
return GestureDetector(
|
||||
@ -185,8 +196,14 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 30.w),
|
||||
Image.asset(lockTypeIcon, width: 60.w, height: 60.w,),
|
||||
SizedBox(width: 20.w,),
|
||||
Image.asset(
|
||||
lockTypeIcon,
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -194,22 +211,28 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: passwordKeyListItem.keyboardPwdStatus == 2 ? 1.sw - 110.w - 100.w : 1.sw - 110.w - 50.w,
|
||||
child: Row(
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
lockTypeTitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)
|
||||
),
|
||||
)
|
||||
]
|
||||
),
|
||||
width: passwordKeyListItem.keyboardPwdStatus == 2
|
||||
? 1.sw - 110.w - 100.w
|
||||
: 1.sw - 110.w - 50.w,
|
||||
child: Row(children: [
|
||||
Flexible(
|
||||
child: Text(lockTypeTitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: AppColors.blackColor)),
|
||||
)
|
||||
]),
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已过期'.tr, style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(),
|
||||
passwordKeyListItem.keyboardPwdStatus == 2
|
||||
? Text(
|
||||
'已过期'.tr,
|
||||
style:
|
||||
TextStyle(color: Colors.red, fontSize: 20.sp),
|
||||
)
|
||||
: Container(),
|
||||
// SizedBox(width: 15.w)
|
||||
],
|
||||
),
|
||||
@ -222,7 +245,9 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
||||
useDateStr,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 18.sp, color: AppColors.placeholderTextColor),
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.placeholderTextColor),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -288,5 +313,4 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
||||
state.ifCurrentScreen.value = false;
|
||||
state.sureBtnState.value = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
@ -27,7 +26,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
/// getKeyType 单次1 永久2 限期3 删除4 周未循环5 每日循环6 工作日循环7 周一循环8 周二循环9 周三循环10 周四循环11 周五循环12 周六循环13 周天循环14
|
||||
//获取密码请求
|
||||
Future<void> getKeyboardPwdRequest() async {
|
||||
final int startDate = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||
int startDate = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||
final int endDate = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||
final String lockId = state.keyInfo.value.lockId.toString();
|
||||
String getKeyType = '0';
|
||||
@ -40,20 +39,33 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
if (state.widgetType.value == 0) {
|
||||
//永久
|
||||
getKeyType = '2';
|
||||
//永久密码startTime传当前时间戳
|
||||
startDate = DateTime.now().millisecondsSinceEpoch;
|
||||
} else if (state.widgetType.value == 1) {
|
||||
//限时
|
||||
// 鑫鸿佳不需要生效时间
|
||||
if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XHJ && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_SYD || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_JL)){
|
||||
if (endDate <= DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||
if (CommonDataManage().currentKeyInfo.vendor ==
|
||||
IoModelVendor.vendor_XHJ &&
|
||||
(CommonDataManage().currentKeyInfo.model ==
|
||||
IoModelVendor.model_XHJ_SYD ||
|
||||
CommonDataManage().currentKeyInfo.model ==
|
||||
IoModelVendor.model_XHJ_JL)) {
|
||||
if (endDate <=
|
||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||
showToast('失效时间要大于当前时间'.tr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 芯连需要生效时间
|
||||
if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)){
|
||||
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
||||
(CommonDataManage().currentKeyInfo.model ==
|
||||
IoModelVendor.model_XL_BLE ||
|
||||
CommonDataManage().currentKeyInfo.model ==
|
||||
IoModelVendor.model_XL_WIFI)) {
|
||||
//限时
|
||||
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||
if (startDate <
|
||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||
showToast('生效时间不能小于当前时间'.tr);
|
||||
return;
|
||||
}
|
||||
@ -72,8 +84,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
} else if (state.widgetType.value == 4) {
|
||||
//循环
|
||||
// 芯连需要结束时间
|
||||
if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)){
|
||||
if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
||||
(CommonDataManage().currentKeyInfo.model ==
|
||||
IoModelVendor.model_XL_BLE ||
|
||||
CommonDataManage().currentKeyInfo.model ==
|
||||
IoModelVendor.model_XL_WIFI)) {
|
||||
if (endDate <
|
||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||
showToast('结束时间不能小于当前时间'.tr);
|
||||
return;
|
||||
}
|
||||
@ -116,7 +133,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
startDate: startDate.toString(),
|
||||
startHours: state.loopStartHours.value,
|
||||
endHours: state.loopEndHours.value,
|
||||
isCoerced: 1);
|
||||
isCoerced: 2);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isSendSuccess.value = true;
|
||||
state.sendSucceedType.value = state.widgetType.value;
|
||||
@ -142,19 +159,20 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
//是否为永久
|
||||
if (state.isPermanent.value == false) {
|
||||
getKeyType = '3';
|
||||
getEffectiveDateTime = DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
|
||||
getFailureDateTime = DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
|
||||
getEffectiveDateTime =
|
||||
DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
|
||||
getFailureDateTime =
|
||||
DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
|
||||
}
|
||||
final PasswordKeyEntity entity = await ApiRepository.to.addPasswordKey(
|
||||
lockId:lockId,
|
||||
keyboardPwdName:state.nameController.text,
|
||||
keyboardPwd:state.pwdController.text,
|
||||
keyboardPwdType:getKeyType,
|
||||
startDate:getEffectiveDateTime,
|
||||
endDate:getFailureDateTime,
|
||||
addType:'1',
|
||||
pwdRight:state.isAdministrator.value == true ? 1 : 0
|
||||
);
|
||||
lockId: lockId,
|
||||
keyboardPwdName: state.nameController.text,
|
||||
keyboardPwd: state.pwdController.text,
|
||||
keyboardPwdType: getKeyType,
|
||||
startDate: getEffectiveDateTime,
|
||||
endDate: getFailureDateTime,
|
||||
addType: '1',
|
||||
pwdRight: state.isAdministrator.value == true ? 1 : 0);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.isSendSuccess.value = true;
|
||||
state.sendSucceedType.value = state.widgetType.value;
|
||||
@ -189,10 +207,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
showToast('请输入密码'.tr);
|
||||
return;
|
||||
}
|
||||
final PasswordKeyEntity entity = await ApiRepository.to.checkKeyboardpwdName(
|
||||
lockId:state.keyInfo.value.lockId.toString(),
|
||||
keyboardPwdName:state.nameController.text,
|
||||
keyboardPwd:state.pwdController.text,);
|
||||
final PasswordKeyEntity entity =
|
||||
await ApiRepository.to.checkKeyboardpwdName(
|
||||
lockId: state.keyInfo.value.lockId.toString(),
|
||||
keyboardPwdName: state.nameController.text,
|
||||
keyboardPwd: state.pwdController.text,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
senderCustomPasswords();
|
||||
} else {
|
||||
@ -204,9 +224,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
// 监听设备返回的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||
_replySubscription =
|
||||
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||
// 设置自定义密码
|
||||
if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
||||
if ((reply is SenderCustomPasswordsReply) &&
|
||||
(state.ifCurrentScreen.value == true)) {
|
||||
final int status = reply.data[2];
|
||||
switch (status) {
|
||||
case 0x00:
|
||||
@ -218,33 +240,33 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
state.pwdNumber.value = listChangInt(reply.data.sublist(9, 11));
|
||||
// AppLog.log("密码编号:${state.pwdNumber.value}");
|
||||
|
||||
switch(reply.data[11]){
|
||||
switch (reply.data[11]) {
|
||||
case 0:
|
||||
// 成功
|
||||
addKeyboardPwdRequest();
|
||||
break;
|
||||
case 0xff:
|
||||
// 注册人脸失败
|
||||
// 注册人脸失败
|
||||
showToast('退出添加'.tr);
|
||||
break;
|
||||
case 0xFE:
|
||||
// 管理员已满
|
||||
// 管理员已满
|
||||
showToast('管理员已满'.tr);
|
||||
break;
|
||||
case 0xFD:
|
||||
// 用户已满
|
||||
// 用户已满
|
||||
showToast('用户已满'.tr);
|
||||
break;
|
||||
case 0xFC:
|
||||
// 指纹已满
|
||||
// 指纹已满
|
||||
showToast('锁上面添加密码已满'.tr);
|
||||
break;
|
||||
case 0xFB:
|
||||
// 指纹已存在
|
||||
// 指纹已存在
|
||||
showToast('密码已存在'.tr);
|
||||
break;
|
||||
default:
|
||||
// 添加密码
|
||||
// 添加密码
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -255,14 +277,20 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
final List<String> saveStrList = changeIntListToStringList(token);
|
||||
Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
final List<String>? signKey =
|
||||
await Storage.getStringList(saveBlueSignKey);
|
||||
final List<int> signKeyDataList =
|
||||
changeStringListToIntList(signKey!);
|
||||
|
||||
int startDate = DateTool().dateToTimestamp(state.customBeginTime.value, 1);
|
||||
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||
int startDate =
|
||||
DateTool().dateToTimestamp(state.customBeginTime.value, 1);
|
||||
int endDate =
|
||||
DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||
//非永久 须有时限
|
||||
if (state.isPermanent.value == true) {
|
||||
startDate = 0;
|
||||
@ -272,12 +300,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
keyID: '1',
|
||||
userID: await Storage.getUid(),
|
||||
pwdNo: 0,
|
||||
pwd:state.pwdController.text,
|
||||
pwd: state.pwdController.text,
|
||||
operate: 0,
|
||||
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||
useCountLimit: 0xffff,
|
||||
startTime: startDate ~/1000,
|
||||
endTime: endDate ~/1000,
|
||||
startTime: startDate ~/ 1000,
|
||||
endTime: endDate ~/ 1000,
|
||||
needAuthor: 1,
|
||||
isBeforeAddUser: false,
|
||||
signKey: signKeyDataList,
|
||||
@ -311,7 +339,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||
//非永久 须有时限
|
||||
if (state.isPermanent.value == false) {
|
||||
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) {
|
||||
if (startDate <
|
||||
DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) {
|
||||
showToast('生效时间要大于当前时间');
|
||||
return;
|
||||
}
|
||||
@ -320,33 +349,38 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
showToast('失效时间需大于生效时间');
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
startDate = 0;
|
||||
endDate = 0;
|
||||
}
|
||||
|
||||
if (state.pwdController.text.length < 6 || state.pwdController.text.length > 9) {
|
||||
if (state.pwdController.text.length < 6 ||
|
||||
state.pwdController.text.length > 9) {
|
||||
showToast('请输入6-9位数字密码');
|
||||
return;
|
||||
}
|
||||
|
||||
if(state.sureBtnState.value == 1){
|
||||
if (state.sureBtnState.value == 1) {
|
||||
return;
|
||||
}
|
||||
state.sureBtnState.value = 1;
|
||||
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
showBlueConnetctToastTimer(action: () {
|
||||
dismissEasyLoading();
|
||||
state.sureBtnState.value = 0;
|
||||
});
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
||||
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||
(BluetoothConnectionState deviceConnectionState) async {
|
||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
||||
final List<String>? signKey =
|
||||
await Storage.getStringList(saveBlueSignKey);
|
||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||
|
||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
final List<String>? privateKey =
|
||||
await Storage.getStringList(saveBluePrivateKey);
|
||||
final List<int> getPrivateKeyList =
|
||||
changeStringListToIntList(privateKey!);
|
||||
|
||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||
@ -355,22 +389,23 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
keyID: '1',
|
||||
userID: await Storage.getUid(),
|
||||
pwdNo: 0,
|
||||
pwd:state.pwdController.text,
|
||||
pwd: state.pwdController.text,
|
||||
operate: 0,
|
||||
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||
useCountLimit: 0xffff,
|
||||
startTime: startDate ~/1000,
|
||||
endTime: endDate ~/1000,
|
||||
startTime: startDate ~/ 1000,
|
||||
endTime: endDate ~/ 1000,
|
||||
needAuthor: 1,
|
||||
isBeforeAddUser: false,
|
||||
signKey: signKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
token: getTokenList);
|
||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
||||
} else if (deviceConnectionState ==
|
||||
BluetoothConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
cancelBlueConnetctToastTimer();
|
||||
state.sureBtnState.value = 0;
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
if (state.ifCurrentScreen.value == true) {
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
@ -393,24 +428,25 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
||||
case 1:
|
||||
//限时 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||
useDateStr =
|
||||
'类型:限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}';
|
||||
'类型:限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}';
|
||||
break;
|
||||
case 2:
|
||||
//单次 只能在开始时间后6小时内使用一次
|
||||
useDateStr =
|
||||
'类型:单次\n有效期:${state.beginTime.value} -- ${state.endTime.value}';
|
||||
'类型:单次\n有效期:${state.beginTime.value} -- ${state.endTime.value}';
|
||||
break;
|
||||
case 3:
|
||||
//自定义
|
||||
if (state.isPermanent.value == false) {
|
||||
'类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
||||
} else {
|
||||
useDateStr = '类型:自定义-永久';
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
//自定义
|
||||
if (state.isPermanent.value == false) {
|
||||
'类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
||||
} else {
|
||||
useDateStr = '类型:自定义-永久';
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
//周未循环 在周未开始和结束时间指定时间段内有效
|
||||
useDateStr = '类型:循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}';
|
||||
useDateStr =
|
||||
'类型:循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}';
|
||||
break;
|
||||
case 5:
|
||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||
|
||||
@ -70,7 +70,9 @@ class GroupList {
|
||||
List<LockListInfoItemEntity>? lockList;
|
||||
|
||||
bool _isChecked = false;
|
||||
|
||||
bool get isChecked => _isChecked ?? false;
|
||||
|
||||
set isChecked(bool value) => _isChecked = value;
|
||||
|
||||
GroupList({this.groupName, this.groupId, this.lockList});
|
||||
@ -131,41 +133,44 @@ class LockListInfoItemEntity {
|
||||
LockFeature? lockFeature;
|
||||
LockSetting? lockSetting;
|
||||
int? hasGateway;
|
||||
String? mac;
|
||||
|
||||
LockListInfoItemEntity(
|
||||
{this.keyId,
|
||||
this.lockId,
|
||||
this.lockName,
|
||||
this.lockAlias,
|
||||
this.electricQuantity,
|
||||
this.fwVersion,
|
||||
this.hwVersion,
|
||||
this.keyType,
|
||||
this.passageMode,
|
||||
this.userType,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.weekDays,
|
||||
this.remoteEnable,
|
||||
this.faceAuthentication,
|
||||
this.lastFaceValidateTime,
|
||||
this.nextFaceValidateTime,
|
||||
this.keyRight,
|
||||
this.keyStatus,
|
||||
this.isLockOwner,
|
||||
this.bluetooth,
|
||||
this.lockFeature,
|
||||
this.lockSetting,
|
||||
this.sendDate,
|
||||
this.lockUserNo,
|
||||
this.electricQuantityDate,
|
||||
this.electricQuantityStandby,
|
||||
this.senderUserId,
|
||||
this.isOnlyManageSelf,
|
||||
this.restoreCount,
|
||||
this.model,
|
||||
this.vendor,
|
||||
this.hasGateway});
|
||||
LockListInfoItemEntity({
|
||||
this.keyId,
|
||||
this.lockId,
|
||||
this.lockName,
|
||||
this.lockAlias,
|
||||
this.electricQuantity,
|
||||
this.fwVersion,
|
||||
this.hwVersion,
|
||||
this.keyType,
|
||||
this.passageMode,
|
||||
this.userType,
|
||||
this.startDate,
|
||||
this.endDate,
|
||||
this.weekDays,
|
||||
this.remoteEnable,
|
||||
this.faceAuthentication,
|
||||
this.lastFaceValidateTime,
|
||||
this.nextFaceValidateTime,
|
||||
this.keyRight,
|
||||
this.keyStatus,
|
||||
this.isLockOwner,
|
||||
this.bluetooth,
|
||||
this.lockFeature,
|
||||
this.lockSetting,
|
||||
this.sendDate,
|
||||
this.lockUserNo,
|
||||
this.electricQuantityDate,
|
||||
this.electricQuantityStandby,
|
||||
this.senderUserId,
|
||||
this.isOnlyManageSelf,
|
||||
this.restoreCount,
|
||||
this.model,
|
||||
this.vendor,
|
||||
this.hasGateway,
|
||||
this.mac,
|
||||
});
|
||||
|
||||
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
|
||||
keyId = json['keyId'];
|
||||
@ -207,6 +212,7 @@ class LockListInfoItemEntity {
|
||||
? LockSetting.fromJson(json['lockSetting'])
|
||||
: null;
|
||||
hasGateway = json['hasGateway'];
|
||||
mac = json['mac'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
@ -250,12 +256,13 @@ class LockListInfoItemEntity {
|
||||
data['lockSetting'] = lockSetting!.toJson();
|
||||
}
|
||||
data['hasGateway'] = hasGateway;
|
||||
data['mac'] = mac;
|
||||
return data;
|
||||
}
|
||||
|
||||
//是否是锁拥有者 也代表是超级管理员
|
||||
bool isLockOwnerBool(){
|
||||
return isLockOwner== 1;
|
||||
bool isLockOwnerBool() {
|
||||
return isLockOwner == 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -304,18 +311,20 @@ class LockFeature {
|
||||
int? videoIntercom;
|
||||
int? isSupportCatEye;
|
||||
int? isSupportBackupBattery;
|
||||
LockFeature(
|
||||
{this.password,
|
||||
this.icCard,
|
||||
this.fingerprint,
|
||||
this.fingerVein,
|
||||
this.palmVein,
|
||||
this.isSupportIris,
|
||||
this.d3Face,
|
||||
this.bluetoothRemoteControl,
|
||||
this.videoIntercom,
|
||||
this.isSupportCatEye,
|
||||
this.isSupportBackupBattery});
|
||||
|
||||
LockFeature({
|
||||
this.password,
|
||||
this.icCard,
|
||||
this.fingerprint,
|
||||
this.fingerVein,
|
||||
this.palmVein,
|
||||
this.isSupportIris,
|
||||
this.d3Face,
|
||||
this.bluetoothRemoteControl,
|
||||
this.videoIntercom,
|
||||
this.isSupportCatEye,
|
||||
this.isSupportBackupBattery,
|
||||
});
|
||||
|
||||
LockFeature.fromJson(Map<String, dynamic> json) {
|
||||
password = json['password'];
|
||||
@ -352,6 +361,7 @@ class LockSetting {
|
||||
int? attendance;
|
||||
int? appUnlockOnline;
|
||||
int? remoteUnlock;
|
||||
|
||||
LockSetting({
|
||||
this.attendance,
|
||||
this.appUnlockOnline,
|
||||
|
||||
@ -14,7 +14,6 @@ import 'lockListGroup_view.dart';
|
||||
import 'lockList_logic.dart';
|
||||
|
||||
class LockListXHJPage extends StatefulWidget {
|
||||
|
||||
const LockListXHJPage({required this.lockListInfoGroupEntity, Key? key})
|
||||
: super(key: key);
|
||||
final LockListInfoGroupEntity lockListInfoGroupEntity;
|
||||
@ -66,20 +65,15 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.separated(
|
||||
itemCount: logic.groupDataList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final GroupList itemData = logic.groupDataList[index];
|
||||
return _buildLockExpandedList(context, index, itemData);
|
||||
},
|
||||
shrinkWrap: true,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return const Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
);
|
||||
}),
|
||||
child: ListView.builder(
|
||||
itemCount: logic.groupDataList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final GroupList itemData = logic.groupDataList[index];
|
||||
return _buildLockExpandedList(context, index, itemData);
|
||||
},
|
||||
shrinkWrap: true,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -88,7 +82,8 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
}
|
||||
|
||||
//设备多层级列表
|
||||
Widget _buildLockExpandedList(context, index, GroupList itemData) {
|
||||
Widget _buildLockExpandedList(
|
||||
BuildContext context, int index, GroupList itemData) {
|
||||
final List<LockListInfoItemEntity> lockItemList =
|
||||
itemData.lockList ?? <LockListInfoItemEntity>[];
|
||||
return LockListGroupView(
|
||||
@ -111,7 +106,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
));
|
||||
}
|
||||
|
||||
List<Widget> forItems(List lockItemList) {
|
||||
List<Widget> forItems(List<LockListInfoItemEntity> lockItemList) {
|
||||
final List<Widget> list = <Widget>[];
|
||||
for (int i = 0, j = 0; i < lockItemList.length; i++, j++) {
|
||||
final LockListInfoItemEntity keyInfo = lockItemList[i];
|
||||
@ -120,9 +115,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
isLast = true;
|
||||
}
|
||||
list.add(Slidable(
|
||||
key: ValueKey(keyInfo.keyId),
|
||||
key: ValueKey<int?>(keyInfo.keyId),
|
||||
endActionPane: ActionPane(
|
||||
extentRatio: 0.2,
|
||||
extentRatio: 0.5,
|
||||
motion: const ScrollMotion(),
|
||||
children: <Widget>[
|
||||
SlidableAction(
|
||||
@ -133,6 +128,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
label: '删除'.tr,
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.w)),
|
||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||
),
|
||||
],
|
||||
@ -141,24 +137,24 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)) {
|
||||
logic.showToast("您的钥匙未生效".tr);
|
||||
logic.showToast('您的钥匙未生效'.tr);
|
||||
return;
|
||||
}
|
||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) {
|
||||
logic.showToast("您的钥匙已冻结".tr);
|
||||
logic.showToast('您的钥匙已冻结'.tr);
|
||||
return;
|
||||
}
|
||||
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) {
|
||||
logic.showToast("您的钥匙已过期".tr);
|
||||
logic.showToast('您的钥匙已过期'.tr);
|
||||
return;
|
||||
}
|
||||
Get.toNamed(Routers.lockDetailMainPage, arguments: <String, Object>{
|
||||
"keyInfo": keyInfo,
|
||||
"isOnlyOneData": false,
|
||||
'keyInfo': keyInfo,
|
||||
'isOnlyOneData': false,
|
||||
});
|
||||
}),
|
||||
));
|
||||
@ -188,7 +184,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
borderRadius: BorderRadius.circular(20.w),
|
||||
),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 10.h),
|
||||
padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 5.h),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -197,27 +193,30 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'images/icon_lock_circle.png',
|
||||
width: 32.r,
|
||||
height: 32.r,
|
||||
width: 48.r,
|
||||
height: 48.r,
|
||||
color: AppColors.mainColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 15.h,
|
||||
height: 10.h,
|
||||
),
|
||||
FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
child: Text(keyInfo.lockAlias!,
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: keyInfo.passageMode == 1
|
||||
? AppColors.openPassageModeColor
|
||||
: AppColors.darkGrayTextColor,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
maxLines: 1),
|
||||
),
|
||||
Text(keyInfo.lockAlias!,
|
||||
style: TextStyle(
|
||||
fontSize: 32.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: keyInfo.passageMode == 1
|
||||
? AppColors.openPassageModeColor
|
||||
: AppColors.darkGrayTextColor,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
maxLines: 1),
|
||||
Visibility(
|
||||
visible: keyInfo.passageMode == 1 ? true : false,
|
||||
visible: keyInfo.passageMode == 1,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 5.h),
|
||||
child: Row(
|
||||
@ -228,7 +227,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
borderRadius: BorderRadius.circular(5.w),
|
||||
color: AppColors.openPassageModeColor,
|
||||
),
|
||||
child: Text("常开模式开启".tr,
|
||||
child: Text('常开模式开启'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.appBarIconColor)),
|
||||
@ -237,14 +236,13 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
),
|
||||
)),
|
||||
Visibility(
|
||||
visible:
|
||||
keyInfo.lockSetting!.remoteUnlock == 1 ? true : false,
|
||||
visible: keyInfo.lockSetting!.remoteUnlock == 1,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 5.h),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"远程开锁".tr,
|
||||
'远程开锁'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: AppColors.darkGrayTextColor),
|
||||
@ -253,16 +251,14 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
),
|
||||
)),
|
||||
Visibility(
|
||||
visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusWaitIneffective ||
|
||||
keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusFrozen ||
|
||||
keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusExpired))
|
||||
? true
|
||||
: false,
|
||||
visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime ||
|
||||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
|
||||
(keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusWaitIneffective ||
|
||||
keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusFrozen ||
|
||||
keyInfo.keyStatus ==
|
||||
XSConstantMacro.keyStatusExpired),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 20.h),
|
||||
child: Row(
|
||||
@ -292,9 +288,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
child: Text(
|
||||
keyInfo.isLockOwner == 1
|
||||
? '超级管理员'.tr
|
||||
: (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr),
|
||||
: (keyInfo.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr),
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
fontSize: 16.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
),
|
||||
Image.asset(
|
||||
@ -304,9 +300,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
),
|
||||
SizedBox(width: 2.w),
|
||||
Text(
|
||||
"${keyInfo.electricQuantity!}%",
|
||||
'${keyInfo.electricQuantity!}%',
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
fontSize: 16.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -315,7 +311,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
keyInfo.startDate, keyInfo.endDate, keyInfo.keyType))
|
||||
.join('\u{200B}'),
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp, color: AppColors.darkGrayTextColor),
|
||||
fontSize: 16.sp, color: AppColors.darkGrayTextColor),
|
||||
)
|
||||
],
|
||||
),
|
||||
@ -326,7 +322,6 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
// TODO: implement didChangeDependencies
|
||||
super.didChangeDependencies();
|
||||
|
||||
/// 路由订阅
|
||||
@ -335,7 +330,6 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
/// 取消路由订阅
|
||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||
super.dispose();
|
||||
|
||||
@ -116,7 +116,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
);
|
||||
}
|
||||
child = F.sw(
|
||||
defaultCall: () => child,
|
||||
skyCall: () => child,
|
||||
xhjCall: () => Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
@ -133,7 +133,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
Widget returnWidget;
|
||||
|
||||
if (type == 1) {
|
||||
type = F.sw(defaultCall: () => 1, xhjCall: () => 2);
|
||||
type = F.sw(skyCall: () => 1, xhjCall: () => 2);
|
||||
}
|
||||
switch (type) {
|
||||
case 0:
|
||||
@ -152,7 +152,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
// 有多条数据
|
||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||
returnWidget = F.sw(
|
||||
defaultCall: () => LockListPage(
|
||||
skyCall: () => LockListPage(
|
||||
lockListInfoGroupEntity: state.lockListInfoGroupEntity.value),
|
||||
xhjCall: () => LockListXHJPage(
|
||||
lockListInfoGroupEntity: state.lockListInfoGroupEntity.value));
|
||||
|
||||
@ -12,6 +12,7 @@ import 'package:star_lock/mine/mall/lockMall_page.dart';
|
||||
import 'package:star_lock/mine/message/messageList/messageList_page.dart';
|
||||
import 'package:star_lock/mine/message/messageList/messageList_xhj_page.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart';
|
||||
import 'package:star_lock/tools/noData.dart';
|
||||
import 'package:star_lock/tools/submitBtn.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
@ -76,7 +77,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
|
||||
pageView(
|
||||
widget: SafeArea(
|
||||
bottom: false,
|
||||
child: MinePersonInfoPage(
|
||||
child: MineSetPage(
|
||||
showAppBar: false,
|
||||
showAbout: true,
|
||||
),
|
||||
|
||||
@ -50,7 +50,7 @@ class _AboutPageState extends State<AboutPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.about!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
@ -67,11 +67,11 @@ class _AboutPageState extends State<AboutPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
F.sw(
|
||||
defaultCall: () => logoView(),
|
||||
skyCall: () => logoView(),
|
||||
xhjCall: () => const SizedBox()),
|
||||
listView(),
|
||||
F.sw(
|
||||
defaultCall: () => const SizedBox(),
|
||||
skyCall: () => const SizedBox(),
|
||||
xhjCall: () => logoView()),
|
||||
],
|
||||
),
|
||||
@ -185,7 +185,7 @@ class _AboutPageState extends State<AboutPage> {
|
||||
],
|
||||
);
|
||||
view = F.sw(
|
||||
defaultCall: () => view,
|
||||
skyCall: () => view,
|
||||
xhjCall: () => Container(
|
||||
margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w),
|
||||
decoration: BoxDecoration(
|
||||
@ -221,7 +221,7 @@ class _AboutPageState extends State<AboutPage> {
|
||||
borderRadius: BorderRadius.circular(20.r),
|
||||
child: Image.asset(
|
||||
F.sw(
|
||||
defaultCall: () => "images/icon_main_1024.png",
|
||||
skyCall: () => "images/icon_main_1024.png",
|
||||
xhjCall: () => "images/icon_main_xhj_1024.png"),
|
||||
width: 160.w,
|
||||
height: 160.w),
|
||||
|
||||
@ -26,7 +26,7 @@ class _WebviewShowPageState extends State<WebviewShowPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
state.webViewController.loadRequest(Uri.parse(state.webURL));
|
||||
return F.sw(defaultCall: () => defaultView(), xhjCall: () => xhjView());
|
||||
return F.sw(skyCall: () => defaultView(), xhjCall: () => xhjView());
|
||||
}
|
||||
|
||||
Widget defaultView() {
|
||||
|
||||
@ -32,7 +32,7 @@ class _AddLockPageState extends State<AddLockPage> with BaseWidget {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.addLock!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
|
||||
@ -28,7 +28,7 @@ class _NearbyLockPageState extends State<NearbyLockPage> with RouteAware {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.nearbyLock!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
|
||||
@ -27,7 +27,7 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.selectLockType!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
@ -52,7 +52,7 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
|
||||
//锁列表控件
|
||||
Widget lockTypeList() {
|
||||
Widget view = F.sw(
|
||||
defaultCall: () => GridView.count(
|
||||
skyCall: () => GridView.count(
|
||||
crossAxisCount: 2,
|
||||
childAspectRatio: 2.83,
|
||||
crossAxisSpacing: 10,
|
||||
@ -162,7 +162,7 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
|
||||
|
||||
//风格区分
|
||||
view = F.sw(
|
||||
defaultCall: () => Container(
|
||||
skyCall: () => Container(
|
||||
height: 150.h,
|
||||
color: Colors.white,
|
||||
margin: const EdgeInsets.all(10),
|
||||
@ -195,7 +195,7 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
|
||||
child: Container(
|
||||
height: 120.h,
|
||||
decoration: F.sw(
|
||||
defaultCall: () => const BoxDecoration(
|
||||
skyCall: () => const BoxDecoration(
|
||||
color: Colors.white,
|
||||
),
|
||||
xhjCall: () => BoxDecoration(
|
||||
|
||||
@ -39,13 +39,13 @@ class _LockMallPageState extends State<LockMallPage> {
|
||||
barTitle: getWebTitle(logic),
|
||||
haveBack: logic.state.canGoBack || logic.state.allowReturn,
|
||||
backgroundColor: F.sw(
|
||||
defaultCall: () => AppColors.mainColor,
|
||||
skyCall: () => AppColors.mainColor,
|
||||
xhjCall: () => Colors.white),
|
||||
titleColor: F.sw(
|
||||
defaultCall: () => null,
|
||||
skyCall: () => null,
|
||||
xhjCall: () => AppColors.blackColor),
|
||||
iconColor: F.sw(
|
||||
defaultCall: () => null,
|
||||
skyCall: () => null,
|
||||
xhjCall: () => AppColors.blackColor),
|
||||
backAction: () => logic.canGoBack(false),
|
||||
)
|
||||
|
||||
@ -24,7 +24,7 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: "消息详情".tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
@ -60,7 +60,7 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
|
||||
style: TextStyle(fontSize: 22.sp, color: AppColors.placeholderTextColor),
|
||||
);
|
||||
return F.sw(
|
||||
defaultCall: () => view,
|
||||
skyCall: () => view,
|
||||
xhjCall: () => Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 20.h, bottom: 20.h, left: 20.w, right: 20.w),
|
||||
|
||||
@ -100,7 +100,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage>
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'智能分析',
|
||||
'智能分析'.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 28.sp,
|
||||
@ -108,7 +108,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage>
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'精准识别设备事件,过滤无效信息',
|
||||
'精准识别设备事件,过滤无效信息'.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor.withOpacity(0.6),
|
||||
fontSize: 20.sp,
|
||||
|
||||
@ -28,7 +28,7 @@ class _MineUnbindPhoneOrEmailState extends State<MineUnbindPhoneOrEmailPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.modifyAccount!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
|
||||
@ -27,7 +27,7 @@ class _MinePersonInfoEditAccountNextPageState
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.modifyAccount!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
|
||||
@ -28,7 +28,7 @@ class _MinePersonInfoEditNamePageState
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.greyBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.changeNickName!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
@ -97,7 +97,7 @@ class _MinePersonInfoEditNamePageState
|
||||
],
|
||||
);
|
||||
view = F.sw(
|
||||
defaultCall: () => view,
|
||||
skyCall: () => view,
|
||||
xhjCall: () => Container(
|
||||
margin: EdgeInsets.only(top: 20.h, left: 16.w, right: 16.w),
|
||||
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w),
|
||||
|
||||
@ -30,7 +30,7 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: state.channel.value == "1"
|
||||
? TranslationLoader.lanKeys!.mobileNumber!.tr
|
||||
: TranslationLoader.lanKeys!.email!.tr,
|
||||
|
||||
@ -4,7 +4,9 @@ import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
|
||||
import 'package:star_lock/tools/custom_bottom_sheet.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
@ -14,9 +16,8 @@ import '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
|
||||
class MinePersonInfoPage extends StatefulWidget {
|
||||
MinePersonInfoPage({Key? key, this.showAppBar = true, this.showAbout = false})
|
||||
MinePersonInfoPage({Key? key, this.showAbout = false})
|
||||
: super(key: key);
|
||||
bool showAppBar;
|
||||
bool showAbout;
|
||||
|
||||
@override
|
||||
@ -24,69 +25,21 @@ class MinePersonInfoPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
final logic = Get.put(MinePersonInfoLogic());
|
||||
final state = Get.find<MinePersonInfoLogic>().state;
|
||||
final MinePersonInfoLogic logic = Get.put(MinePersonInfoLogic());
|
||||
final MinePersonInfoState state = Get.find<MinePersonInfoLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: F.sw(
|
||||
defaultCall: () => AppColors.mainBackgroundColor,
|
||||
skyCall: () => AppColors.mainBackgroundColor,
|
||||
xhjCall: () => AppColors.mainBackgroundColor),
|
||||
appBar: widget.showAppBar
|
||||
? TitleAppBar(
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.personalInformation!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor)
|
||||
: null,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
F.sw(
|
||||
defaultCall: () => SizedBox(),
|
||||
xhjCall: () => Container(
|
||||
width: 1.sw,
|
||||
height: 0.2.sw,
|
||||
margin:
|
||||
EdgeInsets.only(top: 15.h, left: 20.w, right: 20.w),
|
||||
padding: EdgeInsets.symmetric(horizontal: 25.w),
|
||||
decoration: BoxDecoration(
|
||||
image: const DecorationImage(
|
||||
image: AssetImage('images/xhj_main_bg.jpg'),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20.r),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
offset: const Offset(0, 0),
|
||||
blurRadius: 10.r,
|
||||
spreadRadius: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'系统设置',
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 28.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'系统的全局配置在此项内进行设置',
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor.withOpacity(0.6),
|
||||
fontSize: 20.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
@ -95,10 +48,10 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20.r),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
allHeight: 100.h,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
@ -119,15 +72,15 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
|
||||
rightTitle: state.mineInfoData.value.nickname != null
|
||||
? state.mineInfoData.value.nickname!
|
||||
: "",
|
||||
: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.minePersonInfoEditNamePage,
|
||||
arguments: {
|
||||
arguments: <String, MinePersonInfoData>{
|
||||
'mineInfoData': state.mineInfoData.value
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
}).then((Object? value) => logic.getUserInfoRequest());
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
|
||||
@ -141,17 +94,17 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
if (state.mineInfoData.value.mobile!.isNotEmpty) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.mineUnbindPhoneOrEmailPage,
|
||||
arguments: {
|
||||
arguments: <String, String>{
|
||||
'mobile': state.mineInfoData.value.mobile!,
|
||||
'isFrom': '1'
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
}).then((Object? value) => logic.getUserInfoRequest());
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.mineBindPhoneOrEmailPage,
|
||||
arguments: {
|
||||
arguments: <String, String>{
|
||||
'mobile': state.mineInfoData.value.mobile!,
|
||||
'isFrom': '1'
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
}).then((Object? value) => logic.getUserInfoRequest());
|
||||
}
|
||||
})),
|
||||
Obx(() => CommonItem(
|
||||
@ -166,23 +119,23 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
if (state.mineInfoData.value.email!.isNotEmpty) {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.mineUnbindPhoneOrEmailPage,
|
||||
arguments: {
|
||||
arguments: <String, String>{
|
||||
'isFrom': '2',
|
||||
'email': state.mineInfoData.value.email!
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
}).then((Object? value) => logic.getUserInfoRequest());
|
||||
} else {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.mineBindPhoneOrEmailPage,
|
||||
arguments: {
|
||||
arguments: <String, String>{
|
||||
'isFrom': '2',
|
||||
'email': state.mineInfoData.value.email!
|
||||
}).then((value) => logic.getUserInfoRequest());
|
||||
}).then((Object? value) => logic.getUserInfoRequest());
|
||||
}
|
||||
})),
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.resetPasswords!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -192,15 +145,15 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
Obx(() => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
|
||||
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0
|
||||
? "去设置".tr
|
||||
: "",
|
||||
? '去设置'.tr
|
||||
: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
if (state.mineInfoData.value.haveSafeAnswer == 0) {
|
||||
Navigator.pushNamed(context,
|
||||
Routers.minePersonInfoSetSafetyProblemPage)
|
||||
.then((value) => logic.getUserInfoRequest());
|
||||
.then((Object? value) => logic.getUserInfoRequest());
|
||||
} else {
|
||||
Navigator.pushNamed(context,
|
||||
Routers.minePersonInfoViewSafetyProblemPage);
|
||||
@ -211,40 +164,11 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
rightTitle: state.mineInfoData.value.countryName != null
|
||||
? state.mineInfoData.value.countryName!
|
||||
: "",
|
||||
: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: false)),
|
||||
if (F.isLite == false && widget.showAbout)
|
||||
CommonItem(
|
||||
leftTitel:
|
||||
TranslationLoader.lanKeys!.valueAddedServices!.tr,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.back();
|
||||
Get.toNamed(Routers.valueAddedServicesPage);
|
||||
},
|
||||
),
|
||||
if (widget.showAbout)
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.set!.tr,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.back();
|
||||
Get.toNamed(Routers.mineSetPage);
|
||||
},
|
||||
),
|
||||
if (widget.showAbout)
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.about!.tr,
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.back();
|
||||
Get.toNamed(Routers.aboutPage);
|
||||
},
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -261,7 +185,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
|
||||
builder: (BuildContext context) {
|
||||
return AlertBottomWidget(
|
||||
topTitle: '',
|
||||
items: const ['拍照', '从相册选择'],
|
||||
items: const <String>['拍照', '从相册选择'],
|
||||
chooseCallback: logic.chooseCallback,
|
||||
);
|
||||
});
|
||||
|
||||
@ -30,7 +30,7 @@ class _MinePersonInfoResetPasswordPageState
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.resetPasswords!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
@ -140,7 +140,7 @@ class _MinePersonInfoResetPasswordPageState
|
||||
],
|
||||
);
|
||||
view = F.sw(
|
||||
defaultCall: () => view,
|
||||
skyCall: () => view,
|
||||
xhjCall: () => Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 20.h,
|
||||
|
||||
@ -37,7 +37,7 @@ class _MinePersonInfoSetSafetyProblemPageState
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.safetyProblem!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
@ -137,7 +137,7 @@ class _MinePersonInfoSetSafetyProblemPageState
|
||||
],
|
||||
);
|
||||
view = F.sw(
|
||||
defaultCall: () => view,
|
||||
skyCall: () => view,
|
||||
xhjCall: () => Container(
|
||||
margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w),
|
||||
decoration: BoxDecoration(
|
||||
|
||||
@ -102,7 +102,7 @@ class MineSetLogic extends BaseGetXController {
|
||||
UdpHelp().closeUDP();
|
||||
logOut();
|
||||
BlueManage().disconnect();
|
||||
XSJPushProvider().initLocalNotification(true);
|
||||
XSJPushProvider().initLocalNotification(isCancelLocalPush: true);
|
||||
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart';
|
||||
import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
|
||||
import 'package:star_lock/tools/appFirstEnterHandle.dart';
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
@ -18,15 +19,18 @@ import '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
|
||||
class MineSetPage extends StatefulWidget {
|
||||
const MineSetPage({Key? key}) : super(key: key);
|
||||
MineSetPage({Key? key, this.showAppBar = true, this.showAbout = false})
|
||||
: super(key: key);
|
||||
bool showAppBar;
|
||||
bool showAbout;
|
||||
|
||||
@override
|
||||
State<MineSetPage> createState() => _MineSetPageState();
|
||||
}
|
||||
|
||||
class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
final logic = Get.put(MineSetLogic());
|
||||
final state = Get.find<MineSetLogic>().state;
|
||||
final MineSetLogic logic = Get.put(MineSetLogic());
|
||||
final MineSetState state = Get.find<MineSetLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -53,19 +57,21 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: F.sw(
|
||||
defaultCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
xhjCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: Colors.white,
|
||||
iconColor: AppColors.blackColor,
|
||||
titleColor: AppColors.blackColor,
|
||||
)),
|
||||
appBar: widget.showAppBar
|
||||
? F.sw(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
xhjCall: () => TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: Colors.white,
|
||||
iconColor: AppColors.blackColor,
|
||||
titleColor: AppColors.blackColor,
|
||||
))
|
||||
: null,
|
||||
body: SingleChildScrollView(
|
||||
child: styleHierarchy(),
|
||||
),
|
||||
@ -76,24 +82,73 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
Widget styleHierarchy() {
|
||||
Widget view = getListDataView();
|
||||
view = F.sw(
|
||||
defaultCall: () => view,
|
||||
xhjCall: () => Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 20.h, left: 20.w, right: 20.w, bottom: 40.h),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.r))),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20.r),
|
||||
child: view,
|
||||
),
|
||||
skyCall: () => view,
|
||||
xhjCall: () => Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 1.sw,
|
||||
height: 0.2.sw,
|
||||
margin: EdgeInsets.only(
|
||||
top: 15.h, left: 20.w, right: 20.w, bottom: 20.h),
|
||||
padding: EdgeInsets.symmetric(horizontal: 25.w),
|
||||
decoration: BoxDecoration(
|
||||
image: const DecorationImage(
|
||||
image: AssetImage('images/xhj_main_bg.jpg'),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(20.r),
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.15),
|
||||
offset: const Offset(0, 0),
|
||||
blurRadius: 10.r,
|
||||
spreadRadius: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'系统设置'.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor,
|
||||
fontSize: 28.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'系统的全局配置在此项内进行设置'.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.blackColor.withOpacity(0.6),
|
||||
fontSize: 20.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 20.h, left: 20.w, right: 20.w, bottom: 40.h),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.r))),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(20.r),
|
||||
child: view,
|
||||
),
|
||||
),
|
||||
F.sw(skyCall: () => const SizedBox(), xhjCall: keyBottomWidget),
|
||||
],
|
||||
));
|
||||
return view;
|
||||
}
|
||||
|
||||
Widget getListDataView() {
|
||||
return Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
/* 2024-01-12 会议确定去掉“提示音、触摸开锁” by DaisyWu
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.prompTone!.tr,
|
||||
@ -114,29 +169,42 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
height: 50.h,
|
||||
child: Obx(() => _isTouchUnlockSwitch()))),
|
||||
*/
|
||||
F.sw(
|
||||
skyCall: () => const SizedBox(),
|
||||
xhjCall: () => CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.personalInformation!.tr,
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.minePersonInfoPage);
|
||||
})),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.pushNotification!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveRightWidget: true,
|
||||
isHaveLine: F.appFlavor == Flavor.sky ? true : false,
|
||||
isHaveLine: F.sw(
|
||||
skyCall: () => F.appFlavor == Flavor.sky, xhjCall: () => true),
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w,
|
||||
height: 50.h,
|
||||
child: Obx(() => _isPushNotificationSwitch()))),
|
||||
F.appFlavor == Flavor.sky
|
||||
? CommonItem(
|
||||
leftTitel: "微信公众号推送".tr,
|
||||
rightTitle: "",
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w,
|
||||
height: 50.h,
|
||||
child: Obx(() => _isWechatPublicAccountPushSwitch())))
|
||||
: Container(),
|
||||
child: Obx(_isPushNotificationSwitch))),
|
||||
if (F.appFlavor == Flavor.sky)
|
||||
CommonItem(
|
||||
leftTitel: '微信公众号推送'.tr,
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w,
|
||||
height: 50.h,
|
||||
child: Obx(_isWechatPublicAccountPushSwitch)))
|
||||
else
|
||||
Container(),
|
||||
SizedBox(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -144,7 +212,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -153,7 +221,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
//by DaisyWu 新增--批量授权
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.authorityManagement!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -162,7 +230,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -170,7 +238,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.transferSmartLock!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
@ -178,7 +246,8 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
}),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.selectGetewayListPage);
|
||||
@ -224,16 +293,17 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.hideInvalidUnlockPermissionsPage,
|
||||
arguments: {'isOn': state.hideExpiredAccessFlag.value})
|
||||
.then((value) {
|
||||
context, Routers.hideInvalidUnlockPermissionsPage,
|
||||
arguments: <String, int>{
|
||||
'isOn': state.hideExpiredAccessFlag.value
|
||||
}).then((Object? value) {
|
||||
logic.userSettingsInfoRequest();
|
||||
});
|
||||
})),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader
|
||||
.lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
|
||||
rightTitle: "",
|
||||
rightTitle: '',
|
||||
// allHeight: 100.h,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
@ -245,41 +315,58 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
height: 10.h,
|
||||
),
|
||||
//上架审核注释
|
||||
F.isLite
|
||||
? Container()
|
||||
: CommonItem(
|
||||
leftTitel: "Amazon Alexa",
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast("功能暂未开放".tr);
|
||||
}),
|
||||
F.isLite
|
||||
? Container()
|
||||
: CommonItem(
|
||||
leftTitel: "Google Home",
|
||||
rightTitle: "",
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast("功能暂未开放".tr);
|
||||
}),
|
||||
F.isLite
|
||||
? Container()
|
||||
: CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
|
||||
rightTitle: "",
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast("功能暂未开放".tr);
|
||||
}),
|
||||
if (!F.isLite)
|
||||
CommonItem(
|
||||
leftTitel: 'Amazon Alexa',
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast('功能暂未开放'.tr);
|
||||
}),
|
||||
if (!F.isLite)
|
||||
CommonItem(
|
||||
leftTitel: 'Google Home',
|
||||
rightTitle: '',
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast('功能暂未开放'.tr);
|
||||
}),
|
||||
if (!F.isLite)
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
|
||||
rightTitle: '',
|
||||
isHaveLine: widget.showAbout,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
logic.showToast('功能暂未开放'.tr);
|
||||
}),
|
||||
if (!F.isLite && widget.showAbout)
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.valueAddedServices!.tr,
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.back();
|
||||
Get.toNamed(Routers.valueAddedServicesPage);
|
||||
},
|
||||
),
|
||||
if (widget.showAbout)
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.about!.tr,
|
||||
isHaveLine: false,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.back();
|
||||
Get.toNamed(Routers.aboutPage);
|
||||
},
|
||||
),
|
||||
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
|
||||
//
|
||||
// }),
|
||||
SizedBox(
|
||||
height: 50.h,
|
||||
height: F.sw(skyCall: () => 50.h, xhjCall: () => 0.0),
|
||||
),
|
||||
// CommonItem(leftTitel:TranslationLoader.lanKeys!.about!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||
//
|
||||
@ -300,52 +387,56 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
// CommonItem(leftTitel:TranslationLoader.lanKeys!.thirdPartyInformationSharingList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
|
||||
//
|
||||
// }),
|
||||
keyBottomWidget()
|
||||
F.sw(skyCall: keyBottomWidget, xhjCall: () => const SizedBox())
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget keyBottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.logout!.tr,
|
||||
isDelete: true,
|
||||
padding: EdgeInsets.symmetric(horizontal: 15.w),
|
||||
onClick: () {
|
||||
//退出登录
|
||||
ShowTipView().showIosTipWithContentDialog("确定要退出吗?".tr, () {
|
||||
logic.userLogoutRequest();
|
||||
});
|
||||
// showLoginOutAlertTipDialog();
|
||||
}),
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 30.w, top: 30.h),
|
||||
// color: Colors.red,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.deleteAccount!.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 18.sp),
|
||||
return Padding(
|
||||
padding: F.sw(
|
||||
skyCall: () => EdgeInsets.zero,
|
||||
xhjCall: () => EdgeInsets.symmetric(horizontal: 15.w)),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.logout!.tr,
|
||||
isDelete: true,
|
||||
padding: EdgeInsets.symmetric(horizontal: 15.w),
|
||||
onClick: () {
|
||||
//退出登录
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
'确定要退出吗?'.tr, logic.userLogoutRequest);
|
||||
// showLoginOutAlertTipDialog();
|
||||
}),
|
||||
Container(
|
||||
padding: EdgeInsets.only(right: 30.w, top: 30.h),
|
||||
// color: Colors.red,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.deleteAccount!.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 18.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
TranslationLoader.lanKeys!.deleteAccountTips!.tr, () {
|
||||
//安全验证
|
||||
Get.toNamed(Routers.safeVerifyPage);
|
||||
});
|
||||
},
|
||||
),
|
||||
onPressed: () {
|
||||
ShowTipView().showIosTipWithContentDialog(
|
||||
TranslationLoader.lanKeys!.deleteAccountTips!.tr, () {
|
||||
//安全验证
|
||||
Get.toNamed(Routers.safeVerifyPage);
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
)
|
||||
],
|
||||
SizedBox(
|
||||
height: 30.h,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -411,7 +502,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isPrompTone.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
state.isPrompTone.value = !state.isPrompTone.value;
|
||||
logic.updatePrompToneRequest();
|
||||
},
|
||||
@ -424,7 +515,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isTouchUnlock.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
state.isTouchUnlock.value = !state.isTouchUnlock.value;
|
||||
logic.updateTouchUnlockRequest();
|
||||
},
|
||||
@ -438,7 +529,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isWechatPublicAccountPush.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
state.isWechatPublicAccountPush.value =
|
||||
!state.isWechatPublicAccountPush.value;
|
||||
logic.setMpWechatPushSwitchRequest(context);
|
||||
@ -452,7 +543,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isPushNotification.value,
|
||||
onChanged: (value) {
|
||||
onChanged: (bool value) {
|
||||
// state.isPushNotification.value = !state.isPushNotification.value;
|
||||
openAppSettings();
|
||||
},
|
||||
@ -474,7 +565,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
||||
IOSFlutterLocalNotificationsPlugin>()
|
||||
?.requestPermissions(
|
||||
alert: true,
|
||||
badge: true,
|
||||
badge: false,
|
||||
sound: true,
|
||||
) ??
|
||||
false;
|
||||
|
||||
@ -26,7 +26,7 @@ class BaseProvider extends GetConnect with Api {
|
||||
Future<Response<T>> post<T>(
|
||||
String? url,
|
||||
body, {
|
||||
String? contentType = "application/json",
|
||||
String? contentType = 'application/json',
|
||||
Map<String, String>? headers,
|
||||
Map<String, dynamic>? query,
|
||||
Decoder<T>? decoder,
|
||||
@ -35,7 +35,7 @@ class BaseProvider extends GetConnect with Api {
|
||||
bool? isUnShowLoading = false, // 是否显示loading
|
||||
bool? isUserBaseUrl = true, // 文件上传不使用baseUrl
|
||||
}) async {
|
||||
AppLog.log("post: url:$url body:$body");
|
||||
AppLog.log('post: url:$url body:$body');
|
||||
if (isUnShowLoading == false){
|
||||
EasyLoading.show();
|
||||
}
|
||||
@ -55,14 +55,14 @@ class BaseProvider extends GetConnect with Api {
|
||||
|
||||
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
||||
if (res.statusCode == null) {
|
||||
EasyLoading.showToast("网络访问失败,请检查网络是否正常".tr, duration: 2000.milliseconds);
|
||||
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds);
|
||||
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
|
||||
}
|
||||
var rs = {
|
||||
"errorMsg": "Network Error!",
|
||||
"errorCode": -1,
|
||||
"data": null,
|
||||
"description": "表示成功或是。"
|
||||
'errorMsg': 'Network Error!',
|
||||
'errorCode': -1,
|
||||
'data': null,
|
||||
'description': '表示成功或是。'
|
||||
};
|
||||
return Response(
|
||||
request: res.request,
|
||||
@ -78,24 +78,24 @@ class BaseProvider extends GetConnect with Api {
|
||||
}
|
||||
|
||||
getDataResult(T) {
|
||||
switch (T["errorCode"]) {
|
||||
switch (T['errorCode']) {
|
||||
case 403:
|
||||
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||
break;
|
||||
case 500:
|
||||
EasyLoading.showToast("服务器错误", duration: 2000.milliseconds);
|
||||
EasyLoading.showToast('服务器错误', duration: 2000.milliseconds);
|
||||
break;
|
||||
case 421:
|
||||
case 422:
|
||||
case 430: //与葛工约定弹出ErrorMsg
|
||||
EasyLoading.showToast(T["errorMsg"], duration: 2000.milliseconds);
|
||||
EasyLoading.showToast(T['errorMsg'], duration: 2000.milliseconds);
|
||||
break;
|
||||
//已单独处理,暂不做全局弹窗
|
||||
// case 425:
|
||||
// Toast.show(msg: "用户不存在");
|
||||
// break;
|
||||
case 10001:
|
||||
EasyLoading.showToast("数据不存在", duration: 2000.milliseconds);
|
||||
EasyLoading.showToast('数据不存在', duration: 2000.milliseconds);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,20 +42,20 @@ class _StarLockApplicationState extends State<StarLockApplication> {
|
||||
if (snapshot.data!) {
|
||||
// 如果用户已登录,返回主页面
|
||||
return F.sw(
|
||||
defaultCall: () => StarLockMainPage(),
|
||||
skyCall: () => StarLockMainPage(),
|
||||
xhjCall: () => const StarLockMainXHJPage());
|
||||
} else {
|
||||
// 如果用户未登录,返回登录页面
|
||||
AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy);
|
||||
|
||||
return F.sw(
|
||||
defaultCall: () => const StarLockLoginPage(),
|
||||
skyCall: () => const StarLockLoginPage(),
|
||||
xhjCall: () => const StarLockLoginXHJPage());
|
||||
}
|
||||
} else {
|
||||
// 如果没有数据,返回一个空白的小部件
|
||||
return F.sw(
|
||||
defaultCall: () => const StarLockLoginPage(),
|
||||
skyCall: () => const StarLockLoginPage(),
|
||||
xhjCall: () => const StarLockLoginXHJPage());
|
||||
}
|
||||
},
|
||||
|
||||
@ -51,7 +51,7 @@ class AppFirstEnterHandle {
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: F.sw(
|
||||
defaultCall: () => _defaultPrivacyAgreementAlert(context),
|
||||
skyCall: () => _defaultPrivacyAgreementAlert(context),
|
||||
xhjCall: () => _xhjPrivacyAgreementAlert(context)));
|
||||
},
|
||||
);
|
||||
|
||||
@ -123,7 +123,7 @@ class _LoginInputState extends State<LoginInput> {
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top:
|
||||
F.sw(defaultCall: () => 27.h, xhjCall: () => 39.h)),
|
||||
F.sw(skyCall: () => 27.h, xhjCall: () => 39.h)),
|
||||
child: Text(
|
||||
pwd,
|
||||
style: TextStyle(
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:jpush_flutter/jpush_flutter.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_entity.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
@ -12,63 +13,72 @@ import '../app_settings/app_settings.dart';
|
||||
class XSJPushProvider {
|
||||
final JPush jpush = JPush();
|
||||
|
||||
// appKey: 251fc8074820d122b6de58d2--鑫泓佳AppKey
|
||||
// appKey: 7ff37d174c1a568a89e98dad--sky
|
||||
Future<void> initJPushService() async {
|
||||
final data = await Storage.getString(saveUserLoginData);
|
||||
if (data != null && data.isNotEmpty) {
|
||||
jpush.setup(
|
||||
appKey: "7ff37d174c1a568a89e98dad",
|
||||
channel: "flutter_channel",
|
||||
production: false,
|
||||
debug: false,
|
||||
);
|
||||
final String? data = await Storage.getString(saveUserLoginData);
|
||||
if (data == null || data.isEmpty) {
|
||||
AppLog.log('No user data found.');
|
||||
return;
|
||||
}
|
||||
|
||||
jpush.addEventHandler(
|
||||
// 接收通知回调方法。
|
||||
onReceiveNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log("flutter onReceiveNotification: $message");
|
||||
},
|
||||
// 点击通知回调方法。
|
||||
onOpenNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log("flutter onOpenNotification: $message");
|
||||
},
|
||||
// 接收自定义消息回调方法。
|
||||
onReceiveMessage: (Map<String, dynamic> message) async {
|
||||
AppLog.log("flutter onReceiveMessage: $message");
|
||||
},
|
||||
);
|
||||
jpush.setup(
|
||||
appKey: '251fc8074820d122b6de58d2',
|
||||
channel: 'flutter_channel',
|
||||
production: false,
|
||||
debug: true,
|
||||
);
|
||||
|
||||
jpush.applyPushAuthority(
|
||||
const NotificationSettingsIOS(sound: true, alert: true, badge: true));
|
||||
// jpush.setChannelAndSound(
|
||||
// channel: "flutter_channel", channelID: "115700", sound: "default");
|
||||
jpush.addEventHandler(
|
||||
onReceiveNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log('flutter onReceiveNotification: $message');
|
||||
},
|
||||
onOpenNotification: (Map<String, dynamic> message) async {
|
||||
AppLog.log('flutter onOpenNotification: $message');
|
||||
},
|
||||
onReceiveMessage: (Map<String, dynamic> message) async {
|
||||
AppLog.log('flutter onReceiveMessage: $message');
|
||||
},
|
||||
);
|
||||
|
||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||
jpush.getRegistrationID().then((rid) {
|
||||
AppLog.log("flutter get registration id : $rid");
|
||||
Storage.setString(
|
||||
pushDeviceID,
|
||||
rid,
|
||||
);
|
||||
pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20);
|
||||
});
|
||||
jpush.applyPushAuthority(
|
||||
const NotificationSettingsIOS(sound: true, alert: true, badge: false),
|
||||
);
|
||||
|
||||
try {
|
||||
AppLog.log('Fetching registration ID...');
|
||||
final String rid = await jpush.getRegistrationID();
|
||||
AppLog.log('flutter get registration id : $rid');
|
||||
await Storage.setString(pushDeviceID, rid);
|
||||
await pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20);
|
||||
} catch (e) {
|
||||
AppLog.log('Error getting registration ID: $e');
|
||||
}
|
||||
}
|
||||
|
||||
void pushBindDeviceID(String deviceID, int deviceType) async {
|
||||
var entity = await ApiRepository.to.pushBindAppId(deviceID, deviceType);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
AppLog.log("绑定成功");
|
||||
Future<void> pushBindDeviceID(String deviceID, int deviceType) async {
|
||||
try {
|
||||
final MineUnbindPhoneOrEmailEntity entity =
|
||||
await ApiRepository.to.pushBindAppId(deviceID, deviceType);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
AppLog.log('绑定成功');
|
||||
} else {
|
||||
AppLog.log('绑定失败');
|
||||
}
|
||||
} catch (e) {
|
||||
AppLog.log('Error binding device ID: $e');
|
||||
}
|
||||
}
|
||||
|
||||
//本地通知初始化 isCancelLocalPush 是否取消所有本地通知
|
||||
initLocalNotification(bool isCancelLocalPush) async {
|
||||
Future<void> initLocalNotification({required bool isCancelLocalPush}) async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||
AndroidInitializationSettings('app_icon');
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||
AndroidInitializationSettings('app_icon');
|
||||
const InitializationSettings initializationSettings =
|
||||
InitializationSettings(android: initializationSettingsAndroid);
|
||||
await flutterLocalNotificationsPlugin.initialize(initializationSettings);
|
||||
|
||||
@ -56,8 +56,11 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# 1.0.46+2024052004:打包给公司测试
|
||||
# 1.0.47+2024052101:打包给欧阳回归测试
|
||||
# 1.0.48+2024052201:打包给欧阳回归测试
|
||||
# 1.0.49+2024052401:xhj UI ,预发布环境
|
||||
# 1.0.50+2024052701:xhj UI ,预发布环境
|
||||
# 1.0.51+2024052801:xhj 线上环境,提审
|
||||
|
||||
version: 1.0.48+2024052201
|
||||
version: 1.0.51+2024052801
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
@ -67,7 +70,7 @@ fluwx:
|
||||
debug_logging: true
|
||||
android:
|
||||
ios:
|
||||
universal_link: https://lock.skychip.top/apple-app-site-association.json
|
||||
universal_link: https://lock.skychip.top/apple-app-site-association.json
|
||||
|
||||
# Dependencies specify other packages that your package needs in order to work.
|
||||
# To automatically upgrade your package dependencies to the latest versions
|
||||
@ -126,7 +129,7 @@ dependencies:
|
||||
url_launcher: ^6.1.10
|
||||
#蓝牙
|
||||
# flutter_reactive_ble: ^5.1.1
|
||||
flutter_blue_plus: 1.31.16
|
||||
flutter_blue_plus: 1.32.7
|
||||
#
|
||||
event_bus: ^2.0.0
|
||||
#菊花
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user