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:
魏少阳 2024-05-29 09:14:15 +08:00
commit ad29462882
48 changed files with 1807 additions and 1460 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -27,6 +27,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply plugin: 'android-junk-code' apply plugin: 'android-junk-code'
apply plugin: 'com.huawei.agconnect'
androidJunkCode { androidJunkCode {
variantConfig { variantConfig {
@ -51,10 +52,14 @@ android {
// debug使--debug模式 // debug使--debug模式
// debug模式没办法在buildTypes里面按flavors指定编译签名debug模式只能用同一个签名 // debug模式没办法在buildTypes里面按flavors指定编译签名debug模式只能用同一个签名
debug { debug {
storeFile file("starlock.keystore") // storeFile file("starlock.keystore")
storePassword '123456' // storePassword '123456'
keyAlias = 'starlock' // keyAlias = 'starlock'
keyPassword '123456' // keyPassword '123456'
storeFile file("xhj.jks")
storePassword 'xhj8872'
keyAlias = 'upload'
keyPassword 'xhj8872'
} }
sky { sky {
// CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown // CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown
@ -161,13 +166,23 @@ android {
manifestPlaceholders = [ manifestPlaceholders = [
JPUSH_PKGNAME : "这里不重要,在口味配置", JPUSH_PKGNAME : "这里不重要,在口味配置",
//JPush Appkey. //JPush Appkey.
JPUSH_APPKEY : "7ff37d174c1a568a89e98dad", // JPUSH_APPKEY : "7ff37d174c1a568a89e98dad",//--skyAppKey
//. JPUSH_APPKEY : "251fc8074820d122b6de58d2",//--AppKey
JPUSH_CHANNEL : "flutter_channel", JPUSH_CHANNEL : "flutter_channel",
// //
XIAOMI_APPID : "MI-2882303761520287291", //sky的配置
XIAOMI_APPKEY : "MI-5352028744291", // 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 { splits {
abi { abi {
@ -208,7 +223,10 @@ dependencies {
implementation('com.amap.api:3dmap:8.1.0') implementation('com.amap.api:3dmap:8.1.0')
implementation 'cn.jiguang.sdk:jpush:5.2.3' 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 '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' implementation 'cn.jiguang.sdk.plugin:xiaomi:5.2.3'
} }

View File

@ -54,6 +54,12 @@
<meta-data <meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id" android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="1"/> <!-- 将您的通知渠道ID替换为您的实际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 -->
<service android:name="com.amap.api.location.APSService"/> <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"> <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">

View 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"
}
}
]
}

View File

@ -1,10 +1,13 @@
buildscript { buildscript {
ext.kotlin_version = '1.8.20' ext.kotlin_version = '1.8.20'
repositories { repositories {
maven { url 'https://maven.aliyun.com/repository/public'}
maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}
google() google()
mavenCentral() mavenCentral()
mavenLocal() mavenLocal()
// hms // hms
// maven { url 'https://maven.aliyun.com/repository/central'}
maven { url 'https://developer.huawei.com/repo/'} maven { url 'https://developer.huawei.com/repo/'}
// fcm FCM // fcm FCM
maven { url "https://maven.google.com" } maven { url "https://maven.google.com" }
@ -25,6 +28,8 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
maven { url 'https://maven.aliyun.com/repository/public'}
maven { url 'https://maven.aliyun.com/repository/gradle-plugin'}
google() google()
mavenCentral() mavenCentral()
jcenter() jcenter()

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ import 'package:star_lock/flavors.dart';
class AppColors { class AppColors {
// static Color mainColor = const Color(0xFF385DEA); // static Color mainColor = const Color(0xFF385DEA);
static Color get mainColor => F.sw( static Color get mainColor => F.sw(
defaultCall: () => const Color(0xFF4777EE), skyCall: () => const Color(0xFF4777EE),
xhjCall: () => const Color(0xFF68c1b9)); xhjCall: () => const Color(0xFF68c1b9));
static Color mainBackgroundColor = const Color(0xFFF5F5F5); static Color mainBackgroundColor = const Color(0xFFF5F5F5);

View File

@ -4,6 +4,7 @@ import 'dart:io';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import 'io_tool/io_model.dart'; import 'io_tool/io_model.dart';
import 'io_tool/io_tool.dart'; import 'io_tool/io_tool.dart';
@ -17,12 +18,12 @@ typedef ConnectStateCallBack = Function(
typedef ScanDevicesCallBack = Function(List<ScanResult>); typedef ScanDevicesCallBack = Function(List<ScanResult>);
class BlueManage { class BlueManage {
factory BlueManage() => shareManager()!; factory BlueManage() => shareManager()!;
BlueManage._init() { BlueManage._init() {
_initBlue(); _initBlue();
} }
final List<ScanResult> scanDevices = <ScanResult>[]; final List<ScanResult> scanDevices = <ScanResult>[];
// id // id
@ -70,6 +71,7 @@ class BlueManage {
// //
List<int> lastTimeData = <int>[]; List<int> lastTimeData = <int>[];
int? dataLen; int? dataLen;
Timer? scanSingleTimer;
static BlueManage? _manager; static BlueManage? _manager;
@ -311,10 +313,24 @@ class BlueManage {
{bool isAddEquipment = false}) async { {bool isAddEquipment = false}) async {
connectDeviceName = deviceName; connectDeviceName = deviceName;
final List<ScanResult> devicesList = scanDevices; final List<ScanResult> devicesList = scanDevices;
final bool isExistDevice = isExistScanDevices(connectDeviceName); 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) { startScanSingle(deviceName, 15, (List<ScanResult> scanDevices) {
_connectDevice(scanDevices, deviceName, connectStateCallBack, _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( Future<void> _subScribeToCharacteristic(
BluetoothCharacteristic characteristic) async { BluetoothCharacteristic characteristic) async {

View File

@ -32,19 +32,19 @@ class F {
//便 //便
static dynamic sw( static dynamic sw(
{required fCallFunction defaultCall, fCallFunction? xhjCall}) { {required fCallFunction skyCall, required fCallFunction? xhjCall}) {
if (xhjCall == null) { if (xhjCall == null) {
return defaultCall(); return skyCall();
} }
switch (appFlavor) { switch (appFlavor) {
case Flavor.xhj: case Flavor.sky:
return xhjCall(); return skyCall();
case Flavor.local: case Flavor.local:
case Flavor.dev: case Flavor.dev:
case Flavor.pre: case Flavor.pre:
case Flavor.sky: case Flavor.xhj:
default: default:
return defaultCall(); return xhjCall();
} }
} }
@ -72,7 +72,7 @@ class F {
case Flavor.dev: case Flavor.dev:
return '${"starLock".tr}-dev'; return '${"starLock".tr}-dev';
case Flavor.pre: case Flavor.pre:
return "starLock".tr; return 'starLock'.tr;
case Flavor.sky: case Flavor.sky:
return '锁通通'; return '锁通通';
case Flavor.xhj: case Flavor.xhj:

View File

@ -39,6 +39,7 @@ class StarLockLoginLogic extends BaseGetXController {
} }
Future<void> login() async { Future<void> login() async {
FocusScope.of(Get.context!).requestFocus(FocusNode()); //
final LoginEntity entity = await ApiRepository.to.login( final LoginEntity entity = await ApiRepository.to.login(
loginType: '1', loginType: '1',
password: state.pwd.value, password: state.pwd.value,
@ -49,7 +50,7 @@ class StarLockLoginLogic extends BaseGetXController {
Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true); Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true);
eventBus.fire(MineInfoChangeRefreshUI()); eventBus.fire(MineInfoChangeRefreshUI());
XSJPushProvider().initJPushService(); XSJPushProvider().initJPushService();
XSJPushProvider().initLocalNotification(false); XSJPushProvider().initLocalNotification(isCancelLocalPush: false);
Get.offNamedUntil(Routers.starLockMain, (Route route) => false); Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
BlueManage().scanDevices.clear(); // BlueManage().scanDevices.clear(); //
} }

View File

@ -239,9 +239,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
child: SizedBox( child: SizedBox(
width: 10.sp, width: 10.sp,
)), )),
F.isLite if (F.isLite) Container() else GestureDetector(
? Container()
: GestureDetector(
child: SizedBox( child: SizedBox(
// width: 150.w, // width: 150.w,
height: 50.h, height: 50.h,

View File

@ -3,6 +3,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/login/login/starLock_login_state.dart';
import '../../appRouters.dart'; import '../../appRouters.dart';
import '../../app_settings/app_colors.dart'; import '../../app_settings/app_colors.dart';
@ -22,10 +23,8 @@ class StarLockLoginXHJPage extends StatefulWidget {
} }
class _StarLockLoginPageState extends State<StarLockLoginXHJPage> { class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
final logic = Get.put(StarLockLoginLogic()); final StarLockLoginLogic logic = Get.put(StarLockLoginLogic());
final state = Get final StarLockLoginState state = Get.find<StarLockLoginLogic>().state;
.find<StarLockLoginLogic>()
.state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -33,8 +32,15 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF), backgroundColor: const Color(0xFFFFFFFF),
body: ListView( body: ListView(
padding: EdgeInsets.only(top: 120.h, left: 40.w, right: 40.w), padding: EdgeInsets.only(
children: [ top: 120.h,
),
children: <Widget>[
Padding(
padding: EdgeInsets.symmetric(horizontal: 40.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text( Text(
'${"欢迎使用".tr}${F.title}', '${"欢迎使用".tr}${F.title}',
style: TextStyle( style: TextStyle(
@ -45,7 +51,8 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
SizedBox(height: 30.h), SizedBox(height: 30.h),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
var result = await Get.toNamed(Routers.selectCountryRegionPage); final result =
await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) { if (result != null) {
result as Map<String, dynamic>; result as Map<String, dynamic>;
state.countryCode.value = result['code']; state.countryCode.value = result['code'];
@ -55,22 +62,22 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
child: Container( child: Container(
color: Colors.transparent, color: Colors.transparent,
child: Row( child: Row(
children: [ children: <Widget>[
SizedBox( SizedBox(
width: 5.w, width: 5.w,
), ),
Text( Text(
TranslationLoader.lanKeys!.countryAndRegion!.tr, TranslationLoader.lanKeys!.countryAndRegion!.tr,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor), fontSize: 22.sp,
color: AppColors.darkGrayTextColor),
), ),
SizedBox( SizedBox(
width: 40.w, width: 40.w,
), ),
Obx(() { Obx(() {
return Text( return Text(
'${state.countryName.value} +${state.countryCode '${state.countryName.value} +${state.countryCode.value}',
.value}',
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.mainColor), fontSize: 22.sp, color: AppColors.mainColor),
); );
@ -91,12 +98,13 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
), ),
), ),
rightSlot: IconButton( rightSlot: IconButton(
icon: Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: () {}, onPressed: () {},
), ),
label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, label: TranslationLoader
.lanKeys!.pleaseEnterNumberOrEmail!.tr,
// keyboardType: TextInputType.number, // keyboardType: TextInputType.number,
inputFormatters: [ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(30), LengthLimitingTextInputFormatter(30),
]), ]),
LoginInput( LoginInput(
@ -113,25 +121,27 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
), ),
), ),
label: label:
"${TranslationLoader.lanKeys!.pleaseEnter! '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
.tr}${TranslationLoader.lanKeys!.password!.tr}", inputFormatters: <TextInputFormatter>[
inputFormatters: [
LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
SizedBox(height: 30.h), SizedBox(height: 10.h),
],
),
),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
state.agree.value = !state.agree.value; state.agree.value = !state.agree.value;
logic.changeAgreeState(); logic.changeAgreeState();
}, },
child: Padding( child: Container(
padding: EdgeInsets.symmetric(vertical: 10.h), color: Colors.transparent,
padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 40.w),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Obx( Obx(
() => () => Container(
Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 5.w, left: 5.w,
right: 10.w, right: 10.w,
@ -150,24 +160,21 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
text: TextSpan( text: TextSpan(
text: TranslationLoader.lanKeys!.readAndAgree!.tr, text: TranslationLoader.lanKeys!.readAndAgree!.tr,
style: TextStyle( style: TextStyle(
color: const Color(0xff333333), color: const Color(0xff333333), fontSize: 20.sp),
fontSize: 20.sp), children: <InlineSpan>[
children: [
WidgetSpan( WidgetSpan(
alignment: PlaceholderAlignment.middle, alignment: PlaceholderAlignment.middle,
child: GestureDetector( child: GestureDetector(
child: Text( child: Text(
'${TranslationLoader.lanKeys! '${TranslationLoader.lanKeys!.userAgreement!.tr}',
.userAgreement!.tr}',
style: TextStyle( style: TextStyle(
color: AppColors.mainColor, color: AppColors.mainColor,
fontSize: 20.sp)), fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, Get.toNamed(Routers.webviewShowPage,
arguments: { arguments: <String, String>{
"url": XSConstantMacro 'url': XSConstantMacro.userAgreementURL,
.userAgreementURL, 'title': '用户协议'.tr
"title": '用户协议'.tr
}); });
}, },
)), )),
@ -175,17 +182,15 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
alignment: PlaceholderAlignment.middle, alignment: PlaceholderAlignment.middle,
child: GestureDetector( child: GestureDetector(
child: Text( child: Text(
'${TranslationLoader.lanKeys! '${TranslationLoader.lanKeys!.privacyPolicy!.tr}',
.privacyPolicy!.tr}',
style: TextStyle( style: TextStyle(
color: AppColors.mainColor, color: AppColors.mainColor,
fontSize: 20.sp)), fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, Get.toNamed(Routers.webviewShowPage,
arguments: { arguments: <String, String>{
"url": XSConstantMacro 'url': XSConstantMacro.privacyPolicyURL,
.privacyPolicyURL, 'title': '隐私政策'.tr
"title": '隐私政策'.tr
}); });
}, },
)), )),
@ -196,9 +201,13 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
), ),
), ),
), ),
SizedBox(height: 15.w), Padding(
Obx(() => padding: EdgeInsets.symmetric(horizontal: 40.w),
SubmitBtn( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 5.w),
Obx(() => SubmitBtn(
btnName: TranslationLoader.lanKeys!.login!.tr, btnName: TranslationLoader.lanKeys!.login!.tr,
fontSize: 28.sp, fontSize: 28.sp,
borderRadius: 20.w, borderRadius: 20.w,
@ -215,11 +224,15 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
} }
: null)), : null)),
SizedBox(height: 10.h), SizedBox(height: 10.h),
ElevatedButton( SizedBox(
width: Get.width,
child: ElevatedButton(
onPressed: () async { onPressed: () async {
var data = await Get.toNamed(Routers.starLockRegisterPage); final dynamic data =
await Get.toNamed(Routers.starLockRegisterPage);
if (data != null) { if (data != null) {
state.emailOrPhoneController.text = data['phoneOrEmailStr']; state.emailOrPhoneController.text =
data['phoneOrEmailStr'];
logic.checkNext(state.emailOrPhoneController); logic.checkNext(state.emailOrPhoneController);
state.pwdController.text = data['pwd']; state.pwdController.text = data['pwd'];
logic.checkNext(state.pwdController); logic.checkNext(state.pwdController);
@ -233,10 +246,11 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
style: TextStyle(fontSize: 22.sp, color: Colors.white), style: TextStyle(fontSize: 22.sp, color: Colors.white),
), ),
), ),
),
SizedBox(height: 5.w), SizedBox(height: 5.w),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
GestureDetector( GestureDetector(
child: SizedBox( child: SizedBox(
// width: 150.w, // width: 150.w,
@ -246,7 +260,8 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
child: Text( child: Text(
'${TranslationLoader.lanKeys!.forgetPassword!.tr}', '${TranslationLoader.lanKeys!.forgetPassword!.tr}',
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.mainColor)), fontSize: 22.sp,
color: AppColors.mainColor)),
), ),
), ),
onTap: () { onTap: () {
@ -258,9 +273,10 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
child: SizedBox( child: SizedBox(
width: 10.sp, width: 10.sp,
)), )),
F.isLite if (F.isLite)
? Container() Container()
: GestureDetector( else
GestureDetector(
child: SizedBox( child: SizedBox(
// width: 150.w, // width: 150.w,
height: 50.h, height: 50.h,
@ -279,10 +295,14 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
], ],
), ),
], ],
),
)
],
)); ));
} }
Widget loginInput({TextEditingController? controller, Widget loginInput(
{TextEditingController? controller,
List<TextInputFormatter>? inputFormatters, List<TextInputFormatter>? inputFormatters,
String? hintText, String? hintText,
bool? isHaveLeftWidget, bool? isHaveLeftWidget,
@ -292,10 +312,11 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
BlockStrCallback? onchangeAction}) { BlockStrCallback? onchangeAction}) {
return Container( return Container(
width: 1.sp, width: 1.sp,
color: Colors.transparent,
child: Column( child: Column(
children: [ children: <Widget>[
Row( Row(
children: [ children: <Widget>[
Container( Container(
color: Colors.red, color: Colors.red,
child: Image.asset( child: Image.asset(

View File

@ -1,36 +1,20 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.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/main/lockDetail/lockDetail/lockDetail_state.dart';
import 'package:star_lock/tools/showTipView.dart';
import 'package:star_lock/tools/titleAppBar.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 '../../../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'; import 'lockDetail_logic.dart';
class LockDetailListPage extends StatefulWidget { class LockDetailListPage extends StatefulWidget {
const LockDetailListPage({required this.title, required this.items, Key? key})
: super(key: key);
final String title; final String title;
final List<Widget> items; final List<Widget> items;
const LockDetailListPage({Key? key, required this.title, required this.items})
: super(key: key);
@override @override
State<LockDetailListPage> createState() => _LockDetailListPageState(); State<LockDetailListPage> createState() => _LockDetailListPageState();
} }
@ -59,7 +43,7 @@ class _LockDetailListPageState extends State<LockDetailListPage>
body: ListView.builder( body: ListView.builder(
padding: EdgeInsets.only(top: 15.h), padding: EdgeInsets.only(top: 15.h),
itemCount: widget.items.length, itemCount: widget.items.length,
itemBuilder: (context, index) => widget.items[index]), itemBuilder: (BuildContext context, int index) => widget.items[index]),
); );
} }
} }

View File

@ -504,8 +504,8 @@ class LockDetailLogic extends BaseGetXController {
void resetOpenDoorState() { void resetOpenDoorState() {
state.openLockBtnState.value = 0; state.openLockBtnState.value = 0;
state.openDoorBtnisUneable.value = false; state.openDoorBtnisUneable.value = false;
state.animationController!.reset(); state.animationController?.reset();
state.animationController!.forward(); state.animationController?.forward();
eventBus.fire(RefreshLockDetailInfoDataEvent()); eventBus.fire(RefreshLockDetailInfoDataEvent());
} }
@ -513,7 +513,6 @@ class LockDetailLogic extends BaseGetXController {
Future<void> onReady() async { Future<void> onReady() async {
super.onReady(); super.onReady();
getServerDatetime(); getServerDatetime();
await PermissionDialog.request(Permission.location); await PermissionDialog.request(Permission.location);
await PermissionDialog.requestBluetooth(); await PermissionDialog.requestBluetooth();
} }

View File

@ -32,7 +32,7 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
isOnlyOneData = obj["isOnlyOneData"]; isOnlyOneData = obj["isOnlyOneData"];
return F.sw( return F.sw(
defaultCall: () => Scaffold( skyCall: () => Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: F.navTitle, barTitle: F.navTitle,

View File

@ -145,7 +145,7 @@ class _LockDetailPageState extends State<LockDetailPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
loadData(); loadData();
return F.sw(defaultCall: skWidget, xhjCall: xhjWidget); return F.sw(skyCall: skWidget, xhjCall: xhjWidget);
} }
// //
@ -342,7 +342,12 @@ class _LockDetailPageState extends State<LockDetailPage>
adminInfoView(center: false, max: false), adminInfoView(center: false, max: false),
], ],
), ),
Column( GestureDetector(
onTap: () {
ShowTipView().showSureAlertDialog(
"${"锁电量更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}");
},
child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
@ -370,28 +375,39 @@ class _LockDetailPageState extends State<LockDetailPage>
SizedBox( SizedBox(
height: 15.h, height: 15.h,
), ),
Row( Visibility(
visible: state.keyInfos.value.lockFeature!
.isSupportBackupBattery ==
1,
child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Image.asset( FlavorsImg(
showElectricIcon(state.electricQuantity.value), child: Image.asset(
showElectricIcon(
state.electricQuantityStandby.value),
width: 30.w, width: 30.w,
height: 24.w), height: 24.w),
),
SizedBox(width: 2.w), SizedBox(width: 2.w),
Text('--%', Text('${state.electricQuantityStandby.value}%',
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
color: AppColors.darkGrayTextColor)), color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w), SizedBox(width: 2.w),
Icon( FlavorsImg(
child: Icon(
Icons.info, // 使 warning Icons.info, // 使 warning
color: AppColors.mainColor, // color: AppColors.mainColor, //
size: 25.w, // 30 size: 25.w, // 30
), ),
),
SizedBox(width: 20.w), SizedBox(width: 20.w),
], ],
),
) )
], ],
),
) )
], ],
), ),
@ -480,7 +496,7 @@ class _LockDetailPageState extends State<LockDetailPage>
return Column( return Column(
children: <Widget>[ children: <Widget>[
F.sw( F.sw(
defaultCall: () => SizedBox(height: 50.h), skyCall: () => SizedBox(height: 50.h),
xhjCall: () => Padding( xhjCall: () => Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 12.h, top: 12.h,
@ -574,7 +590,7 @@ class _LockDetailPageState extends State<LockDetailPage>
], ],
), ),
F.sw( F.sw(
defaultCall: () => SizedBox(height: 30.h), skyCall: () => SizedBox(height: 30.h),
xhjCall: () => SizedBox(height: 15.h), xhjCall: () => SizedBox(height: 15.h),
), ),
Container( Container(
@ -689,7 +705,7 @@ class _LockDetailPageState extends State<LockDetailPage>
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
F.sw(defaultCall: adminInfoView, xhjCall: () => const SizedBox()), F.sw(skyCall: adminInfoView, xhjCall: () => const SizedBox()),
SizedBox( SizedBox(
height: 20.h, height: 20.h,
), ),
@ -1137,7 +1153,7 @@ class _LockDetailPageState extends State<LockDetailPage>
Widget bottomItem( Widget bottomItem(
String iconUrl, String name, bool bottomBtnisEable, Function() onClick) { String iconUrl, String name, bool bottomBtnisEable, Function() onClick) {
final Widget child = F.sw( final Widget child = F.sw(
defaultCall: () => Container( skyCall: () => Container(
color: Colors.white, color: Colors.white,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,

View File

@ -4,6 +4,8 @@ import 'package:flutter/scheduler.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/blue/io_type.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 'package:star_lock/tools/showTipView.dart';
import '../../../../blue/blue_manage.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/io_tool.dart';
import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/io_tool/manager_event_bus.dart';
import '../../../../blue/sender_manage.dart'; import '../../../../blue/sender_manage.dart';
import '../../../../login/login/entity/LoginEntity.dart';
import '../../../../flavors.dart';
import '../../../../network/api_repository.dart'; import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart'; import '../../../../tools/baseGetXController.dart';
import '../../../../tools/commonDataManage.dart'; import '../../../../tools/commonDataManage.dart';
@ -33,9 +37,10 @@ class LockSetLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) async { EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
// //
// if (reply is DeletUserReply) { // if (reply is DeletUserReply) {
// _replyDeletUserKey(reply); // _replyDeletUserKey(reply);
@ -107,8 +112,8 @@ class LockSetLogic extends BaseGetXController {
// //
Future<void> _replyFactoryDataResetKey(Reply reply) async { Future<void> _replyFactoryDataResetKey(Reply reply) async {
var token = reply.data.sublist(2, 6); List<int> token = reply.data.sublist(2, 6);
var saveStrList = changeIntListToStringList(token); List<String> saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
int status = reply.data[6]; int status = reply.data[6];
@ -121,13 +126,15 @@ class LockSetLogic extends BaseGetXController {
break; break;
case 0x06: case 0x06:
// //
var privateKey = await Storage.getStringList(saveBluePrivateKey); List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var publicKey = await Storage.getStringList(saveBluePublicKey); List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!); List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
var token = await Storage.getStringList(saveBlueToken); List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
IoSenderManage.senderFactoryDataReset( IoSenderManage.senderFactoryDataReset(
@ -285,13 +292,15 @@ class LockSetLogic extends BaseGetXController {
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async { (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var publicKey = await Storage.getStringList(saveBluePublicKey); List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
List<int> publicKeyDataList = changeStringListToIntList(publicKey!); List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
var token = await Storage.getStringList(saveBlueToken); List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
IoSenderManage.senderFactoryDataReset( IoSenderManage.senderFactoryDataReset(
@ -347,18 +356,20 @@ class LockSetLogic extends BaseGetXController {
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async { (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); List<String>? privateKey =
await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
var publicKey = await Storage.getStringList(saveBluePublicKey); List<String>? publicKey =
await Storage.getStringList(saveBluePublicKey);
List<int> getPublicKeyList = changeStringListToIntList(publicKey!); List<int> getPublicKeyList = changeStringListToIntList(publicKey!);
state.settingUpSupportFeatures = type; state.settingUpSupportFeatures = type;
var featureEnable = 0; int featureEnable = 0;
if (type == 55) { if (type == 55) {
// APP开锁时是否需联网 // APP开锁时是否需联网
featureEnable = state.isOpenLockNeedOnline.value == 1 ? 0 : 1; featureEnable = state.isOpenLockNeedOnline.value == 1 ? 0 : 1;
@ -419,9 +430,9 @@ class LockSetLogic extends BaseGetXController {
} }
// //
void openCheckingInData( Future<void> openCheckingInData(
BlockSetCheckInCallback blockSetCheckInCallback) async { BlockSetCheckInCallback blockSetCheckInCallback) async {
var entity = await ApiRepository.to.openCheckingInData( CheckingInInfoDataEntity entity = await ApiRepository.to.openCheckingInData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -430,8 +441,8 @@ class LockSetLogic extends BaseGetXController {
} }
// //
void setLockSetGeneralSetting() async { Future<void> setLockSetGeneralSetting() async {
var entity = await ApiRepository.to.setCheckInData( LoginEntity entity = await ApiRepository.to.setCheckInData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
attendance: state.isAttendance.value == 1 ? 0 : 1, attendance: state.isAttendance.value == 1 ? 0 : 1,
); );
@ -448,7 +459,7 @@ class LockSetLogic extends BaseGetXController {
// //
Future<void> setLockPickingReminder() async { Future<void> setLockPickingReminder() async {
var entity = await ApiRepository.to.setLockPickingReminderData( LoginEntity entity = await ApiRepository.to.setLockPickingReminderData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
unlockReminder: state.isLockPickingReminder.value == 1 ? 0 : 1, unlockReminder: state.isLockPickingReminder.value == 1 ? 0 : 1,
); );
@ -464,8 +475,8 @@ class LockSetLogic extends BaseGetXController {
} }
// //
void setLockSetOpenLockNeedOnline() async { Future<void> setLockSetOpenLockNeedOnline() async {
var entity = await ApiRepository.to.setOpenLockNeedOnlineData( LoginEntity entity = await ApiRepository.to.setOpenLockNeedOnlineData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
appUnlockOnline: state.isOpenLockNeedOnline.value == 1 ? 0 : 1, appUnlockOnline: state.isOpenLockNeedOnline.value == 1 ? 0 : 1,
); );
@ -485,16 +496,18 @@ class LockSetLogic extends BaseGetXController {
// //
StreamSubscription? _passCurrentLockInformationEvent; StreamSubscription? _passCurrentLockInformationEvent;
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
// eventBus // eventBus
_passCurrentLockInformationEvent = _passCurrentLockInformationEvent = eventBus
eventBus.on<PassCurrentLockInformationEvent>().listen((event) { .on<PassCurrentLockInformationEvent>()
.listen((PassCurrentLockInformationEvent event) {
getLockSettingInfoData(); getLockSettingInfoData();
}); });
} }
void showDeletAlertTipDialog({String? showContent = ''}) { void showDeletAlertTipDialog({String? showContent = ''}) {
var content = showContent!.isEmpty String content = showContent!.isEmpty
? "${"删除设备失败,请确保在设备附近,设备未被连接,设备已打开".tr}${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮".tr : ""}" ? "${"删除设备失败,请确保在设备附近,设备未被连接,设备已打开".tr}${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮".tr : ""}"
: showContent; : showContent;
ShowTipView().showSureAlertDialog(content); ShowTipView().showSureAlertDialog(content);
@ -515,7 +528,7 @@ class LockSetLogic extends BaseGetXController {
} else if (state.lockBasicInfo.value.keyRight == 1) { } else if (state.lockBasicInfo.value.keyRight == 1) {
// //
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog( ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
'同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (a) { '同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) {
// //
state.deleteAdministratorIsHaveAllData.value = a; state.deleteAdministratorIsHaveAllData.value = a;
deletKeyData(); deletKeyData();
@ -529,8 +542,8 @@ class LockSetLogic extends BaseGetXController {
} }
// //
void checkLoginPassword() async { Future<void> checkLoginPassword() async {
var entity = await ApiRepository.to.checkLoginPassword( LockListInfoEntity entity = await ApiRepository.to.checkLoginPassword(
password: state.passwordTF.text, password: state.passwordTF.text,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
@ -540,21 +553,21 @@ class LockSetLogic extends BaseGetXController {
} }
// //
void deletLockInfoData() async { Future<void> deletLockInfoData() async {
var entity = await ApiRepository.to.deletOwnerLockData( LockListInfoEntity entity = await ApiRepository.to.deletOwnerLockData(
lockId: state.lockSetInfoData.value.lockId!, lockId: state.lockSetInfoData.value.lockId!,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
BlueManage().connectDeviceMacAddress = ""; BlueManage().connectDeviceMacAddress = '';
SchedulerBinding.instance.addPostFrameCallback((_) { SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
}); });
if(state.isOnlyOneData.value == true){ if (state.isOnlyOneData.value == true) {
Future.delayed(const Duration(milliseconds: 200)).then((e) { Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) {
Get.close(1); Get.close(1);
}); });
}else{ } else {
Future.delayed(const Duration(milliseconds: 200)).then((e) { Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) {
Get.close(2); Get.close(2);
}); });
} }
@ -562,27 +575,27 @@ class LockSetLogic extends BaseGetXController {
} }
// //
void deletKeyData() async { Future<void> deletKeyData() async {
var entity = await ApiRepository.to.deletOwnerKeyData( final LockListInfoEntity entity = await ApiRepository.to.deletOwnerKeyData(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.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) { if (entity.errorCode!.codeIsSuccessful) {
BlueManage().connectDeviceMacAddress = ""; BlueManage().connectDeviceMacAddress = '';
SchedulerBinding.instance.addPostFrameCallback((_) { SchedulerBinding.instance.addPostFrameCallback((_) {
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
}); });
if(state.isOnlyOneData.value == true){ final bool isXHJ = F.isXHJ;
Future.delayed(const Duration(milliseconds: 200)).then((e) { final bool isOnlyOneData = state.isOnlyOneData.value == true;
Get.close(1); Future<dynamic>.delayed(const Duration(milliseconds: 200)).then((e) {
}); if (isXHJ) {
}else{ Get.close(3);
Future.delayed(const Duration(milliseconds: 200)).then((e) { } else {
Get.close(2); final int onlyOneDataInt = isOnlyOneData ? 1 : 2;
}); Get.close(onlyOneDataInt);
} }
// Get.offAllNamed(Routers.starLockMain); });
} }
} }

View File

@ -16,6 +16,7 @@ class LockUserLogic extends BaseGetXController {
searchStr: state.searchController.text, searchStr: state.searchController.text,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.lockUserList.clear();
// 1: 2: 3: 4: 5: // 1: 2: 3: 4: 5:
final LockUserData data1 = entity.data![0]; final LockUserData data1 = entity.data![0];
data1.lockUserList?.forEach((LockUserListKeys element) { data1.lockUserList?.forEach((LockUserListKeys element) {

View File

@ -24,14 +24,16 @@ class PasswordKeyListLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { 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); _replyAddPassword(reply);
} }
if((reply is SenderResetPasswordsReply) && (state.ifCurrentScreen.value == true)){ if ((reply is SenderResetPasswordsReply) &&
(state.ifCurrentScreen.value == true)) {
_replyResetPassword(reply); _replyResetPassword(reply);
} }
}); });
@ -41,7 +43,7 @@ class PasswordKeyListLogic extends BaseGetXController {
Future<void> _replyAddPassword(Reply reply) async { Future<void> _replyAddPassword(Reply reply) async {
int status = reply.data[2]; int status = reply.data[2];
switch(status){ switch (status) {
case 0x00: case 0x00:
// //
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
@ -60,15 +62,15 @@ class PasswordKeyListLogic extends BaseGetXController {
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.senderCustomPasswordsCommand( IoSenderManage.senderCustomPasswordsCommand(
keyID:"0", keyID: "0",
userID:(await Storage.getUid())!, userID: (await Storage.getUid())!,
pwdNo:state.itemData.isCustom == 1 ? state.pwdNo : 0, pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
pwd:state.pwd,//state.deletPWD, pwd: state.pwd, //state.deletPWD,
operate: state.itemData.isCustom == 1 ? 2 : 3, operate: state.itemData.isCustom == 1 ? 2 : 3,
isAdmin: 0, isAdmin: 0,
useCountLimit: 0xffff, useCountLimit: 0xffff,
startTime:0x11223344, startTime: 0x11223344,
endTime:0x11223344, endTime: 0x11223344,
needAuthor: 1, needAuthor: 1,
isBeforeAddUser: false, isBeforeAddUser: false,
signKey: signKeyDataList, signKey: signKeyDataList,
@ -85,7 +87,7 @@ class PasswordKeyListLogic extends BaseGetXController {
// //
Future<void> _replyResetPassword(Reply reply) async { Future<void> _replyResetPassword(Reply reply) async {
int status = reply.data[2]; int status = reply.data[2];
switch(status){ switch (status) {
case 0x00: case 0x00:
// //
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
@ -106,8 +108,8 @@ class PasswordKeyListLogic extends BaseGetXController {
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.senderResetPasswordsCommand( IoSenderManage.senderResetPasswordsCommand(
keyID:"0", keyID: "0",
userID:(await Storage.getUid())!, userID: (await Storage.getUid())!,
needAuthor: 1, needAuthor: 1,
isBeforeAddUser: false, isBeforeAddUser: false,
signKey: signKeyDataList, signKey: signKeyDataList,
@ -125,10 +127,11 @@ class PasswordKeyListLogic extends BaseGetXController {
// //
Future<void> senderCustomPasswords() async { Future<void> senderCustomPasswords() async {
showEasyLoading(); showEasyLoading();
showBlueConnetctToastTimer(action: (){ showBlueConnetctToastTimer(action: () {
dismissEasyLoading(); dismissEasyLoading();
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey); var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!); List<int> signKeyDataList = changeStringListToIntList(signKey!);
@ -140,25 +143,26 @@ class PasswordKeyListLogic extends BaseGetXController {
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
IoSenderManage.senderCustomPasswordsCommand( IoSenderManage.senderCustomPasswordsCommand(
keyID:"0", keyID: "0",
userID:(await Storage.getUid())!, userID: (await Storage.getUid())!,
pwdNo:state.itemData.isCustom == 1 ? state.pwdNo : 0, pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
pwd:state.pwd,//state.deletPWD, pwd: state.pwd, //state.deletPWD,
operate: state.itemData.isCustom == 1 ? 2 : 3, operate: state.itemData.isCustom == 1 ? 2 : 3,
isAdmin: 0, isAdmin: 0,
useCountLimit: 0xffff, useCountLimit: 0xffff,
startTime:0x11223344, startTime: 0x11223344,
endTime:0x11223344, endTime: 0x11223344,
needAuthor: 1, needAuthor: 1,
isBeforeAddUser: false, isBeforeAddUser: false,
signKey: signKeyDataList, signKey: signKeyDataList,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
token: getTokenList); token: getTokenList);
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) { } else if (deviceConnectionState ==
BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
if(state.ifCurrentScreen.value == true){ if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast(); showBlueConnetctToast();
} }
} }
@ -167,17 +171,18 @@ class PasswordKeyListLogic extends BaseGetXController {
// //
Future<void> senderResetPasswords() async { Future<void> senderResetPasswords() async {
if(state.sureBtnState.value == 1){ if (state.sureBtnState.value == 1) {
return; return;
} }
state.sureBtnState.value = 1; state.sureBtnState.value = 1;
showEasyLoading(); showEasyLoading();
showBlueConnetctToastTimer(action: (){ showBlueConnetctToastTimer(action: () {
dismissEasyLoading(); dismissEasyLoading();
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey); var signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!); List<int> signKeyDataList = changeStringListToIntList(signKey!);
@ -189,43 +194,80 @@ class PasswordKeyListLogic extends BaseGetXController {
List<int> getTokenList = changeStringListToIntList(token!); List<int> getTokenList = changeStringListToIntList(token!);
IoSenderManage.senderResetPasswordsCommand( IoSenderManage.senderResetPasswordsCommand(
keyID:"0", keyID: "0",
userID:(await Storage.getUid())!, userID: (await Storage.getUid())!,
needAuthor: 1, needAuthor: 1,
isBeforeAddUser: false, isBeforeAddUser: false,
signKey: signKeyDataList, signKey: signKeyDataList,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
token: getTokenList); token: getTokenList);
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) { } else if (deviceConnectionState ==
BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
if(state.ifCurrentScreen.value == true){ if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast(); 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 { Future<PasswordKeyListEntity> mockNetworkDataRequest(
PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList( {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.keyStatus.toString(),
state.keyInfo.value.lockId.toString(), state.keyInfo.value.lockId.toString(),
pageNo.toString(), pageNo.toString(),
pageSize.toString(), pageSize.toString(),
state.searchController.text); state.searchController.text);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if (pageNo == 1) { //
state.itemDataList.value.clear(); state.itemDataList.addAll(entity.data!.itemList!);
state.itemDataList.value = entity.data!.itemList!; //
pageNo++; pageNo++;
} else {
if (entity.data!.itemList!.isNotEmpty) { // if (pageNo == 1) {
state.itemDataList.value.addAll(entity.data!.itemList!); // state.itemDataList.value.clear();
pageNo++; // state.itemDataList.value = entity.data!.itemList!;
} // pageNo++;
} // } else {
// if (entity.data!.itemList!.isNotEmpty) {
// state.itemDataList.value.addAll(entity.data!.itemList!);
// pageNo++;
// }
// }
} }
return entity; return entity;
} }
@ -233,13 +275,12 @@ class PasswordKeyListLogic extends BaseGetXController {
// //
Future<void> resetPasswordKeyListRequest() async { Future<void> resetPasswordKeyListRequest() async {
PasswordKeyListEntity entity = await ApiRepository.to.keyboardPwdReset( PasswordKeyListEntity entity = await ApiRepository.to.keyboardPwdReset(
lockId:state.keyInfo.value.lockId.toString(), lockId: state.keyInfo.value.lockId.toString(),
passwordKey: state.encrpyKey passwordKey: state.encrpyKey);
);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("重置成功".tr, something: (){ showToast("重置成功".tr, something: () {
pageNo = 1; pageNo = 1;
mockNetworkDataRequest(); mockNetworkDataRequest(isRefresh: true);
}); });
} }
} }
@ -247,13 +288,13 @@ class PasswordKeyListLogic extends BaseGetXController {
// deleteType:1- 2- // deleteType:1- 2-
Future<void> deletePwdRequest() async { Future<void> deletePwdRequest() async {
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd( PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
lockId:state.itemData.lockId!.toString(), lockId: state.itemData.lockId!.toString(),
keyboardPwdId:state.itemData.keyboardPwdId!.toString(), keyboardPwdId: state.itemData.keyboardPwdId!.toString(),
deleteType:1); deleteType: 1);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功".tr, something: (){ showToast("删除成功".tr, something: () {
pageNo = 1; pageNo = 1;
mockNetworkDataRequest(); mockNetworkDataRequest(isRefresh: true);
}); });
} }
} }
@ -262,9 +303,12 @@ class PasswordKeyListLogic extends BaseGetXController {
String getUseDateStr(PasswordKeyListItem indexEntity) { String getUseDateStr(PasswordKeyListItem indexEntity) {
int? getPwdType = indexEntity.keyboardPwdType; int? getPwdType = indexEntity.keyboardPwdType;
String useDateStr = ''; String useDateStr = '';
DateTime sendDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); DateTime sendDateStr =
DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
int starHour = indexEntity.hoursStart!; int starHour = indexEntity.hoursStart!;
int endHour = indexEntity.hoursEnd!; 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'); // AppLog.log('indexEntity.keyboardPwdName:${indexEntity.keyboardPwdName} indexEntity.keyboardPwdStatus:${indexEntity.keyboardPwdStatus} indexEntity.startDate!${indexEntity.startDate!} indexEntity.endDate!${indexEntity.endDate!} starHour:$starHour endHour:$endHour');
@ -272,70 +316,63 @@ class PasswordKeyListLogic extends BaseGetXController {
switch (getPwdType) { switch (getPwdType) {
case 1: case 1:
// 1 6使 // 1 6使
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}'; useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
break; break;
case 2: case 2:
// 2 24使 // 2 24使
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr} ${indexEntity.isCustom! == 1? "自定义".tr : ""}'; useDateStr =
'${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr} ${indexEntity.isCustom! == 1 ? "自定义".tr : ""}';
break; break;
case 3: case 3:
// 3 24使 // 3 24使
useDateStr = 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; break;
case 4: case 4:
// 4 使使 // 4 使使
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}'; useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
break; break;
case 5: case 5:
// 5 // 5
useDateStr = useDateStr = '${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break; break;
case 6: case 6:
// 6 // 6
useDateStr = useDateStr = '${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
'${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
break; break;
case 7: case 7:
// 7 // 7
useDateStr = useDateStr = '${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break; break;
case 8: case 8:
// 8 // 8
useDateStr = useDateStr = '${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break; break;
case 9: case 9:
// 9 // 9
useDateStr = useDateStr = '${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break; break;
case 10: case 10:
// 10 // 10
useDateStr = useDateStr = '${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break; break;
case 11: case 11:
// 11 // 11
useDateStr = useDateStr = '${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break; break;
case 12: case 12:
// 12 // 12
useDateStr = useDateStr = '${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break; break;
case 13: case 13:
// 13 // 13
useDateStr = useDateStr = '${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break; break;
case 14: case 14:
// 14 // 14
useDateStr = useDateStr = '${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
'${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
break; break;
default: default:
@ -347,9 +384,9 @@ class PasswordKeyListLogic extends BaseGetXController {
StreamSubscription? _getPasswordListRefreshUIEvent; StreamSubscription? _getPasswordListRefreshUIEvent;
void _getPasswordListRefreshUIAction() { void _getPasswordListRefreshUIAction() {
// eventBus // eventBus
_getPasswordListRefreshUIEvent = eventBus.on<GetPasswordListRefreshUI>().listen((event) { _getPasswordListRefreshUIEvent =
pageNo = 1; eventBus.on<GetPasswordListRefreshUI>().listen((event) {
mockNetworkDataRequest(); mockNetworkDataRequest(isRefresh: true);
}); });
} }

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
@ -24,14 +23,17 @@ class PasswordKeyListPage extends StatefulWidget {
State<PasswordKeyListPage> createState() => _PasswordKeyListPageState(); State<PasswordKeyListPage> createState() => _PasswordKeyListPageState();
} }
class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAware { class _PasswordKeyListPageState extends State<PasswordKeyListPage>
with RouteAware {
final logic = Get.put(PasswordKeyListLogic()); final logic = Get.put(PasswordKeyListLogic());
final state = Get.find<PasswordKeyListLogic>().state; final state = Get.find<PasswordKeyListLogic>().state;
Future<void> getHttpData() async { Future<void> getHttpData({required bool isRefresh}) async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
logic.mockNetworkDataRequest().then((PasswordKeyListEntity value){ logic
.mockNetworkDataRequest(isRefresh: isRefresh)
.then((PasswordKeyListEntity value) {
setState(() {}); setState(() {});
}); });
} }
@ -41,7 +43,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
void initState() { void initState() {
super.initState(); super.initState();
getHttpData(); getHttpData(isRefresh: true);
} }
@override @override
@ -61,11 +63,12 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
onPressed: () async { onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
if(state.itemDataList.isEmpty){ if (state.itemDataList.isEmpty) {
logic.showToast("暂无密码,无需重置".tr); logic.showToast("暂无密码,无需重置".tr);
return; return;
} }
ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, () { ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr,
() {
logic.senderResetPasswords(); logic.senderResetPasswords();
}); });
} else { } else {
@ -76,12 +79,11 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
], ],
), ),
body: EasyRefreshTool( body: EasyRefreshTool(
onRefresh: (){ onRefresh: () {
logic.pageNo = 1; getHttpData(isRefresh: true);
getHttpData();
}, },
onLoad: (){ onLoad: () {
getHttpData(); getHttpData(isRefresh: false);
}, },
child: Column( child: Column(
children: [ children: [
@ -89,26 +91,25 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
KeySearchWidget( KeySearchWidget(
editingController: state.searchController, editingController: state.searchController,
onSubmittedAction: () { onSubmittedAction: () {
logic.pageNo = 1; getHttpData(isRefresh: true);
getHttpData();
}, },
), ),
SizedBox( SizedBox(
height: 20.h, height: 20.h,
), ),
Expanded( Expanded(child: _buildMainUI()),
child: _buildMainUI()),
SizedBox( SizedBox(
height: 20.h, height: 20.h,
), ),
AddBottomWhiteBtn( AddBottomWhiteBtn(
btnName: TranslationLoader.lanKeys!.getPassword!.tr, btnName: TranslationLoader.lanKeys!.getPassword!.tr,
onClick: () { onClick: () {
Navigator.pushNamed(context, Routers.passwordKeyPerpetualPage, Navigator.pushNamed(
arguments: {"keyInfo": state.keyInfo.value}).then((val) { context, Routers.passwordKeyPerpetualPage,
arguments: {"keyInfo": state.keyInfo.value})
.then((val) {
if (val != null) { if (val != null) {
logic.pageNo = 1; getHttpData(isRefresh: true);
getHttpData();
} }
}); });
}), }),
@ -122,23 +123,31 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
Widget _buildMainUI() { Widget _buildMainUI() {
return Obx(() => state.itemDataList.value.isEmpty 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( : SlidableAutoCloseBehavior(
child: ListView.separated( child: ListView.separated(
itemCount: state.itemDataList.value.length, itemCount: state.itemDataList.value.length,
itemBuilder: (c, index) { itemBuilder: (c, index) {
PasswordKeyListItem passwordKeyListItem = state.itemDataList.value[index]; PasswordKeyListItem passwordKeyListItem =
String useDateStr = logic.getUseDateStr(passwordKeyListItem);// 使 state.itemDataList.value[index];
String useDateStr =
logic.getUseDateStr(passwordKeyListItem); // 使
return Slidable( return Slidable(
key:ValueKey(passwordKeyListItem.keyboardPwdId), key: ValueKey(passwordKeyListItem.keyboardPwdId),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: [
SlidableAction( SlidableAction(
onPressed: (BuildContext context){ onPressed: (BuildContext context) {
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async { ShowTipView().showIosTipWithContentDialog(
"确定要删除吗?".tr, () async {
state.itemData = passwordKeyListItem; state.itemData = passwordKeyListItem;
state.pwdNo = passwordKeyListItem.pwdUserNo!; state.pwdNo = passwordKeyListItem.pwdUserNo!;
state.pwd = passwordKeyListItem.keyboardPwd!; state.pwd = passwordKeyListItem.keyboardPwd!;
@ -152,12 +161,13 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
), ),
], ],
), ),
child: _electronicKeyItem(index, 'images/icon_password.png', passwordKeyListItem.keyboardPwdName!, useDateStr, () { child: _electronicKeyItem(index, 'images/icon_password.png',
passwordKeyListItem.keyboardPwdName!, useDateStr, () {
Navigator.pushNamed(context, Routers.passwordKeyDetailPage, Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
arguments: {"itemData": passwordKeyListItem}).then((val) { arguments: {"itemData": passwordKeyListItem})
.then((val) {
if (val != null) { if (val != null) {
logic.pageNo = 1; getHttpData(isRefresh: true);
getHttpData();
} }
}); });
}), }),
@ -173,7 +183,8 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
)); ));
} }
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]; PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
return GestureDetector( return GestureDetector(
@ -185,8 +196,14 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
child: Row( child: Row(
children: [ children: [
SizedBox(width: 30.w), SizedBox(width: 30.w),
Image.asset(lockTypeIcon, width: 60.w, height: 60.w,), Image.asset(
SizedBox(width: 20.w,), lockTypeIcon,
width: 60.w,
height: 60.w,
),
SizedBox(
width: 20.w,
),
Expanded( Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -194,22 +211,28 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
Row( Row(
children: [ children: [
SizedBox( SizedBox(
width: passwordKeyListItem.keyboardPwdStatus == 2 ? 1.sw - 110.w - 100.w : 1.sw - 110.w - 50.w, width: passwordKeyListItem.keyboardPwdStatus == 2
child: Row( ? 1.sw - 110.w - 100.w
children: [ : 1.sw - 110.w - 50.w,
child: Row(children: [
Flexible( Flexible(
child: Text( child: Text(lockTypeTitle,
lockTypeTitle,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor) style: TextStyle(
), fontSize: 24.sp,
color: AppColors.blackColor)),
) )
] ]),
),
), ),
SizedBox(width: 10.w), 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) // SizedBox(width: 15.w)
], ],
), ),
@ -222,7 +245,9 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
useDateStr, useDateStr,
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, 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.ifCurrentScreen.value = false;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
} }
} }

View File

@ -1,4 +1,3 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; 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 /// getKeyType 1 2 3 4 5 6 7 8 9 10 11 12 13 14
// //
Future<void> getKeyboardPwdRequest() async { 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 int endDate = DateTool().dateToTimestamp(state.endTime.value, 1);
final String lockId = state.keyInfo.value.lockId.toString(); final String lockId = state.keyInfo.value.lockId.toString();
String getKeyType = '0'; String getKeyType = '0';
@ -40,20 +39,33 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
if (state.widgetType.value == 0) { if (state.widgetType.value == 0) {
// //
getKeyType = '2'; getKeyType = '2';
//startTime传当前时间戳
startDate = DateTime.now().millisecondsSinceEpoch;
} else if (state.widgetType.value == 1) { } 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 (CommonDataManage().currentKeyInfo.vendor ==
if (endDate <= DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { 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); showToast('失效时间要大于当前时间'.tr);
return; 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); showToast('生效时间不能小于当前时间'.tr);
return; return;
} }
@ -72,8 +84,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
} else if (state.widgetType.value == 4) { } 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 (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { (CommonDataManage().currentKeyInfo.model ==
IoModelVendor.model_XL_BLE ||
CommonDataManage().currentKeyInfo.model ==
IoModelVendor.model_XL_WIFI)) {
if (endDate <
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
showToast('结束时间不能小于当前时间'.tr); showToast('结束时间不能小于当前时间'.tr);
return; return;
} }
@ -116,7 +133,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
startDate: startDate.toString(), startDate: startDate.toString(),
startHours: state.loopStartHours.value, startHours: state.loopStartHours.value,
endHours: state.loopEndHours.value, endHours: state.loopEndHours.value,
isCoerced: 1); isCoerced: 2);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.isSendSuccess.value = true; state.isSendSuccess.value = true;
state.sendSucceedType.value = state.widgetType.value; state.sendSucceedType.value = state.widgetType.value;
@ -142,19 +159,20 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
// //
if (state.isPermanent.value == false) { if (state.isPermanent.value == false) {
getKeyType = '3'; getKeyType = '3';
getEffectiveDateTime = DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString(); getEffectiveDateTime =
getFailureDateTime = DateTool().dateToTimestamp(state.customEndTime.value, 1).toString(); DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
getFailureDateTime =
DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
} }
final PasswordKeyEntity entity = await ApiRepository.to.addPasswordKey( final PasswordKeyEntity entity = await ApiRepository.to.addPasswordKey(
lockId:lockId, lockId: lockId,
keyboardPwdName:state.nameController.text, keyboardPwdName: state.nameController.text,
keyboardPwd:state.pwdController.text, keyboardPwd: state.pwdController.text,
keyboardPwdType:getKeyType, keyboardPwdType: getKeyType,
startDate:getEffectiveDateTime, startDate: getEffectiveDateTime,
endDate:getFailureDateTime, endDate: getFailureDateTime,
addType:'1', addType: '1',
pwdRight:state.isAdministrator.value == true ? 1 : 0 pwdRight: state.isAdministrator.value == true ? 1 : 0);
);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.isSendSuccess.value = true; state.isSendSuccess.value = true;
state.sendSucceedType.value = state.widgetType.value; state.sendSucceedType.value = state.widgetType.value;
@ -189,10 +207,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
showToast('请输入密码'.tr); showToast('请输入密码'.tr);
return; return;
} }
final PasswordKeyEntity entity = await ApiRepository.to.checkKeyboardpwdName( final PasswordKeyEntity entity =
lockId:state.keyInfo.value.lockId.toString(), await ApiRepository.to.checkKeyboardpwdName(
keyboardPwdName:state.nameController.text, lockId: state.keyInfo.value.lockId.toString(),
keyboardPwd:state.pwdController.text,); keyboardPwdName: state.nameController.text,
keyboardPwd: state.pwdController.text,
);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
senderCustomPasswords(); senderCustomPasswords();
} else { } else {
@ -204,9 +224,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { 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]; final int status = reply.data[2];
switch (status) { switch (status) {
case 0x00: case 0x00:
@ -218,7 +240,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
state.pwdNumber.value = listChangInt(reply.data.sublist(9, 11)); state.pwdNumber.value = listChangInt(reply.data.sublist(9, 11));
// AppLog.log("密码编号:${state.pwdNumber.value}"); // AppLog.log("密码编号:${state.pwdNumber.value}");
switch(reply.data[11]){ switch (reply.data[11]) {
case 0: case 0:
// //
addKeyboardPwdRequest(); addKeyboardPwdRequest();
@ -255,14 +277,20 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
final List<String> saveStrList = changeIntListToStringList(token); final List<String> saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey =
final List<int> signKeyDataList = changeStringListToIntList(signKey!); await Storage.getStringList(saveBlueSignKey);
final List<int> signKeyDataList =
changeStringListToIntList(signKey!);
int startDate = DateTool().dateToTimestamp(state.customBeginTime.value, 1); int startDate =
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1); DateTool().dateToTimestamp(state.customBeginTime.value, 1);
int endDate =
DateTool().dateToTimestamp(state.customEndTime.value, 1);
// //
if (state.isPermanent.value == true) { if (state.isPermanent.value == true) {
startDate = 0; startDate = 0;
@ -272,12 +300,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
keyID: '1', keyID: '1',
userID: await Storage.getUid(), userID: await Storage.getUid(),
pwdNo: 0, pwdNo: 0,
pwd:state.pwdController.text, pwd: state.pwdController.text,
operate: 0, operate: 0,
isAdmin: state.isAdministrator.value == true ? 1 : 0, isAdmin: state.isAdministrator.value == true ? 1 : 0,
useCountLimit: 0xffff, useCountLimit: 0xffff,
startTime: startDate ~/1000, startTime: startDate ~/ 1000,
endTime: endDate ~/1000, endTime: endDate ~/ 1000,
needAuthor: 1, needAuthor: 1,
isBeforeAddUser: false, isBeforeAddUser: false,
signKey: signKeyDataList, signKey: signKeyDataList,
@ -311,7 +339,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1); int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
// //
if (state.isPermanent.value == false) { if (state.isPermanent.value == false) {
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) { if (startDate <
DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) {
showToast('生效时间要大于当前时间'); showToast('生效时间要大于当前时间');
return; return;
} }
@ -320,33 +349,38 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
showToast('失效时间需大于生效时间'); showToast('失效时间需大于生效时间');
return; return;
} }
}else{ } else {
startDate = 0; startDate = 0;
endDate = 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位数字密码'); showToast('请输入6-9位数字密码');
return; return;
} }
if(state.sureBtnState.value == 1){ if (state.sureBtnState.value == 1) {
return; return;
} }
state.sureBtnState.value = 1; state.sureBtnState.value = 1;
showEasyLoading(); showEasyLoading();
showBlueConnetctToastTimer(action: (){ showBlueConnetctToastTimer(action: () {
dismissEasyLoading(); dismissEasyLoading();
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { 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<int> signKeyDataList = changeStringListToIntList(signKey!);
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey =
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); await Storage.getStringList(saveBluePrivateKey);
final List<int> getPrivateKeyList =
changeStringListToIntList(privateKey!);
final List<String>? token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
final List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
@ -355,22 +389,23 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
keyID: '1', keyID: '1',
userID: await Storage.getUid(), userID: await Storage.getUid(),
pwdNo: 0, pwdNo: 0,
pwd:state.pwdController.text, pwd: state.pwdController.text,
operate: 0, operate: 0,
isAdmin: state.isAdministrator.value == true ? 1 : 0, isAdmin: state.isAdministrator.value == true ? 1 : 0,
useCountLimit: 0xffff, useCountLimit: 0xffff,
startTime: startDate ~/1000, startTime: startDate ~/ 1000,
endTime: endDate ~/1000, endTime: endDate ~/ 1000,
needAuthor: 1, needAuthor: 1,
isBeforeAddUser: false, isBeforeAddUser: false,
signKey: signKeyDataList, signKey: signKeyDataList,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
token: getTokenList); token: getTokenList);
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) { } else if (deviceConnectionState ==
BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
if(state.ifCurrentScreen.value == true){ if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast(); showBlueConnetctToast();
} }
} }
@ -410,7 +445,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
break; break;
case 4: 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; break;
case 5: case 5:
// 4 使使 // 4 使使

View File

@ -70,7 +70,9 @@ class GroupList {
List<LockListInfoItemEntity>? lockList; List<LockListInfoItemEntity>? lockList;
bool _isChecked = false; bool _isChecked = false;
bool get isChecked => _isChecked ?? false; bool get isChecked => _isChecked ?? false;
set isChecked(bool value) => _isChecked = value; set isChecked(bool value) => _isChecked = value;
GroupList({this.groupName, this.groupId, this.lockList}); GroupList({this.groupName, this.groupId, this.lockList});
@ -131,9 +133,10 @@ class LockListInfoItemEntity {
LockFeature? lockFeature; LockFeature? lockFeature;
LockSetting? lockSetting; LockSetting? lockSetting;
int? hasGateway; int? hasGateway;
String? mac;
LockListInfoItemEntity( LockListInfoItemEntity({
{this.keyId, this.keyId,
this.lockId, this.lockId,
this.lockName, this.lockName,
this.lockAlias, this.lockAlias,
@ -165,7 +168,9 @@ class LockListInfoItemEntity {
this.restoreCount, this.restoreCount,
this.model, this.model,
this.vendor, this.vendor,
this.hasGateway}); this.hasGateway,
this.mac,
});
LockListInfoItemEntity.fromJson(Map<String, dynamic> json) { LockListInfoItemEntity.fromJson(Map<String, dynamic> json) {
keyId = json['keyId']; keyId = json['keyId'];
@ -207,6 +212,7 @@ class LockListInfoItemEntity {
? LockSetting.fromJson(json['lockSetting']) ? LockSetting.fromJson(json['lockSetting'])
: null; : null;
hasGateway = json['hasGateway']; hasGateway = json['hasGateway'];
mac = json['mac'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -250,12 +256,13 @@ class LockListInfoItemEntity {
data['lockSetting'] = lockSetting!.toJson(); data['lockSetting'] = lockSetting!.toJson();
} }
data['hasGateway'] = hasGateway; data['hasGateway'] = hasGateway;
data['mac'] = mac;
return data; return data;
} }
// //
bool isLockOwnerBool(){ bool isLockOwnerBool() {
return isLockOwner== 1; return isLockOwner == 1;
} }
} }
@ -304,8 +311,9 @@ class LockFeature {
int? videoIntercom; int? videoIntercom;
int? isSupportCatEye; int? isSupportCatEye;
int? isSupportBackupBattery; int? isSupportBackupBattery;
LockFeature(
{this.password, LockFeature({
this.password,
this.icCard, this.icCard,
this.fingerprint, this.fingerprint,
this.fingerVein, this.fingerVein,
@ -315,7 +323,8 @@ class LockFeature {
this.bluetoothRemoteControl, this.bluetoothRemoteControl,
this.videoIntercom, this.videoIntercom,
this.isSupportCatEye, this.isSupportCatEye,
this.isSupportBackupBattery}); this.isSupportBackupBattery,
});
LockFeature.fromJson(Map<String, dynamic> json) { LockFeature.fromJson(Map<String, dynamic> json) {
password = json['password']; password = json['password'];
@ -352,6 +361,7 @@ class LockSetting {
int? attendance; int? attendance;
int? appUnlockOnline; int? appUnlockOnline;
int? remoteUnlock; int? remoteUnlock;
LockSetting({ LockSetting({
this.attendance, this.attendance,
this.appUnlockOnline, this.appUnlockOnline,

View File

@ -14,7 +14,6 @@ import 'lockListGroup_view.dart';
import 'lockList_logic.dart'; import 'lockList_logic.dart';
class LockListXHJPage extends StatefulWidget { class LockListXHJPage extends StatefulWidget {
const LockListXHJPage({required this.lockListInfoGroupEntity, Key? key}) const LockListXHJPage({required this.lockListInfoGroupEntity, Key? key})
: super(key: key); : super(key: key);
final LockListInfoGroupEntity lockListInfoGroupEntity; final LockListInfoGroupEntity lockListInfoGroupEntity;
@ -66,7 +65,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
), ),
Expanded( Expanded(
child: ListView.separated( child: ListView.builder(
itemCount: logic.groupDataList.length, itemCount: logic.groupDataList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
final GroupList itemData = logic.groupDataList[index]; final GroupList itemData = logic.groupDataList[index];
@ -74,12 +73,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
}, },
shrinkWrap: true, shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
separatorBuilder: (BuildContext context, int index) { ),
return const Divider(
height: 1,
color: AppColors.greyLineColor,
);
}),
), ),
], ],
), ),
@ -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 = final List<LockListInfoItemEntity> lockItemList =
itemData.lockList ?? <LockListInfoItemEntity>[]; itemData.lockList ?? <LockListInfoItemEntity>[];
return LockListGroupView( 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>[]; final List<Widget> list = <Widget>[];
for (int i = 0, j = 0; i < lockItemList.length; i++, j++) { for (int i = 0, j = 0; i < lockItemList.length; i++, j++) {
final LockListInfoItemEntity keyInfo = lockItemList[i]; final LockListInfoItemEntity keyInfo = lockItemList[i];
@ -120,9 +115,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
isLast = true; isLast = true;
} }
list.add(Slidable( list.add(Slidable(
key: ValueKey(keyInfo.keyId), key: ValueKey<int?>(keyInfo.keyId),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.5,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: <Widget>[ children: <Widget>[
SlidableAction( SlidableAction(
@ -133,6 +128,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
backgroundColor: Colors.red, backgroundColor: Colors.red,
foregroundColor: Colors.white, foregroundColor: Colors.white,
label: '删除'.tr, label: '删除'.tr,
borderRadius: BorderRadius.all(Radius.circular(20.w)),
padding: EdgeInsets.only(left: 5.w, right: 5.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 || if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
(keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)) { (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)) {
logic.showToast("您的钥匙未生效".tr); logic.showToast('您的钥匙未生效'.tr);
return; return;
} }
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
(keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) { (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) {
logic.showToast("您的钥匙已冻结".tr); logic.showToast('您的钥匙已冻结'.tr);
return; return;
} }
if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || if ((keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
(keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) { (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) {
logic.showToast("您的钥匙已过期".tr); logic.showToast('您的钥匙已过期'.tr);
return; return;
} }
Get.toNamed(Routers.lockDetailMainPage, arguments: <String, Object>{ Get.toNamed(Routers.lockDetailMainPage, arguments: <String, Object>{
"keyInfo": keyInfo, 'keyInfo': keyInfo,
"isOnlyOneData": false, 'isOnlyOneData': false,
}); });
}), }),
)); ));
@ -188,7 +184,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
borderRadius: BorderRadius.circular(20.w), borderRadius: BorderRadius.circular(20.w),
), ),
child: Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 10.h), padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 5.h),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -197,18 +193,20 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset(
'images/icon_lock_circle.png', 'images/icon_lock_circle.png',
width: 32.r, width: 48.r,
height: 32.r, height: 48.r,
color: AppColors.mainColor, color: AppColors.mainColor,
), ),
], ],
), ),
SizedBox( SizedBox(
height: 15.h, height: 10.h,
), ),
Text(keyInfo.lockAlias!, FittedBox(
fit: BoxFit.scaleDown,
child: Text(keyInfo.lockAlias!,
style: TextStyle( style: TextStyle(
fontSize: 32.sp, fontSize: 24.sp,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: keyInfo.passageMode == 1 color: keyInfo.passageMode == 1
? AppColors.openPassageModeColor ? AppColors.openPassageModeColor
@ -216,8 +214,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
maxLines: 1), maxLines: 1),
),
Visibility( Visibility(
visible: keyInfo.passageMode == 1 ? true : false, visible: keyInfo.passageMode == 1,
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 5.h), padding: EdgeInsets.only(top: 5.h),
child: Row( child: Row(
@ -228,7 +227,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
borderRadius: BorderRadius.circular(5.w), borderRadius: BorderRadius.circular(5.w),
color: AppColors.openPassageModeColor, color: AppColors.openPassageModeColor,
), ),
child: Text("常开模式开启".tr, child: Text('常开模式开启'.tr,
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
color: AppColors.appBarIconColor)), color: AppColors.appBarIconColor)),
@ -237,14 +236,13 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
)), )),
Visibility( Visibility(
visible: visible: keyInfo.lockSetting!.remoteUnlock == 1,
keyInfo.lockSetting!.remoteUnlock == 1 ? true : false,
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 5.h), padding: EdgeInsets.only(top: 5.h),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text( Text(
"远程开锁".tr, '远程开锁'.tr,
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
color: AppColors.darkGrayTextColor), color: AppColors.darkGrayTextColor),
@ -253,16 +251,14 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
)), )),
Visibility( Visibility(
visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime ||
keyInfo.keyType == XSConstantMacro.keyTypeLoop) && keyInfo.keyType == XSConstantMacro.keyTypeLoop) &&
(keyInfo.keyStatus == (keyInfo.keyStatus ==
XSConstantMacro.keyStatusWaitIneffective || XSConstantMacro.keyStatusWaitIneffective ||
keyInfo.keyStatus == keyInfo.keyStatus ==
XSConstantMacro.keyStatusFrozen || XSConstantMacro.keyStatusFrozen ||
keyInfo.keyStatus == keyInfo.keyStatus ==
XSConstantMacro.keyStatusExpired)) XSConstantMacro.keyStatusExpired),
? true
: false,
child: Padding( child: Padding(
padding: EdgeInsets.only(top: 20.h), padding: EdgeInsets.only(top: 20.h),
child: Row( child: Row(
@ -292,9 +288,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
child: Text( child: Text(
keyInfo.isLockOwner == 1 keyInfo.isLockOwner == 1
? '超级管理员'.tr ? '超级管理员'.tr
: (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr), : (keyInfo.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr),
style: TextStyle( style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor), fontSize: 16.sp, color: AppColors.darkGrayTextColor),
), ),
), ),
Image.asset( Image.asset(
@ -304,9 +300,9 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
SizedBox(width: 2.w), SizedBox(width: 2.w),
Text( Text(
"${keyInfo.electricQuantity!}%", '${keyInfo.electricQuantity!}%',
style: TextStyle( style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor), fontSize: 16.sp, color: AppColors.darkGrayTextColor),
), ),
], ],
), ),
@ -315,7 +311,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)) keyInfo.startDate, keyInfo.endDate, keyInfo.keyType))
.join('\u{200B}'), .join('\u{200B}'),
style: TextStyle( 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 @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
@ -335,7 +330,6 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();

View File

@ -116,7 +116,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
); );
} }
child = F.sw( child = F.sw(
defaultCall: () => child, skyCall: () => child,
xhjCall: () => Container( xhjCall: () => Container(
decoration: const BoxDecoration( decoration: const BoxDecoration(
image: DecorationImage( image: DecorationImage(
@ -133,7 +133,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
Widget returnWidget; Widget returnWidget;
if (type == 1) { if (type == 1) {
type = F.sw(defaultCall: () => 1, xhjCall: () => 2); type = F.sw(skyCall: () => 1, xhjCall: () => 2);
} }
switch (type) { switch (type) {
case 0: case 0:
@ -152,7 +152,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
// //
Storage.setBool(ifIsDemoModeOrNot, false); Storage.setBool(ifIsDemoModeOrNot, false);
returnWidget = F.sw( returnWidget = F.sw(
defaultCall: () => LockListPage( skyCall: () => LockListPage(
lockListInfoGroupEntity: state.lockListInfoGroupEntity.value), lockListInfoGroupEntity: state.lockListInfoGroupEntity.value),
xhjCall: () => LockListXHJPage( xhjCall: () => LockListXHJPage(
lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)); lockListInfoGroupEntity: state.lockListInfoGroupEntity.value));

View File

@ -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_page.dart';
import 'package:star_lock/mine/message/messageList/messageList_xhj_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/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/noData.dart';
import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/tools/submitBtn.dart';
import 'package:star_lock/translations/trans_lib.dart'; import 'package:star_lock/translations/trans_lib.dart';
@ -76,7 +77,7 @@ class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
pageView( pageView(
widget: SafeArea( widget: SafeArea(
bottom: false, bottom: false,
child: MinePersonInfoPage( child: MineSetPage(
showAppBar: false, showAppBar: false,
showAbout: true, showAbout: true,
), ),

View File

@ -50,7 +50,7 @@ class _AboutPageState extends State<AboutPage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.about!.tr, barTitle: TranslationLoader.lanKeys!.about!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
@ -67,11 +67,11 @@ class _AboutPageState extends State<AboutPage> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
F.sw( F.sw(
defaultCall: () => logoView(), skyCall: () => logoView(),
xhjCall: () => const SizedBox()), xhjCall: () => const SizedBox()),
listView(), listView(),
F.sw( F.sw(
defaultCall: () => const SizedBox(), skyCall: () => const SizedBox(),
xhjCall: () => logoView()), xhjCall: () => logoView()),
], ],
), ),
@ -185,7 +185,7 @@ class _AboutPageState extends State<AboutPage> {
], ],
); );
view = F.sw( view = F.sw(
defaultCall: () => view, skyCall: () => view,
xhjCall: () => Container( xhjCall: () => Container(
margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w), margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -221,7 +221,7 @@ class _AboutPageState extends State<AboutPage> {
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(20.r),
child: Image.asset( child: Image.asset(
F.sw( F.sw(
defaultCall: () => "images/icon_main_1024.png", skyCall: () => "images/icon_main_1024.png",
xhjCall: () => "images/icon_main_xhj_1024.png"), xhjCall: () => "images/icon_main_xhj_1024.png"),
width: 160.w, width: 160.w,
height: 160.w), height: 160.w),

View File

@ -26,7 +26,7 @@ class _WebviewShowPageState extends State<WebviewShowPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
state.webViewController.loadRequest(Uri.parse(state.webURL)); state.webViewController.loadRequest(Uri.parse(state.webURL));
return F.sw(defaultCall: () => defaultView(), xhjCall: () => xhjView()); return F.sw(skyCall: () => defaultView(), xhjCall: () => xhjView());
} }
Widget defaultView() { Widget defaultView() {

View File

@ -32,7 +32,7 @@ class _AddLockPageState extends State<AddLockPage> with BaseWidget {
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.addLock!.tr, barTitle: TranslationLoader.lanKeys!.addLock!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,

View File

@ -28,7 +28,7 @@ class _NearbyLockPageState extends State<NearbyLockPage> with RouteAware {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.nearbyLock!.tr, barTitle: TranslationLoader.lanKeys!.nearbyLock!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,

View File

@ -27,7 +27,7 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.selectLockType!.tr, barTitle: TranslationLoader.lanKeys!.selectLockType!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
@ -52,7 +52,7 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
// //
Widget lockTypeList() { Widget lockTypeList() {
Widget view = F.sw( Widget view = F.sw(
defaultCall: () => GridView.count( skyCall: () => GridView.count(
crossAxisCount: 2, crossAxisCount: 2,
childAspectRatio: 2.83, childAspectRatio: 2.83,
crossAxisSpacing: 10, crossAxisSpacing: 10,
@ -162,7 +162,7 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
// //
view = F.sw( view = F.sw(
defaultCall: () => Container( skyCall: () => Container(
height: 150.h, height: 150.h,
color: Colors.white, color: Colors.white,
margin: const EdgeInsets.all(10), margin: const EdgeInsets.all(10),
@ -195,7 +195,7 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
child: Container( child: Container(
height: 120.h, height: 120.h,
decoration: F.sw( decoration: F.sw(
defaultCall: () => const BoxDecoration( skyCall: () => const BoxDecoration(
color: Colors.white, color: Colors.white,
), ),
xhjCall: () => BoxDecoration( xhjCall: () => BoxDecoration(

View File

@ -39,13 +39,13 @@ class _LockMallPageState extends State<LockMallPage> {
barTitle: getWebTitle(logic), barTitle: getWebTitle(logic),
haveBack: logic.state.canGoBack || logic.state.allowReturn, haveBack: logic.state.canGoBack || logic.state.allowReturn,
backgroundColor: F.sw( backgroundColor: F.sw(
defaultCall: () => AppColors.mainColor, skyCall: () => AppColors.mainColor,
xhjCall: () => Colors.white), xhjCall: () => Colors.white),
titleColor: F.sw( titleColor: F.sw(
defaultCall: () => null, skyCall: () => null,
xhjCall: () => AppColors.blackColor), xhjCall: () => AppColors.blackColor),
iconColor: F.sw( iconColor: F.sw(
defaultCall: () => null, skyCall: () => null,
xhjCall: () => AppColors.blackColor), xhjCall: () => AppColors.blackColor),
backAction: () => logic.canGoBack(false), backAction: () => logic.canGoBack(false),
) )

View File

@ -24,7 +24,7 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: "消息详情".tr, barTitle: "消息详情".tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
@ -60,7 +60,7 @@ class _MessageDetailPageState extends State<MessageDetailPage> {
style: TextStyle(fontSize: 22.sp, color: AppColors.placeholderTextColor), style: TextStyle(fontSize: 22.sp, color: AppColors.placeholderTextColor),
); );
return F.sw( return F.sw(
defaultCall: () => view, skyCall: () => view,
xhjCall: () => Container( xhjCall: () => Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 20.h, bottom: 20.h, left: 20.w, right: 20.w), top: 20.h, bottom: 20.h, left: 20.w, right: 20.w),

View File

@ -100,7 +100,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage>
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Text(
'智能分析', '智能分析'.tr,
style: TextStyle( style: TextStyle(
color: AppColors.blackColor, color: AppColors.blackColor,
fontSize: 28.sp, fontSize: 28.sp,
@ -108,7 +108,7 @@ class _MessageListXHJPageState extends State<MessageListXHJPage>
), ),
), ),
Text( Text(
'精准识别设备事件,过滤无效信息', '精准识别设备事件,过滤无效信息'.tr,
style: TextStyle( style: TextStyle(
color: AppColors.blackColor.withOpacity(0.6), color: AppColors.blackColor.withOpacity(0.6),
fontSize: 20.sp, fontSize: 20.sp,

View File

@ -28,7 +28,7 @@ class _MineUnbindPhoneOrEmailState extends State<MineUnbindPhoneOrEmailPage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.modifyAccount!.tr, barTitle: TranslationLoader.lanKeys!.modifyAccount!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,

View File

@ -27,7 +27,7 @@ class _MinePersonInfoEditAccountNextPageState
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.modifyAccount!.tr, barTitle: TranslationLoader.lanKeys!.modifyAccount!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,

View File

@ -28,7 +28,7 @@ class _MinePersonInfoEditNamePageState
return Scaffold( return Scaffold(
backgroundColor: AppColors.greyBackgroundColor, backgroundColor: AppColors.greyBackgroundColor,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.changeNickName!.tr, barTitle: TranslationLoader.lanKeys!.changeNickName!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
@ -97,7 +97,7 @@ class _MinePersonInfoEditNamePageState
], ],
); );
view = F.sw( view = F.sw(
defaultCall: () => view, skyCall: () => view,
xhjCall: () => Container( xhjCall: () => Container(
margin: EdgeInsets.only(top: 20.h, left: 16.w, right: 16.w), margin: EdgeInsets.only(top: 20.h, left: 16.w, right: 16.w),
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w), padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w),

View File

@ -30,7 +30,7 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: state.channel.value == "1" barTitle: state.channel.value == "1"
? TranslationLoader.lanKeys!.mobileNumber!.tr ? TranslationLoader.lanKeys!.mobileNumber!.tr
: TranslationLoader.lanKeys!.email!.tr, : TranslationLoader.lanKeys!.email!.tr,

View File

@ -4,7 +4,9 @@ import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/flavors.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_logic.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
import 'package:star_lock/tools/custom_bottom_sheet.dart'; import 'package:star_lock/tools/custom_bottom_sheet.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
@ -14,9 +16,8 @@ import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
class MinePersonInfoPage extends StatefulWidget { class MinePersonInfoPage extends StatefulWidget {
MinePersonInfoPage({Key? key, this.showAppBar = true, this.showAbout = false}) MinePersonInfoPage({Key? key, this.showAbout = false})
: super(key: key); : super(key: key);
bool showAppBar;
bool showAbout; bool showAbout;
@override @override
@ -24,69 +25,21 @@ class MinePersonInfoPage extends StatefulWidget {
} }
class _MinePersonInfoPageState extends State<MinePersonInfoPage> { class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
final logic = Get.put(MinePersonInfoLogic()); final MinePersonInfoLogic logic = Get.put(MinePersonInfoLogic());
final state = Get.find<MinePersonInfoLogic>().state; final MinePersonInfoState state = Get.find<MinePersonInfoLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: F.sw( backgroundColor: F.sw(
defaultCall: () => AppColors.mainBackgroundColor, skyCall: () => AppColors.mainBackgroundColor,
xhjCall: () => AppColors.mainBackgroundColor), xhjCall: () => AppColors.mainBackgroundColor),
appBar: widget.showAppBar appBar: TitleAppBar(
? TitleAppBar(
barTitle: TranslationLoader.lanKeys!.personalInformation!.tr, barTitle: TranslationLoader.lanKeys!.personalInformation!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor) backgroundColor: AppColors.mainColor),
: null,
body: Column( body: Column(
children: [ children: <Widget>[
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,
),
),
],
),
)),
SizedBox( SizedBox(
height: 20.h, height: 20.h,
), ),
@ -95,10 +48,10 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(20.r),
child: Column( child: Column(
children: [ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.avatar!.tr, leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
rightTitle: "", rightTitle: '',
allHeight: 100.h, allHeight: 100.h,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
@ -119,15 +72,15 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
leftTitel: TranslationLoader.lanKeys!.nickName!.tr, leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.mineInfoData.value.nickname != null rightTitle: state.mineInfoData.value.nickname != null
? state.mineInfoData.value.nickname! ? state.mineInfoData.value.nickname!
: "", : '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage, context, Routers.minePersonInfoEditNamePage,
arguments: { arguments: <String, MinePersonInfoData>{
'mineInfoData': state.mineInfoData.value 'mineInfoData': state.mineInfoData.value
}).then((value) => logic.getUserInfoRequest()); }).then((Object? value) => logic.getUserInfoRequest());
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr, leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
@ -141,17 +94,17 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
if (state.mineInfoData.value.mobile!.isNotEmpty) { if (state.mineInfoData.value.mobile!.isNotEmpty) {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage, context, Routers.mineUnbindPhoneOrEmailPage,
arguments: { arguments: <String, String>{
'mobile': state.mineInfoData.value.mobile!, 'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1' 'isFrom': '1'
}).then((value) => logic.getUserInfoRequest()); }).then((Object? value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, context, Routers.mineBindPhoneOrEmailPage,
arguments: { arguments: <String, String>{
'mobile': state.mineInfoData.value.mobile!, 'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1' 'isFrom': '1'
}).then((value) => logic.getUserInfoRequest()); }).then((Object? value) => logic.getUserInfoRequest());
} }
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
@ -166,23 +119,23 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
if (state.mineInfoData.value.email!.isNotEmpty) { if (state.mineInfoData.value.email!.isNotEmpty) {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage, context, Routers.mineUnbindPhoneOrEmailPage,
arguments: { arguments: <String, String>{
'isFrom': '2', 'isFrom': '2',
'email': state.mineInfoData.value.email! 'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest()); }).then((Object? value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, context, Routers.mineBindPhoneOrEmailPage,
arguments: { arguments: <String, String>{
'isFrom': '2', 'isFrom': '2',
'email': state.mineInfoData.value.email! 'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest()); }).then((Object? value) => logic.getUserInfoRequest());
} }
})), })),
CommonItem( CommonItem(
leftTitel: leftTitel:
TranslationLoader.lanKeys!.resetPasswords!.tr, TranslationLoader.lanKeys!.resetPasswords!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -192,15 +145,15 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr, leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 rightTitle: state.mineInfoData.value.haveSafeAnswer == 0
? "去设置".tr ? '去设置'.tr
: "", : '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) { if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed(context, Navigator.pushNamed(context,
Routers.minePersonInfoSetSafetyProblemPage) Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest()); .then((Object? value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed(context, Navigator.pushNamed(context,
Routers.minePersonInfoViewSafetyProblemPage); Routers.minePersonInfoViewSafetyProblemPage);
@ -211,40 +164,11 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
TranslationLoader.lanKeys!.countryAndRegion!.tr, TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName! ? state.mineInfoData.value.countryName!
: "", : '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: false)), 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) { builder: (BuildContext context) {
return AlertBottomWidget( return AlertBottomWidget(
topTitle: '', topTitle: '',
items: const ['拍照', '从相册选择'], items: const <String>['拍照', '从相册选择'],
chooseCallback: logic.chooseCallback, chooseCallback: logic.chooseCallback,
); );
}); });

View File

@ -30,7 +30,7 @@ class _MinePersonInfoResetPasswordPageState
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.resetPasswords!.tr, barTitle: TranslationLoader.lanKeys!.resetPasswords!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
@ -140,7 +140,7 @@ class _MinePersonInfoResetPasswordPageState
], ],
); );
view = F.sw( view = F.sw(
defaultCall: () => view, skyCall: () => view,
xhjCall: () => Container( xhjCall: () => Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 20.h, top: 20.h,

View File

@ -37,7 +37,7 @@ class _MinePersonInfoSetSafetyProblemPageState
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: F.sw(
defaultCall: () => TitleAppBar( skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.safetyProblem!.tr, barTitle: TranslationLoader.lanKeys!.safetyProblem!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
@ -137,7 +137,7 @@ class _MinePersonInfoSetSafetyProblemPageState
], ],
); );
view = F.sw( view = F.sw(
defaultCall: () => view, skyCall: () => view,
xhjCall: () => Container( xhjCall: () => Container(
margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w), margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w),
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@ -102,7 +102,7 @@ class MineSetLogic extends BaseGetXController {
UdpHelp().closeUDP(); UdpHelp().closeUDP();
logOut(); logOut();
BlueManage().disconnect(); BlueManage().disconnect();
XSJPushProvider().initLocalNotification(true); XSJPushProvider().initLocalNotification(isCancelLocalPush: true);
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false); Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
} }
} }

View File

@ -8,6 +8,7 @@ import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/flavors.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_logic.dart';
import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart';
import 'package:star_lock/tools/appFirstEnterHandle.dart'; import 'package:star_lock/tools/appFirstEnterHandle.dart';
import '../../../appRouters.dart'; import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
@ -18,15 +19,18 @@ import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
class MineSetPage extends StatefulWidget { 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 @override
State<MineSetPage> createState() => _MineSetPageState(); State<MineSetPage> createState() => _MineSetPageState();
} }
class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver { class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
final logic = Get.put(MineSetLogic()); final MineSetLogic logic = Get.put(MineSetLogic());
final state = Get.find<MineSetLogic>().state; final MineSetState state = Get.find<MineSetLogic>().state;
@override @override
void initState() { void initState() {
@ -53,8 +57,9 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: F.sw( appBar: widget.showAppBar
defaultCall: () => TitleAppBar( ? F.sw(
skyCall: () => TitleAppBar(
barTitle: TranslationLoader.lanKeys!.moreSet!.tr, barTitle: TranslationLoader.lanKeys!.moreSet!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
@ -65,7 +70,8 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
backgroundColor: Colors.white, backgroundColor: Colors.white,
iconColor: AppColors.blackColor, iconColor: AppColors.blackColor,
titleColor: AppColors.blackColor, titleColor: AppColors.blackColor,
)), ))
: null,
body: SingleChildScrollView( body: SingleChildScrollView(
child: styleHierarchy(), child: styleHierarchy(),
), ),
@ -76,8 +82,54 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
Widget styleHierarchy() { Widget styleHierarchy() {
Widget view = getListDataView(); Widget view = getListDataView();
view = F.sw( view = F.sw(
defaultCall: () => view, skyCall: () => view,
xhjCall: () => Container( 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( margin: EdgeInsets.only(
top: 20.h, left: 20.w, right: 20.w, bottom: 40.h), top: 20.h, left: 20.w, right: 20.w, bottom: 40.h),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -87,13 +139,16 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
borderRadius: BorderRadius.circular(20.r), borderRadius: BorderRadius.circular(20.r),
child: view, child: view,
), ),
),
F.sw(skyCall: () => const SizedBox(), xhjCall: keyBottomWidget),
],
)); ));
return view; return view;
} }
Widget getListDataView() { Widget getListDataView() {
return Column( return Column(
children: [ children: <Widget>[
/* 2024-01-12 by DaisyWu /* 2024-01-12 by DaisyWu
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.prompTone!.tr, leftTitel: TranslationLoader.lanKeys!.prompTone!.tr,
@ -114,29 +169,42 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
height: 50.h, height: 50.h,
child: Obx(() => _isTouchUnlockSwitch()))), 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( CommonItem(
leftTitel: TranslationLoader.lanKeys!.pushNotification!.tr, leftTitel: TranslationLoader.lanKeys!.pushNotification!.tr,
rightTitle: "", rightTitle: '',
isHaveRightWidget: true, isHaveRightWidget: true,
isHaveLine: F.appFlavor == Flavor.sky ? true : false, isHaveLine: F.sw(
skyCall: () => F.appFlavor == Flavor.sky, xhjCall: () => true),
rightWidget: SizedBox( rightWidget: SizedBox(
width: 60.w, width: 60.w,
height: 50.h, height: 50.h,
child: Obx(() => _isPushNotificationSwitch()))), child: Obx(_isPushNotificationSwitch))),
F.appFlavor == Flavor.sky if (F.appFlavor == Flavor.sky)
? CommonItem( CommonItem(
leftTitel: "微信公众号推送".tr, leftTitel: '微信公众号推送'.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: SizedBox( rightWidget: SizedBox(
width: 60.w, width: 60.w,
height: 50.h, height: 50.h,
child: Obx(() => _isWechatPublicAccountPushSwitch()))) child: Obx(_isWechatPublicAccountPushSwitch)))
: Container(), else
Container(),
SizedBox(height: 10.h), SizedBox(height: 10.h),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr, leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -144,7 +212,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr, leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -153,7 +221,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
//by DaisyWu -- //by DaisyWu --
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.authorityManagement!.tr, leftTitel: TranslationLoader.lanKeys!.authorityManagement!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -162,7 +230,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr, leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -170,7 +238,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.transferSmartLock!.tr, leftTitel: TranslationLoader.lanKeys!.transferSmartLock!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -178,7 +246,8 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr, leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.selectGetewayListPage); Get.toNamed(Routers.selectGetewayListPage);
@ -225,15 +294,16 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
action: () { action: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.hideInvalidUnlockPermissionsPage, context, Routers.hideInvalidUnlockPermissionsPage,
arguments: {'isOn': state.hideExpiredAccessFlag.value}) arguments: <String, int>{
.then((value) { 'isOn': state.hideExpiredAccessFlag.value
}).then((Object? value) {
logic.userSettingsInfoRequest(); logic.userSettingsInfoRequest();
}); });
})), })),
CommonItem( CommonItem(
leftTitel: TranslationLoader leftTitel: TranslationLoader
.lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr, .lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr,
rightTitle: "", rightTitle: '',
// allHeight: 100.h, // allHeight: 100.h,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
@ -245,41 +315,58 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
height: 10.h, height: 10.h,
), ),
// //
F.isLite if (!F.isLite)
? Container() CommonItem(
: CommonItem( leftTitel: 'Amazon Alexa',
leftTitel: "Amazon Alexa", rightTitle: '',
rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
logic.showToast("功能暂未开放".tr); logic.showToast('功能暂未开放'.tr);
}), }),
F.isLite if (!F.isLite)
? Container() CommonItem(
: CommonItem( leftTitel: 'Google Home',
leftTitel: "Google Home", rightTitle: '',
rightTitle: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
logic.showToast("功能暂未开放".tr); logic.showToast('功能暂未开放'.tr);
}), }),
F.isLite if (!F.isLite)
? Container() CommonItem(
: CommonItem(
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr, leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,
rightTitle: "", 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, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
logic.showToast("功能暂未开放".tr); Get.back();
}), Get.toNamed(Routers.aboutPage);
},
),
// CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){ // CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){
// //
// }), // }),
SizedBox( 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: (){ // CommonItem(leftTitel:TranslationLoader.lanKeys!.about!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
// //
@ -300,23 +387,26 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
// CommonItem(leftTitel:TranslationLoader.lanKeys!.thirdPartyInformationSharingList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){ // CommonItem(leftTitel:TranslationLoader.lanKeys!.thirdPartyInformationSharingList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){
// //
// }), // }),
keyBottomWidget() F.sw(skyCall: keyBottomWidget, xhjCall: () => const SizedBox())
], ],
); );
} }
Widget keyBottomWidget() { Widget keyBottomWidget() {
return Column( return Padding(
children: [ padding: F.sw(
skyCall: () => EdgeInsets.zero,
xhjCall: () => EdgeInsets.symmetric(horizontal: 15.w)),
child: Column(
children: <Widget>[
SubmitBtn( SubmitBtn(
btnName: TranslationLoader.lanKeys!.logout!.tr, btnName: TranslationLoader.lanKeys!.logout!.tr,
isDelete: true, isDelete: true,
padding: EdgeInsets.symmetric(horizontal: 15.w), padding: EdgeInsets.symmetric(horizontal: 15.w),
onClick: () { onClick: () {
//退 //退
ShowTipView().showIosTipWithContentDialog("确定要退出吗?".tr, () { ShowTipView().showIosTipWithContentDialog(
logic.userLogoutRequest(); '确定要退出吗?'.tr, logic.userLogoutRequest);
});
// showLoginOutAlertTipDialog(); // showLoginOutAlertTipDialog();
}), }),
Container( Container(
@ -324,7 +414,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
// color: Colors.red, // color: Colors.red,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: <Widget>[
TextButton( TextButton(
child: Text( child: Text(
TranslationLoader.lanKeys!.deleteAccount!.tr, TranslationLoader.lanKeys!.deleteAccount!.tr,
@ -346,6 +436,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
height: 30.h, height: 30.h,
) )
], ],
),
); );
} }
@ -411,7 +502,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isPrompTone.value, value: state.isPrompTone.value,
onChanged: (value) { onChanged: (bool value) {
state.isPrompTone.value = !state.isPrompTone.value; state.isPrompTone.value = !state.isPrompTone.value;
logic.updatePrompToneRequest(); logic.updatePrompToneRequest();
}, },
@ -424,7 +515,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isTouchUnlock.value, value: state.isTouchUnlock.value,
onChanged: (value) { onChanged: (bool value) {
state.isTouchUnlock.value = !state.isTouchUnlock.value; state.isTouchUnlock.value = !state.isTouchUnlock.value;
logic.updateTouchUnlockRequest(); logic.updateTouchUnlockRequest();
}, },
@ -438,7 +529,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isWechatPublicAccountPush.value, value: state.isWechatPublicAccountPush.value,
onChanged: (value) { onChanged: (bool value) {
state.isWechatPublicAccountPush.value = state.isWechatPublicAccountPush.value =
!state.isWechatPublicAccountPush.value; !state.isWechatPublicAccountPush.value;
logic.setMpWechatPushSwitchRequest(context); logic.setMpWechatPushSwitchRequest(context);
@ -452,7 +543,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isPushNotification.value, value: state.isPushNotification.value,
onChanged: (value) { onChanged: (bool value) {
// state.isPushNotification.value = !state.isPushNotification.value; // state.isPushNotification.value = !state.isPushNotification.value;
openAppSettings(); openAppSettings();
}, },
@ -474,7 +565,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
IOSFlutterLocalNotificationsPlugin>() IOSFlutterLocalNotificationsPlugin>()
?.requestPermissions( ?.requestPermissions(
alert: true, alert: true,
badge: true, badge: false,
sound: true, sound: true,
) ?? ) ??
false; false;

View File

@ -26,7 +26,7 @@ class BaseProvider extends GetConnect with Api {
Future<Response<T>> post<T>( Future<Response<T>> post<T>(
String? url, String? url,
body, { body, {
String? contentType = "application/json", String? contentType = 'application/json',
Map<String, String>? headers, Map<String, String>? headers,
Map<String, dynamic>? query, Map<String, dynamic>? query,
Decoder<T>? decoder, Decoder<T>? decoder,
@ -35,7 +35,7 @@ class BaseProvider extends GetConnect with Api {
bool? isUnShowLoading = false, // loading bool? isUnShowLoading = false, // loading
bool? isUserBaseUrl = true, // 使baseUrl bool? isUserBaseUrl = true, // 使baseUrl
}) async { }) async {
AppLog.log("post: url:$url body:$body"); AppLog.log('post: url:$url body:$body');
if (isUnShowLoading == false){ if (isUnShowLoading == false){
EasyLoading.show(); EasyLoading.show();
} }
@ -55,14 +55,14 @@ class BaseProvider extends GetConnect with Api {
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
if (res.statusCode == null) { if (res.statusCode == null) {
EasyLoading.showToast("网络访问失败,请检查网络是否正常".tr, duration: 2000.milliseconds); EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds);
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
} }
var rs = { var rs = {
"errorMsg": "Network Error!", 'errorMsg': 'Network Error!',
"errorCode": -1, 'errorCode': -1,
"data": null, 'data': null,
"description": "表示成功或是。" 'description': '表示成功或是。'
}; };
return Response( return Response(
request: res.request, request: res.request,
@ -78,24 +78,24 @@ class BaseProvider extends GetConnect with Api {
} }
getDataResult(T) { getDataResult(T) {
switch (T["errorCode"]) { switch (T['errorCode']) {
case 403: case 403:
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false); Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
break; break;
case 500: case 500:
EasyLoading.showToast("服务器错误", duration: 2000.milliseconds); EasyLoading.showToast('服务器错误', duration: 2000.milliseconds);
break; break;
case 421: case 421:
case 422: case 422:
case 430: //ErrorMsg case 430: //ErrorMsg
EasyLoading.showToast(T["errorMsg"], duration: 2000.milliseconds); EasyLoading.showToast(T['errorMsg'], duration: 2000.milliseconds);
break; break;
// //
// case 425: // case 425:
// Toast.show(msg: "用户不存在"); // Toast.show(msg: "用户不存在");
// break; // break;
case 10001: case 10001:
EasyLoading.showToast("数据不存在", duration: 2000.milliseconds); EasyLoading.showToast('数据不存在', duration: 2000.milliseconds);
break; break;
} }
} }

View File

@ -42,20 +42,20 @@ class _StarLockApplicationState extends State<StarLockApplication> {
if (snapshot.data!) { if (snapshot.data!) {
// //
return F.sw( return F.sw(
defaultCall: () => StarLockMainPage(), skyCall: () => StarLockMainPage(),
xhjCall: () => const StarLockMainXHJPage()); xhjCall: () => const StarLockMainXHJPage());
} else { } else {
// //
AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy); AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy);
return F.sw( return F.sw(
defaultCall: () => const StarLockLoginPage(), skyCall: () => const StarLockLoginPage(),
xhjCall: () => const StarLockLoginXHJPage()); xhjCall: () => const StarLockLoginXHJPage());
} }
} else { } else {
// //
return F.sw( return F.sw(
defaultCall: () => const StarLockLoginPage(), skyCall: () => const StarLockLoginPage(),
xhjCall: () => const StarLockLoginXHJPage()); xhjCall: () => const StarLockLoginXHJPage());
} }
}, },

View File

@ -51,7 +51,7 @@ class AppFirstEnterHandle {
return PopScope( return PopScope(
canPop: false, canPop: false,
child: F.sw( child: F.sw(
defaultCall: () => _defaultPrivacyAgreementAlert(context), skyCall: () => _defaultPrivacyAgreementAlert(context),
xhjCall: () => _xhjPrivacyAgreementAlert(context))); xhjCall: () => _xhjPrivacyAgreementAlert(context)));
}, },
); );

View File

@ -123,7 +123,7 @@ class _LoginInputState extends State<LoginInput> {
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: top:
F.sw(defaultCall: () => 27.h, xhjCall: () => 39.h)), F.sw(skyCall: () => 27.h, xhjCall: () => 39.h)),
child: Text( child: Text(
pwd, pwd,
style: TextStyle( style: TextStyle(

View File

@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:jpush_flutter/jpush_flutter.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/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
@ -12,63 +13,72 @@ import '../app_settings/app_settings.dart';
class XSJPushProvider { class XSJPushProvider {
final JPush jpush = JPush(); final JPush jpush = JPush();
// appKey: 251fc8074820d122b6de58d2--AppKey
// appKey: 7ff37d174c1a568a89e98dad--sky
Future<void> initJPushService() async { Future<void> initJPushService() async {
final data = await Storage.getString(saveUserLoginData); final String? data = await Storage.getString(saveUserLoginData);
if (data != null && data.isNotEmpty) { if (data == null || data.isEmpty) {
AppLog.log('No user data found.');
return;
}
jpush.setup( jpush.setup(
appKey: "7ff37d174c1a568a89e98dad", appKey: '251fc8074820d122b6de58d2',
channel: "flutter_channel", channel: 'flutter_channel',
production: false, production: false,
debug: false, debug: true,
); );
jpush.addEventHandler( jpush.addEventHandler(
//
onReceiveNotification: (Map<String, dynamic> message) async { onReceiveNotification: (Map<String, dynamic> message) async {
AppLog.log("flutter onReceiveNotification: $message"); AppLog.log('flutter onReceiveNotification: $message');
}, },
//
onOpenNotification: (Map<String, dynamic> message) async { onOpenNotification: (Map<String, dynamic> message) async {
AppLog.log("flutter onOpenNotification: $message"); AppLog.log('flutter onOpenNotification: $message');
}, },
//
onReceiveMessage: (Map<String, dynamic> message) async { onReceiveMessage: (Map<String, dynamic> message) async {
AppLog.log("flutter onReceiveMessage: $message"); AppLog.log('flutter onReceiveMessage: $message');
}, },
); );
jpush.applyPushAuthority( jpush.applyPushAuthority(
const NotificationSettingsIOS(sound: true, alert: true, badge: true)); const NotificationSettingsIOS(sound: true, alert: true, badge: false),
// jpush.setChannelAndSound(
// channel: "flutter_channel", channelID: "115700", sound: "default");
// 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);
}); 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 { Future<void> pushBindDeviceID(String deviceID, int deviceType) async {
var entity = await ApiRepository.to.pushBindAppId(deviceID, deviceType); try {
final MineUnbindPhoneOrEmailEntity entity =
await ApiRepository.to.pushBindAppId(deviceID, deviceType);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
AppLog.log("绑定成功"); AppLog.log('绑定成功');
} else {
AppLog.log('绑定失败');
}
} catch (e) {
AppLog.log('Error binding device ID: $e');
} }
} }
// isCancelLocalPush // isCancelLocalPush
initLocalNotification(bool isCancelLocalPush) async { Future<void> initLocalNotification({required bool isCancelLocalPush}) async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin(); FlutterLocalNotificationsPlugin();
if (Platform.isAndroid) {
const AndroidInitializationSettings initializationSettingsAndroid = const AndroidInitializationSettings initializationSettingsAndroid =
AndroidInitializationSettings('app_icon'); AndroidInitializationSettings('app_icon');
if (Platform.isAndroid) {
const InitializationSettings initializationSettings = const InitializationSettings initializationSettings =
InitializationSettings(android: initializationSettingsAndroid); InitializationSettings(android: initializationSettingsAndroid);
await flutterLocalNotificationsPlugin.initialize(initializationSettings); await flutterLocalNotificationsPlugin.initialize(initializationSettings);

View File

@ -56,8 +56,11 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.46+2024052004打包给公司测试 # 1.0.46+2024052004打包给公司测试
# 1.0.47+2024052101打包给欧阳回归测试 # 1.0.47+2024052101打包给欧阳回归测试
# 1.0.48+2024052201打包给欧阳回归测试 # 1.0.48+2024052201打包给欧阳回归测试
# 1.0.49+2024052401xhj UI ,预发布环境
# 1.0.50+2024052701xhj UI ,预发布环境
# 1.0.51+2024052801xhj 线上环境,提审
version: 1.0.48+2024052201 version: 1.0.51+2024052801
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
@ -126,7 +129,7 @@ dependencies:
url_launcher: ^6.1.10 url_launcher: ^6.1.10
#蓝牙 #蓝牙
# flutter_reactive_ble: ^5.1.1 # flutter_reactive_ble: ^5.1.1
flutter_blue_plus: 1.31.16 flutter_blue_plus: 1.32.7
# #
event_bus: ^2.0.0 event_bus: ^2.0.0
#菊花 #菊花