diff --git a/.DS_Store b/.DS_Store index a15ea279..612ce635 100755 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/android/app/build.gradle b/android/app/build.gradle index 3d910105..5e2bb17a 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -27,6 +27,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply plugin: 'com.android.application' apply plugin: 'android-junk-code' +apply plugin: 'com.huawei.agconnect' androidJunkCode { variantConfig { @@ -51,10 +52,14 @@ android { // 这里“debug”不是一个自定义变量,而是一个特定的关键词,凡是使用--debug模式,都会引用到这里 // 目前看来,debug模式没办法在buildTypes里面按flavors指定编译签名,所有口味的debug模式只能用同一个签名 debug { - storeFile file("starlock.keystore") - storePassword '123456' - keyAlias = 'starlock' - keyPassword '123456' + // storeFile file("starlock.keystore") + // storePassword '123456' + // keyAlias = 'starlock' + // keyPassword '123456' + storeFile file("xhj.jks") + storePassword 'xhj8872' + keyAlias = 'upload' + keyPassword 'xhj8872' } sky { // CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown @@ -161,13 +166,23 @@ android { manifestPlaceholders = [ JPUSH_PKGNAME : "这里不重要,在口味配置", //JPush 上注册的包名对应的 Appkey. - JPUSH_APPKEY : "7ff37d174c1a568a89e98dad", - //暂时填写默认值即可. + // JPUSH_APPKEY : "7ff37d174c1a568a89e98dad",//--skyAppKey + JPUSH_APPKEY : "251fc8074820d122b6de58d2",//--鑫泓佳AppKey JPUSH_CHANNEL : "flutter_channel", //若不集成厂商通道,可直接跳过以下配置 - XIAOMI_APPID : "MI-2882303761520287291", - XIAOMI_APPKEY : "MI-5352028744291", + //以下为sky的配置 + // XIAOMI_APPID : "MI-2882303761520287291", + // XIAOMI_APPKEY : "MI-5352028744291", + //以下均为鑫泓佳的配置 + XIAOMI_APPID : "MI-2882303761520314939", + XIAOMI_APPKEY : "MI-5312031456939", + OPPO_APPKEY : "OP-47f668c9943248118502aa58d066393b", + OPPO_APPID : "OP-31726001", + OPPO_APPSECRET : "OP-05723986bba64183a71530b496922450", + // VIVO_APPKEY : "vivo的APPKEY", + // VIVO_APPID : "vivo的APPID", + HONOR_APPID : "110798531", ] splits { abi { @@ -208,7 +223,10 @@ dependencies { implementation('com.amap.api:3dmap:8.1.0') implementation 'cn.jiguang.sdk:jpush:5.2.3' + // 接入华为厂商 + implementation 'com.huawei.agconnect:agconnect-core:1.8.1.300' implementation 'com.huawei.hms:push:6.12.0.300' + implementation 'cn.jiguang.sdk.plugin:huawei:5.2.3' implementation 'cn.jiguang.sdk.plugin:xiaomi:5.2.3' } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 24086c3f..e8e4248a 100755 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -54,6 +54,12 @@ + + diff --git a/android/app/src/xhj/agconnect-services.json b/android/app/src/xhj/agconnect-services.json new file mode 100644 index 00000000..52e91d21 --- /dev/null +++ b/android/app/src/xhj/agconnect-services.json @@ -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" + } + } + ] +} \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 2c4a5982..44ee774e 100755 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,10 +1,13 @@ buildscript { ext.kotlin_version = '1.8.20' repositories { + maven { url 'https://maven.aliyun.com/repository/public'} + maven { url 'https://maven.aliyun.com/repository/gradle-plugin'} google() mavenCentral() mavenLocal() // hms, 若不集成华为厂商通道,可直接跳过 +// maven { url 'https://maven.aliyun.com/repository/central'} maven { url 'https://developer.huawei.com/repo/'} // fcm, 若不集成 FCM 通道,可直接跳过 maven { url "https://maven.google.com" } @@ -25,6 +28,8 @@ buildscript { allprojects { repositories { + maven { url 'https://maven.aliyun.com/repository/public'} + maven { url 'https://maven.aliyun.com/repository/gradle-plugin'} google() mavenCentral() jcenter() diff --git a/lib/appRouters.dart b/lib/appRouters.dart index 77b769b3..e7edb548 100755 --- a/lib/appRouters.dart +++ b/lib/appRouters.dart @@ -197,885 +197,884 @@ import 'starLockApplication/starLockApplication.dart'; import 'tools/seletKeyCyclicDate/seletKeyCyclicDate_page.dart'; abstract class Routers { - static const initial = '/'; // 加载页 - static const starLockMain = '/StarLockMain'; // 首页 - static const starLockMinePage = '/StarLockMinePage'; // 我的 - static const selectLockTypePage = '/SelectLockTypePage'; // 选择锁类型 - static const lockMallPage = '/LockMallPage'; // 商城页面 - static const addLockPage = '/AddLockPage'; // 选择锁类型 - static const nearbyLockPage = '/NearbyLockPage'; // 附近的锁 - static const lockAddressPage = '/LockAddressPage'; // 锁地址 - static const lockAddressGaoDePage = '/LockAddressGaoDePage'; // 锁地址-高德 - static const saveLockPage = '/SaveLockPage'; // 保存锁 - static const lockDetailMainPage = '/LockDetailMainPage'; // 锁详情 - static const electronicKeyListPage = '/ElectronicKeyListPage'; // 电子钥匙列表 - static const electronicKeyDetailPage = '/ElectronicKeyDetailPage'; // 电子钥匙详情 - static const electronicKeyDetailChangeDate = + static const String initial = '/'; // 加载页 + static const String starLockMain = '/StarLockMain'; // 首页 + static const String starLockMinePage = '/StarLockMinePage'; // 我的 + static const String selectLockTypePage = '/SelectLockTypePage'; // 选择锁类型 + static const String lockMallPage = '/LockMallPage'; // 商城页面 + static const String addLockPage = '/AddLockPage'; // 选择锁类型 + static const String nearbyLockPage = '/NearbyLockPage'; // 附近的锁 + static const String lockAddressPage = '/LockAddressPage'; // 锁地址 + static const String lockAddressGaoDePage = '/LockAddressGaoDePage'; // 锁地址-高德 + static const String saveLockPage = '/SaveLockPage'; // 保存锁 + static const String lockDetailMainPage = '/LockDetailMainPage'; // 锁详情 + static const String electronicKeyListPage = '/ElectronicKeyListPage'; // 电子钥匙列表 + static const String electronicKeyDetailPage = '/ElectronicKeyDetailPage'; // 电子钥匙详情 + static const String electronicKeyDetailChangeDate = '/ElectronicKeyDetailChangeDate'; // 修改有效期 - static const sendElectronicKeyPage = '/SendElectronicKeyPage'; // 发送电子钥匙 - static const massSendElectronicKeyManagePage = + static const String sendElectronicKeyPage = '/SendElectronicKeyPage'; // 发送电子钥匙 + static const String massSendElectronicKeyManagePage = '/MassSendElectronicKeyManagePage'; // 群发钥匙 - static const electronicKeyPeriodValidityPage = + static const String electronicKeyPeriodValidityPage = '/ElectronicKeyPeriodValidityPage'; // 电子钥匙有效期 - static const sendEmailNotificationPage = '/SendEmailNotificationPage'; // 邮件通知 - static const passwordKeyListPage = '/PasswordKeyListPage'; // 密码钥匙列表 - static const passwordKeyPerpetualPage = '/PasswordKeyPerpetualPage'; // 密码钥匙 - static const passwordKeyDetailPage = '/PasswordKeyDetailPage'; // 密码钥匙详情 + static const String sendEmailNotificationPage = '/SendEmailNotificationPage'; // 邮件通知 + static const String passwordKeyListPage = '/PasswordKeyListPage'; // 密码钥匙列表 + static const String passwordKeyPerpetualPage = '/PasswordKeyPerpetualPage'; // 密码钥匙 + static const String passwordKeyDetailPage = '/PasswordKeyDetailPage'; // 密码钥匙详情 // static const otherTypeKeyListPage = '/OtherTypeKeyListPage'; // 卡、指纹、遥控钥匙列表 // static const otherTypeKeyDetailPage = '/OtherTypeKeyDetailPage'; // 卡、指纹、遥控钥匙详情 // static const otherTypeKeyManagePage = '/OtherTypeKeyManagePage'; // 卡、指纹、遥控钥匙添加 - static const otherTypeKeyChangeDatePage = + static const String otherTypeKeyChangeDatePage = '/OtherTypeKeyChangeDatePage'; // 卡、指纹、遥控钥匙详情修改日期 - static const otherTypeKeyChangeValidityDatePage = + static const String otherTypeKeyChangeValidityDatePage = '/OtherTypeKeyChangeValidityDatePage'; // 卡、指纹、遥控钥匙详情修改有效期 - static const addFingerprintTipPage = '/AddFingerprintTipPage'; // 添加指纹提示 - static const addFingerprintPage = '/AddFingerprintPage'; // 添加指纹 - static const addICCardPage = '/AddICCardPage'; // 添加卡 + static const String addFingerprintTipPage = '/AddFingerprintTipPage'; // 添加指纹提示 + static const String addFingerprintPage = '/AddFingerprintPage'; // 添加指纹 + static const String addICCardPage = '/AddICCardPage'; // 添加卡 - static const authorizedAdminListPage = '/AuthorizedAdminListPage'; // 授权管理员列表 - static const authorizedAdminDetailPage = + static const String authorizedAdminListPage = '/AuthorizedAdminListPage'; // 授权管理员列表 + static const String authorizedAdminDetailPage = '/AuthorizedAdminDetailPage'; // 授权管理员详情 - static const authorizedAdminPage = '/AuthorizedAdminPage'; // 授权管理员 - static const volumeAuthorizationLockManagePage = + static const String authorizedAdminPage = '/AuthorizedAdminPage'; // 授权管理员 + static const String volumeAuthorizationLockManagePage = '/VolumeAuthorizationLockManagePage'; // 批量授权锁 - static const lockOperatingRecordPage = '/LockOperatingRecordPage'; // 操作记录 - static const lockSetPage = '/LockSetPage'; // 锁设置 - static const basicInformationPage = '/BasicInformationPage'; // 基本信息 - static const uploadElectricQuantityPage = + static const String lockOperatingRecordPage = '/LockOperatingRecordPage'; // 操作记录 + static const String lockSetPage = '/LockSetPage'; // 锁设置 + static const String basicInformationPage = '/BasicInformationPage'; // 基本信息 + static const String uploadElectricQuantityPage = '/UploadElectricQuantityPage'; // 更新锁电量 - static const editLockNamePage = '/EditLockNamePage'; // 修改锁名字 - static const lockSelectGroupingPage = '/LockSelectGroupingPage'; // 锁选择分组 - static const groupEditLockPage = '/GroupEditLockPage'; // 编辑锁分组里面的锁 - static const adminOpenLockPasswordPage = + static const String editLockNamePage = '/EditLockNamePage'; // 修改锁名字 + static const String lockSelectGroupingPage = '/LockSelectGroupingPage'; // 锁选择分组 + static const String groupEditLockPage = '/GroupEditLockPage'; // 编辑锁分组里面的锁 + static const String adminOpenLockPasswordPage = '/AdminOpenLockPasswordPage'; // 管理员开锁密码 - static const wirelessKeyboardPage = '/WirelessKeyboardPage'; // 蓝牙键盘 - static const addWirelessKeyboardPage = '/AddWirelessKeyboardPage'; // 添加蓝牙键盘 - static const addWirelessKeyboardScreenNotLightOnPage = + static const String wirelessKeyboardPage = '/WirelessKeyboardPage'; // 蓝牙键盘 + static const String addWirelessKeyboardPage = '/AddWirelessKeyboardPage'; // 添加蓝牙键盘 + static const String addWirelessKeyboardScreenNotLightOnPage = '/AddWirelessKeyboardScreenNotLightOnPage'; // 添加蓝牙键盘屏幕不亮时提示 - static const selectWirelessKeyboardPage = + static const String selectWirelessKeyboardPage = '/SelectWirelessKeyboardPage'; // 选择蓝牙键盘 - static const doorMagneticPage = '/DoorMagneticPage'; // 门磁列表 - static const addDoorMagneticPage = '/AddDoorMagneticPage'; // 添加门磁 - static const nearbyDoorMagneticPage = '/NearbyDoorMagneticPage'; // 附近的门磁 - static const remoteUnlockingPage = '/RemoteUnlockingPage'; // 远程开锁 - static const automaticBlockingPage = '/AutomaticBlockingPage'; // 自动闭锁 - static const normallyOpenModePage = '/NormallyOpenModePage'; // 常开模式 - static const lockSoundSetPage = '/LockSoundSetPage'; // 锁声音 - static const burglarAlarmPage = '/BurglarAlarmPage'; // 防撬警报 - static const resetButtonPage = '/ResetButtonPage'; // 锁重置键 - static const unlockQRCodePage = '/UnlockQRCodePage'; // 开锁二维码 - static const wifiListPage = '/WifiListPage'; // WiFi列表 - static const configuringWifiPage = '/ConfiguringWifiPage'; // 配置WiFi - static const lockTimePage = '/LockTimePage'; // 锁时间 - static const diagnosePage = '/DiagnosePage'; // 诊断 - static const uploadDataPage = '/UploadDataPage'; // 上传数据 - static const importOtherLockDataPage = '/ImportOtherLockDataPage'; // 导入其他锁数据 - static const lockEscalationPage = '/LockEscalationPage'; // 锁升级 - static const markedHouseStatePage = '/MarkedHouseStatePage'; // 标记房态 - static const checkInCreatCompanyPage = '/CheckInCreatCompanyPage'; // 创建公司 - static const checkingInListPage = '/CheckingInListPage'; // 考勤 - static const checkingInSetPage = '/CheckingInSetPage'; // 考勤设置 - static const checkingInStaffManagePage = '/CheckingInStaffManagePage'; // 员工管理 - static const checkingInAddStaffPage = '/CheckingInAddStaffPage'; // 添加员工 - static const checkingInStaffDetailPage = '/CheckingInStaffDetailPage'; // 编辑员工 - static const checkingInSetWorkTimePage = + static const String doorMagneticPage = '/DoorMagneticPage'; // 门磁列表 + static const String addDoorMagneticPage = '/AddDoorMagneticPage'; // 添加门磁 + static const String nearbyDoorMagneticPage = '/NearbyDoorMagneticPage'; // 附近的门磁 + static const String remoteUnlockingPage = '/RemoteUnlockingPage'; // 远程开锁 + static const String automaticBlockingPage = '/AutomaticBlockingPage'; // 自动闭锁 + static const String normallyOpenModePage = '/NormallyOpenModePage'; // 常开模式 + static const String lockSoundSetPage = '/LockSoundSetPage'; // 锁声音 + static const String burglarAlarmPage = '/BurglarAlarmPage'; // 防撬警报 + static const String resetButtonPage = '/ResetButtonPage'; // 锁重置键 + static const String unlockQRCodePage = '/UnlockQRCodePage'; // 开锁二维码 + static const String wifiListPage = '/WifiListPage'; // WiFi列表 + static const String configuringWifiPage = '/ConfiguringWifiPage'; // 配置WiFi + static const String lockTimePage = '/LockTimePage'; // 锁时间 + static const String diagnosePage = '/DiagnosePage'; // 诊断 + static const String uploadDataPage = '/UploadDataPage'; // 上传数据 + static const String importOtherLockDataPage = '/ImportOtherLockDataPage'; // 导入其他锁数据 + static const String lockEscalationPage = '/LockEscalationPage'; // 锁升级 + static const String markedHouseStatePage = '/MarkedHouseStatePage'; // 标记房态 + static const String checkInCreatCompanyPage = '/CheckInCreatCompanyPage'; // 创建公司 + static const String checkingInListPage = '/CheckingInListPage'; // 考勤 + static const String checkingInSetPage = '/CheckingInSetPage'; // 考勤设置 + static const String checkingInStaffManagePage = '/CheckingInStaffManagePage'; // 员工管理 + static const String checkingInAddStaffPage = '/CheckingInAddStaffPage'; // 添加员工 + static const String checkingInStaffDetailPage = '/CheckingInStaffDetailPage'; // 编辑员工 + static const String checkingInSetWorkTimePage = '/CheckingInSetWorkTimePage'; // 工作时间设置 - static const checkingInSetWorkdaySet = '/CheckingInSetWorkdaySet'; // 工作日设置 - static const checkingInSetHolidaysPage = + static const String checkingInSetWorkdaySet = '/CheckingInSetWorkdaySet'; // 工作日设置 + static const String checkingInSetHolidaysPage = '/CheckingInSetHolidaysPage'; // 节假日设置 - static const checkingInAddHolidaysPage = '/CheckingInAddHolidaysPage'; // 添加假日 - static const checkingInDetailPage = '/CheckingInDetailPage'; // 考勤详情 - static const checkingInDeletHolidaysPage = + static const String checkingInAddHolidaysPage = '/CheckingInAddHolidaysPage'; // 添加假日 + static const String checkingInDetailPage = '/CheckingInDetailPage'; // 考勤详情 + static const String checkingInDeletHolidaysPage = '/CheckingInDeletHolidaysPage'; // 删除考勤 - static const mineSetPage = '/MineSetPage'; // 我的设置 - static const mineMultiLanguagePage = '/MineMultiLanguagePage'; // 我的设置 - static const minePersonInfoPage = '/MinePersonInfoPage'; // 我的信息 - static const minePersonInfoEditNamePage = + static const String mineSetPage = '/MineSetPage'; // 我的设置 + static const String mineMultiLanguagePage = '/MineMultiLanguagePage'; // 我的设置 + static const String minePersonInfoPage = '/MinePersonInfoPage'; // 我的信息 + static const String minePersonInfoEditNamePage = '/MinePersonInfoEditNamePage'; // 我的信息编辑昵称 - static const mineUnbindPhoneOrEmailPage = + static const String mineUnbindPhoneOrEmailPage = '/MineUnbindPhoneOrEmailPage'; // 我的信息修改账号-解绑 - static const minePersonInfoEditAccountNextPage = + static const String minePersonInfoEditAccountNextPage = '/MinePersonInfoEditAccountNextPage'; // 我的信息修改账号下一页 - static const minePersonInfoEditIphonePage = + static const String minePersonInfoEditIphonePage = '/MinePersonInfoEditIphonePage'; // 我的信息修改手机号 - static const minePersonInfoResetPasswordPage = + static const String minePersonInfoResetPasswordPage = '/MinePersonInfoResetPasswordPage'; // 我的信息重置密码 - static const minePersonInfoSetSafetyProblemPage = + static const String minePersonInfoSetSafetyProblemPage = '/MinePersonInfoSetSafetyProblemPage'; // 我的信息设置安全问题 - static const minePersonInfoViewSafetyProblemPage = + static const String minePersonInfoViewSafetyProblemPage = '/MinePersonInfoViewSafetyProblemPage'; // 查看我的安全问题 - static const mineBindPhoneOrEmailPage = '/MineBindPhoneOrEmailPage'; //我的信息-邮箱 + static const String mineBindPhoneOrEmailPage = '/MineBindPhoneOrEmailPage'; //我的信息-邮箱 - static const gatewayListPage = '/GatewayListPage'; // 我的-网关 - static const gatewayDetailPage = '/GatewayDetailPage'; // 我的-网关详情 - static const gatewayConnectionLockPage = + static const String gatewayListPage = '/GatewayListPage'; // 我的-网关 + static const String gatewayDetailPage = '/GatewayDetailPage'; // 我的-网关详情 + static const String gatewayConnectionLockPage = '/GatewayConnectionLockPage'; // 我的-网关网关链接的锁 - static const selectGatewayTypePage = '/SelectGatewayTypePage'; // 我的-选择网关类型 - static const selectGatewayTypeNextTipPage = + static const String selectGatewayTypePage = '/SelectGatewayTypePage'; // 我的-选择网关类型 + static const String selectGatewayTypeNextTipPage = '/SelectGatewayTypeNextTipPage'; // 我的-选择网关类型下一步 - static const selectGatewayPage = '/SelectGatewayPage'; // 我的-选择网关 - static const gatewayConfigurationWifiPage = + static const String selectGatewayPage = '/SelectGatewayPage'; // 我的-选择网关 + static const String gatewayConfigurationWifiPage = '/GatewayConfigurationWifiPage'; // 我的-网关配置wifi - static const messageListPage = '/MessageListPage'; // 我的-消息 - static const messageDetailPage = '/MessageDetailPage'; // 我的-消息详情 - static const supportStaffPage = '/SupportStaffPage'; // 我的-客服 - static const valueAddedServicesPage = '/ValueAddedServicesPage'; // 我的-增值服务 - static const aboutPage = '/AboutPage'; // 我的-关于 + static const String messageListPage = '/MessageListPage'; // 我的-消息 + static const String messageDetailPage = '/MessageDetailPage'; // 我的-消息详情 + static const String supportStaffPage = '/SupportStaffPage'; // 我的-客服 + static const String valueAddedServicesPage = '/ValueAddedServicesPage'; // 我的-增值服务 + static const String aboutPage = '/AboutPage'; // 我的-关于 - static const valueAddedServicesNoteAndEmailDetailPage = + static const String valueAddedServicesNoteAndEmailDetailPage = '/ValueAddedServicesNoteAndEmailDetailPage'; // 增值服务-短信邮件详情 - static const valueAddedServicesRealNamePage = + static const String valueAddedServicesRealNamePage = '/ValueAddedServicesRealNamePage'; // 增值服务-实名认证详情 - static const valueAddedServicesRecordPage = + static const String valueAddedServicesRecordPage = '/valueAddedServicesRecordPage'; // 增值服务-记录 - static const valueAddedServicesHighFunctionPage = + static const String valueAddedServicesHighFunctionPage = '/ValueAddedServicesHighFunctionPage'; // 增值服务-高级功能 - static const valueAddedServicesBuyPage = + static const String valueAddedServicesBuyPage = '/ValueAddedServicesBuyPage'; // 增值服务-购买服务 - static const valueAddedServicesListSMSTemplatePage = + static const String valueAddedServicesListSMSTemplatePage = '/ValueAddedServicesListSMSTemplatePage'; // 增值服务-短信模版列表 - static const valueAddedServicesAddSMSTemplatePage = + static const String valueAddedServicesAddSMSTemplatePage = '/valueAddedServicesAddSMSTemplatePage'; // 增值服务-自定义短信模版 - static const valueAddedServicesListEmailTemplatePage = + static const String valueAddedServicesListEmailTemplatePage = '/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表 - static const valueAddedServicesAddEmailTemplatePage = + static const String valueAddedServicesAddEmailTemplatePage = '/ValueAddedServicesAddEmailTemplatePage'; // 增值服务-自定义邮箱模版 - static const valueAddedServicesBuyAndUseRecordManagePage = + static const String valueAddedServicesBuyAndUseRecordManagePage = '/ValueAddedServicesBuyAndUseRecordManagePage'; // 增值服务-购买使用记录 - static const lockScreenPage = '/LockScreenPage'; // 我的设置-锁屏 - static const aPPUnlockNeedMobileNetworkingLockPage = + static const String lockScreenPage = '/LockScreenPage'; // 我的设置-锁屏 + static const String aPPUnlockNeedMobileNetworkingLockPage = '/APPUnlockNeedMobileNetworkingLockPage'; // 我的设置-app开锁时需手机连网的锁 - static const hideInvalidUnlockPermissionsPage = + static const String hideInvalidUnlockPermissionsPage = '/HideInvalidUnlockPermissionsPage'; // 我的设置-隐藏无效开锁权限 - static const lockUserManageLisPage = '/LockUserManageLisPage'; //我的设置-锁用户管理 - static const authorizedAdministratorListPage = + static const String lockUserManageLisPage = '/LockUserManageLisPage'; //我的设置-锁用户管理 + static const String authorizedAdministratorListPage = '/AuthorizedAdministratorListPage'; //我的设置-授权管理员 - static const lockGroupListPage = '/LockGroupListPage'; //我的设置-锁分组 - static const lockItemListPage = '/LockItemListPage'; //锁分组-锁列表 - static const transferSmartLockPage = '/transferSmartLockPage'; //转移智能锁 - static const recipientInformationPage = '/recipientInformationPage'; //接受人信息 - static const selectBranchPage = '/SelectBranchPage'; //选择分店 - static const selectGetewayListPage = '/selectGetewayListPage'; //选择网关 - static const addAuthorizedAdministratorPage = + static const String lockGroupListPage = '/LockGroupListPage'; //我的设置-锁分组 + static const String lockItemListPage = '/LockItemListPage'; //锁分组-锁列表 + static const String transferSmartLockPage = '/transferSmartLockPage'; //转移智能锁 + static const String recipientInformationPage = '/recipientInformationPage'; //接受人信息 + static const String selectBranchPage = '/SelectBranchPage'; //选择分店 + static const String selectGetewayListPage = '/selectGetewayListPage'; //选择网关 + static const String addAuthorizedAdministratorPage = '/addAuthorizedAdministratorPage'; //添加授权管理员 - static const ownedKeyListPage = '/ownedKeyListPage'; //拥有的钥匙 + static const String ownedKeyListPage = '/ownedKeyListPage'; //拥有的钥匙 - static const starLockLoginPage = '/StarLockLoginPage'; // 登录 - static const starLockRegisterPage = '/StarLockRegisterPage'; // 注册 - static const starLockForgetPasswordPage = + static const String starLockLoginPage = '/StarLockLoginPage'; // 登录 + static const String starLockRegisterPage = '/StarLockRegisterPage'; // 注册 + static const String starLockForgetPasswordPage = '/StarLockForgetPasswordPage'; // 忘记密码 - static const selectCountryRegionPage = '/SelectCountryRegionPage'; // 选择国家和地区 - static const safetyVerificationPage = '/SafetyVerificationPage'; // 安全验证 + static const String selectCountryRegionPage = '/SelectCountryRegionPage'; // 选择国家和地区 + static const String safetyVerificationPage = '/SafetyVerificationPage'; // 安全验证 - static const getDeviceListPage = '/getDeviceListPage'; //设备列表 - static const getNameListPage = '/getNameListPage'; //姓名列表 - static const authorityManagementPage = '/authorityManagementPage'; //批量授权 - static const massSendLockGroupListPage = + static const String getDeviceListPage = '/getDeviceListPage'; //设备列表 + static const String getNameListPage = '/getNameListPage'; //姓名列表 + static const String authorityManagementPage = '/authorityManagementPage'; //批量授权 + static const String massSendLockGroupListPage = '/massSendLockGroupListPage'; //群发锁分组列表 static const massSendReceiverPage = '/massSendReceiverPage'; //群发接收人 static const lockUserListPage = '/lockUserListPage'; //锁用户列表 static const administratorDetailsPage = '/administratorDetailsPage'; //管理员详情 static const expireLockManagePage = '/expireLockManagePage'; //即将到期 static const expireKeyChangeDatePage = '/ExpireKeyChangeDatePage'; //即将到期卡、指纹、遥控钥匙详情修改日期 - static const adminDetailChangeDatePage = - '/adminDetailChangeDatePage'; //管理员详情修改生效时间 - static const adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表 - static const safeVerifyPage = '/safeVerifyPage'; //删除账号安全验证 - static const webviewShowPage = '/webviewShowPage'; //网页 - static const demoModeLockDetailPage = '/DemoModeLockDetailPage'; // 演示模式锁详情页 - static const demoModeLockSetPage = '/DemoModeLockSetPage'; // 演示模式锁设置页 - static const addLockSelectCountryPage = + static const adminDetailChangeDatePage = '/adminDetailChangeDatePage'; //管理员详情修改生效时间 + static const String adminLockListPage = '/adminLockListPage'; //管理员详情的锁列表 + static const String safeVerifyPage = '/safeVerifyPage'; //删除账号安全验证 + static const String webviewShowPage = '/webviewShowPage'; //网页 + static const String demoModeLockDetailPage = '/DemoModeLockDetailPage'; // 演示模式锁详情页 + static const String demoModeLockSetPage = '/DemoModeLockSetPage'; // 演示模式锁设置页 + static const String addLockSelectCountryPage = '/AddLockSelectCountryPage'; // 演示模式锁设置页 - static const faceUnlockPage = '/faceUnlockPage'; //面容开锁设置 - static const motorPowerPage = '/motorPowerPage'; //电机功率设置 - static const openDoorDirectionPage = '/openDoorDirectionPage'; //开门方向设置 - static const catEyeWorkModePage = '/catEyeWorkModePage'; //猫眼工作模式 - static const msgNotificationPage = '/msgNotificationPage'; //消息提醒 - static const addFacePage = '/addFacePage'; //添加人脸 - static const nDaysUnopenedPage = '/nDaysUnopenedPage'; //N天未开门 - static const notificationModePage = '/notificationModePage'; //提醒方式 - static const openDoorNotifyPage = '/openDoorNotifyPage'; //家人到家 - static const addFamilyPage = '/addFamilyPage'; //添加家人 - static const lockUserPage = '/lockUserPage'; //锁用户 - static const catEyeSetPage = '/catEyeSetPage'; //猫眼设置 - static const coerceOpenDoorPage = '/coerceOpenDoorPage'; //胁迫开门 - static const coerceFingerprintPage = '/coerceFingerprintPage'; //胁迫指纹 - static const lowBatteryReminderPage = '/lowBatteryReminderPage'; //低电量提醒 - static const coerceFingerprintListPage = '/coerceFingerprintListPage'; //指纹列表 - static const lockMonitoringPage = '/LockMonitoringPage'; //监控 - static const monitoringRealTimeScreenPage = + static const String faceUnlockPage = '/faceUnlockPage'; //面容开锁设置 + static const String motorPowerPage = '/motorPowerPage'; //电机功率设置 + static const String openDoorDirectionPage = '/openDoorDirectionPage'; //开门方向设置 + static const String catEyeWorkModePage = '/catEyeWorkModePage'; //猫眼工作模式 + static const String msgNotificationPage = '/msgNotificationPage'; //消息提醒 + static const String addFacePage = '/addFacePage'; //添加人脸 + static const String nDaysUnopenedPage = '/nDaysUnopenedPage'; //N天未开门 + static const String notificationModePage = '/notificationModePage'; //提醒方式 + static const String openDoorNotifyPage = '/openDoorNotifyPage'; //家人到家 + static const String addFamilyPage = '/addFamilyPage'; //添加家人 + static const String lockUserPage = '/lockUserPage'; //锁用户 + static const String catEyeSetPage = '/catEyeSetPage'; //猫眼设置 + static const String coerceOpenDoorPage = '/coerceOpenDoorPage'; //胁迫开门 + static const String coerceFingerprintPage = '/coerceFingerprintPage'; //胁迫指纹 + static const String lowBatteryReminderPage = '/lowBatteryReminderPage'; //低电量提醒 + static const String coerceFingerprintListPage = '/coerceFingerprintListPage'; //指纹列表 + static const String lockMonitoringPage = '/LockMonitoringPage'; //监控 + static const String monitoringRealTimeScreenPage = '/MonitoringRealTimeScreenPage'; //实时画面 - static const videoLogPage = '/VideoLogPage'; // 视频日志 - static const editVideoLogPage = '/EditVideoLogPage'; // 编辑视频日志 - static const videoLogDetailPage = '/VideoLogDetailPage'; // 视频日志详情 - static const videoLogDownLoadPage = '/VideoLogDownLoadPage'; // 视频下载列表 + static const String videoLogPage = '/VideoLogPage'; // 视频日志 + static const String editVideoLogPage = '/EditVideoLogPage'; // 编辑视频日志 + static const String videoLogDetailPage = '/VideoLogDetailPage'; // 视频日志详情 + static const String videoLogDownLoadPage = '/VideoLogDownLoadPage'; // 视频下载列表 - static const remoteControlListPage = '/RemoteControlListPage'; // 遥控列表 - static const addRemoteControlPage = '/AddRemoteControlPage'; // 添加遥控 + static const String remoteControlListPage = '/RemoteControlListPage'; // 遥控列表 + static const String addRemoteControlPage = '/AddRemoteControlPage'; // 添加遥控 - static const cardListPage = '/CardListPage'; // 卡列表 + static const String cardListPage = '/CardListPage'; // 卡列表 // static const addCardTypeManagePage = '/AddCardTypeManagePage'; // 添加卡 - static const addCardPage = '/AddCardPage'; // 添加卡 - static const cardDetailPage = '/CardDetailPage'; // 卡详情 - static const fingerprintListPage = '/FingerprintListPage'; // 指纹列表 - static const addFingerprintTypePage = '/AddFingerprintTypePage'; // 添加指纹 - static const fingerprintDetailPage = '/FingerprintDetailPage'; // 指纹详情 - static const faceListPage = '/FaceListPage'; // 人脸列表 - static const addFaceTypePage = '/AddFaceTypePage'; // 添加人脸 - static const faceDetailPage = '/faceDetailPage'; // 人脸详情 + static const String addCardPage = '/AddCardPage'; // 添加卡 + static const String cardDetailPage = '/CardDetailPage'; // 卡详情 + static const String fingerprintListPage = '/FingerprintListPage'; // 指纹列表 + static const String addFingerprintTypePage = '/AddFingerprintTypePage'; // 添加指纹 + static const String fingerprintDetailPage = '/FingerprintDetailPage'; // 指纹详情 + static const String faceListPage = '/FaceListPage'; // 人脸列表 + static const String addFaceTypePage = '/AddFaceTypePage'; // 添加人脸 + static const String faceDetailPage = '/faceDetailPage'; // 人脸详情 - static const irisListPage = '/IrisListPage'; // 虹膜列表 - static const addIrisTypeManagePage = '/AddIrisTypeManagePage'; // 添加虹膜 - static const addIrisPage = '/AddIrisPage'; // 添加虹膜过程 + static const String irisListPage = '/IrisListPage'; // 虹膜列表 + static const String addIrisTypeManagePage = '/AddIrisTypeManagePage'; // 添加虹膜 + static const String addIrisPage = '/AddIrisPage'; // 添加虹膜过程 - static const palmListPage = '/PalmListPage'; // 手掌列表 - static const addPalmTypeManagePage = '/AddPalmTypeManagePage'; // 添加手掌 - static const addPalmPage = '/AddPalmPage'; // 添加手掌过程 + static const String palmListPage = '/PalmListPage'; // 手掌列表 + static const String addPalmTypeManagePage = '/AddPalmTypeManagePage'; // 添加手掌 + static const String addPalmPage = '/AddPalmPage'; // 添加手掌过程 - static const passwordKeyDetailChangeDatePage = + static const String passwordKeyDetailChangeDatePage = '/passwordKeyDetailChangeDatePage'; //密码更改时间 - static const realTimePicturePage = '/realTimePicturePage'; //实时监控画面 - static const doorLockLogPage = '/doorLockLogPage'; //门锁日志 - static const catEyeCustomModePage = '/catEyeCustomModePage'; //猫眼自定义模式 - static const videoSlotPage = '/videoSlotPage'; //录像时段 - static const liveVideoPage = '/liveVideoPage'; //实时画面 + static const String realTimePicturePage = '/realTimePicturePage'; //实时监控画面 + static const String doorLockLogPage = '/doorLockLogPage'; //门锁日志 + static const String catEyeCustomModePage = '/catEyeCustomModePage'; //猫眼自定义模式 + static const String videoSlotPage = '/videoSlotPage'; //录像时段 + static const String liveVideoPage = '/liveVideoPage'; //实时画面 - static const accessoriesListPage = '/accessoriesListPage'; //配件列表 - static const seletKeyCyclicDatePage = + static const String accessoriesListPage = '/accessoriesListPage'; //配件列表 + static const String seletKeyCyclicDatePage = '/SeletKeyCyclicDatePage'; // 电子钥匙、授权管理员、卡、指纹、遥控等添加添加循环日期公共界面 - static const advancedFeaturesWebPage = '/advancedFeaturesWebPage'; // 高级功能 - static const advancedFunctionRecordPage = + static const String advancedFeaturesWebPage = '/advancedFeaturesWebPage'; // 高级功能 + static const String advancedFunctionRecordPage = '/advancedFunctionRecordPage'; //高级功能购买记录 static const String administratorAssociationLockPage = '/administratorAssociationLockPage'; //我的设置-授权管理员-关联锁 } abstract class AppRouters { - static final routePages = [ - GetPage( + static final List> routePages = >[ + GetPage( name: Routers.initial, page: () => const StarLockApplication(), ), - GetPage( + GetPage( name: Routers.starLockMain, page: () => F.sw( - defaultCall: () => StarLockMainPage(), + skyCall: () => StarLockMainPage(), xhjCall: () => const StarLockMainXHJPage()), ), - GetPage( + GetPage( name: Routers.starLockMinePage, page: () => const StarLockMinePage(), ), - GetPage( + GetPage( name: Routers.selectLockTypePage, page: () => const SelectLockTypePage(), ), - GetPage( + GetPage( name: Routers.lockMallPage, page: () => LockMallPage(), ), - GetPage( + GetPage( name: Routers.addLockPage, page: () => const AddLockPage(), ), - GetPage( + GetPage( name: Routers.nearbyLockPage, page: () => const NearbyLockPage(), ), - GetPage( + GetPage( name: Routers.saveLockPage, page: () => const SaveLockPage(), ), - GetPage( + GetPage( name: Routers.lockDetailMainPage, page: () => const LockDetailMainPage(), ), - GetPage( + GetPage( name: Routers.electronicKeyListPage, page: () => const ElectronicKeyListPage(), ), - GetPage( + GetPage( name: Routers.electronicKeyDetailPage, page: () => const ElectronicKeyDetailPage(), ), - GetPage( + GetPage( name: Routers.electronicKeyDetailChangeDate, page: () => const ElectronicKeyDetailChangeDate(), ), - GetPage( + GetPage( name: Routers.sendElectronicKeyPage, page: () => const SendElectronicKeyPage(), ), - GetPage( + GetPage( name: Routers.massSendElectronicKeyManagePage, page: () => const MassSendElectronicKeyManagePage(), ), - GetPage( + GetPage( name: Routers.electronicKeyPeriodValidityPage, page: () => const ElectronicKeyPeriodValidityPage(), ), - GetPage( + GetPage( name: Routers.sendEmailNotificationPage, page: () => const SendEmailNotificationPage(), ), - GetPage( + GetPage( name: Routers.passwordKeyListPage, page: () => const PasswordKeyListPage(), ), - GetPage( + GetPage( name: Routers.passwordKeyPerpetualPage, page: () => const PasswordKeyPerpetualPage(), ), - GetPage( + GetPage( name: Routers.passwordKeyDetailPage, page: () => const PasswordKeyDetailPage(), ), - // GetPage( + // GetPage( // name: Routers.otherTypeKeyListPage, // page: () => const OtherTypeKeyListPage(), // ), - // GetPage( + // GetPage( // name: Routers.otherTypeKeyDetailPage, // page: () => const OtherTypeKeyDetailPage(), // ), - // GetPage( + // GetPage( // name: Routers.otherTypeKeyManagePage, // page: () => const OtherTypeKeyManagePage(), // ), - GetPage( + GetPage( name: Routers.authorizedAdminListPage, page: () => const AuthorizedAdminListPage(), ), - GetPage( + GetPage( name: Routers.authorizedAdminPage, page: () => const AuthorizedAdminPage(), ), - GetPage( + GetPage( name: Routers.lockOperatingRecordPage, page: () => const LockOperatingRecordPage(), ), - GetPage( + GetPage( name: Routers.mineSetPage, - page: () => const MineSetPage(), + page: () => MineSetPage(), ), - GetPage( + GetPage( name: Routers.volumeAuthorizationLockManagePage, page: () => const VolumeAuthorizationLockManagePage(), ), - GetPage( + GetPage( name: Routers.mineMultiLanguagePage, page: () => const MineMultiLanguagePage(), ), - GetPage( + GetPage( name: Routers.starLockLoginPage, page: () => F.sw( - defaultCall: () => const StarLockLoginPage(), + skyCall: () => const StarLockLoginPage(), xhjCall: () => const StarLockLoginXHJPage()), ), - GetPage( + GetPage( name: Routers.starLockRegisterPage, page: () => F.sw( - defaultCall: () => const StarLockRegisterPage(), + skyCall: () => const StarLockRegisterPage(), xhjCall: () => const StarLockRegisterXHJPage()), binding: StarLockRegisterBinding()), - GetPage( + GetPage( name: Routers.starLockForgetPasswordPage, page: () => F.sw( - defaultCall: () => const StarLockForgetPasswordPage(), + skyCall: () => const StarLockForgetPasswordPage(), xhjCall: () => const StarLockForgetPasswordXHJPage()), ), - GetPage( + GetPage( name: Routers.selectCountryRegionPage, page: () => const SelectCountryRegionPage(), ), - GetPage( + GetPage( name: Routers.lockSetPage, page: () => const LockSetPage(), ), - GetPage( + GetPage( name: Routers.basicInformationPage, page: () => const BasicInformationPage(), ), - GetPage( + GetPage( name: Routers.uploadElectricQuantityPage, page: () => const UploadElectricQuantityPage(), ), - GetPage( + GetPage( name: Routers.editLockNamePage, page: () => const EditLockNamePage(), ), - GetPage( + GetPage( name: Routers.lockSelectGroupingPage, page: () => const LockSelectGroupingPage(), ), - GetPage( + GetPage( name: Routers.adminOpenLockPasswordPage, page: () => const AdminOpenLockPasswordPage(), ), - GetPage( + GetPage( name: Routers.wirelessKeyboardPage, page: () => const WirelessKeyboardPage(), ), - GetPage( + GetPage( name: Routers.addWirelessKeyboardPage, page: () => const AddWirelessKeyboardPage(), ), - GetPage( + GetPage( name: Routers.addWirelessKeyboardScreenNotLightOnPage, page: () => const AddWirelessKeyboardScreenNotLightOnPage(), ), - GetPage( + GetPage( name: Routers.selectWirelessKeyboardPage, page: () => const SelectWirelessKeyboardPage(), ), - GetPage( + GetPage( name: Routers.doorMagneticPage, page: () => const DoorMagneticPage(), ), - GetPage( + GetPage( name: Routers.addDoorMagneticPage, page: () => const AddDoorMagneticPage(), ), - GetPage( + GetPage( name: Routers.nearbyDoorMagneticPage, page: () => const NearbyDoorMagneticPage(), ), - GetPage( + GetPage( name: Routers.lockAddressPage, page: () => const LockAddressPage(), ), - GetPage( + GetPage( name: Routers.remoteUnlockingPage, page: () => const RemoteUnlockingPage(), ), - GetPage( + GetPage( name: Routers.automaticBlockingPage, page: () => const AutomaticBlockingPage(), ), - GetPage( + GetPage( name: Routers.normallyOpenModePage, page: () => const NormallyOpenModePage(), ), - GetPage( + GetPage( name: Routers.lockSoundSetPage, page: () => const LockSoundSetPage(), ), - GetPage( + GetPage( name: Routers.burglarAlarmPage, page: () => const BurglarAlarmPage(), ), - GetPage( + GetPage( name: Routers.resetButtonPage, page: () => const ResetButtonPage(), ), - GetPage( + GetPage( name: Routers.unlockQRCodePage, page: () => const UnlockQRCodePage(), ), - GetPage( + GetPage( name: Routers.lockTimePage, page: () => const LockTimePage(), ), // 诊断 - GetPage( + GetPage( name: Routers.diagnosePage, page: () => const DiagnosePage(), ), - GetPage( + GetPage( name: Routers.uploadDataPage, page: () => const UploadDataPage(), ), - GetPage( + GetPage( name: Routers.importOtherLockDataPage, page: () => const ImportOtherLockDataPage(), ), - GetPage( + GetPage( name: Routers.lockEscalationPage, page: () => const LockEscalationPage(), ), - GetPage( + GetPage( name: Routers.markedHouseStatePage, page: () => const MarkedHouseStatePage(), ), - GetPage( + GetPage( name: Routers.checkingInListPage, page: () => const CheckingInListPage(), ), - GetPage( + GetPage( name: Routers.checkingInSetPage, page: () => const CheckingInSetPage(), ), - GetPage( + GetPage( name: Routers.checkingInStaffManagePage, page: () => const CheckingInStaffListPage(), ), - GetPage( + GetPage( name: Routers.checkingInAddStaffPage, page: () => const CheckingInAddStaffPage(), ), - GetPage( + GetPage( name: Routers.checkingInSetWorkTimePage, page: () => const CheckingInSetWorkTimePage(), ), - GetPage( + GetPage( name: Routers.checkingInSetWorkdaySet, page: () => const CheckingInSetWorkdaySet(), ), - GetPage( + GetPage( name: Routers.checkingInSetHolidaysPage, page: () => const CheckingInSetHolidaysPage(), ), - GetPage( + GetPage( name: Routers.checkingInAddHolidaysPage, page: () => const CheckingInAddHolidaysPage(), ), - GetPage( + GetPage( name: Routers.checkingInDeletHolidaysPage, page: () => const CheckingInDeletHolidaysPage(), ), - GetPage( + GetPage( name: Routers.checkingInDetailPage, page: () => const CheckingInDetailPage(), ), - GetPage( + GetPage( name: Routers.minePersonInfoPage, page: () => MinePersonInfoPage(), ), - GetPage( + GetPage( name: Routers.minePersonInfoEditNamePage, page: () => const MinePersonInfoEditNamePage(), ), - GetPage( + GetPage( name: Routers.mineUnbindPhoneOrEmailPage, page: () => const MineUnbindPhoneOrEmailPage(), ), - GetPage( + GetPage( name: Routers.minePersonInfoEditIphonePage, page: () => const MinePersonInfoEditIphonePage(), ), - GetPage( + GetPage( name: Routers.minePersonInfoResetPasswordPage, page: () => const MinePersonInfoResetPasswordPage(), ), - GetPage( + GetPage( name: Routers.minePersonInfoSetSafetyProblemPage, page: () => const MinePersonInfoSetSafetyProblemPage(), ), - GetPage( + GetPage( name: Routers.minePersonInfoEditAccountNextPage, page: () => const MinePersonInfoEditAccountNextPage(), ), - GetPage( + GetPage( name: Routers.gatewayListPage, page: () => const GatewayListPage(), ), - GetPage( + GetPage( name: Routers.messageListPage, page: () => MessageListPage(), ), - GetPage( + GetPage( name: Routers.supportStaffPage, page: () => const SupportStaffPage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesPage, page: () => const ValueAddedServicesListPage(), ), - GetPage( + GetPage( name: Routers.aboutPage, page: () => const AboutPage(), ), - GetPage( + GetPage( name: Routers.gatewayDetailPage, page: () => const GatewayDetailPage(), ), - GetPage( + GetPage( name: Routers.gatewayConnectionLockPage, page: () => const GatewayConnectionLockListPage(), ), - GetPage( + GetPage( name: Routers.selectGatewayTypePage, page: () => const SelectGatewayTypePage(), ), - GetPage( + GetPage( name: Routers.selectGatewayTypeNextTipPage, page: () => const SelectGatewayTypeNextTipPage(), ), - GetPage( + GetPage( name: Routers.selectGatewayPage, page: () => const SelectGatewayListPage(), ), - GetPage( + GetPage( name: Routers.gatewayConfigurationWifiPage, page: () => const GatewayConfigurationWifiPage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesNoteAndEmailDetailPage, page: () => const ValueAddedServicesNoteAndEmailDetailPage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesRealNamePage, page: () => const ValueAddedServicesRealNamePage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesRecordPage, - page: () => ValueAddedServicesRecordPage(), + page: () => const ValueAddedServicesRecordPage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesBuyPage, page: () => const ValueAddedServicesBuyPage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesHighFunctionPage, page: () => const ValueAddedServicesHighFunctionPage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesListSMSTemplatePage, page: () => const ValueAddedServicesListSMSTemplatePage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesAddSMSTemplatePage, page: () => const ValueAddedServicesAddSMSTemplatePage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesListEmailTemplatePage, page: () => const ValueAddedServicesListEmailTemplatePage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesAddEmailTemplatePage, page: () => const ValueAddedServicesAddEmailTemplatePage(), ), - GetPage( + GetPage( name: Routers.valueAddedServicesBuyAndUseRecordManagePage, page: () => const ValueAddedServicesBuyAndUseRecordManagePage(), ), - GetPage( + GetPage( name: Routers.lockScreenPage, page: () => const LockScreenPage(), ), - GetPage( + GetPage( name: Routers.aPPUnlockNeedMobileNetworkingLockPage, page: () => const APPUnlockNeedMobileNetworkingLockPage(), ), - GetPage( + GetPage( name: Routers.hideInvalidUnlockPermissionsPage, page: () => const HideInvalidUnlockPermissionsPage(), ), - GetPage( + GetPage( name: Routers.authorizedAdministratorListPage, page: () => const AuthorizedAdministratorListPage()), - GetPage( + GetPage( name: Routers.lockUserManageLisPage, page: () => const LockUserManageListPage()), - GetPage( + GetPage( name: Routers.lockGroupListPage, page: () => const LockGroupListPage()), - GetPage( + GetPage( name: Routers.groupEditLockPage, page: () => const GroupEditLockPage()), - GetPage( + GetPage( name: Routers.lockItemListPage, page: () => const LockItemListPage()), - GetPage( + GetPage( name: Routers.transferSmartLockPage, page: () => const TransferSmartLockPage()), - GetPage( + GetPage( name: Routers.recipientInformationPage, page: () => const RecipientInformationPage()), - GetPage( + GetPage( name: Routers.selectBranchPage, page: () => const SelectBranchPage()), - GetPage( + GetPage( name: Routers.selectGetewayListPage, page: () => const SelectGetewayListPage()), - GetPage( + GetPage( name: Routers.mineBindPhoneOrEmailPage, page: () => const MineBindPhoneOrEmailPage()), - GetPage( + GetPage( name: Routers.addAuthorizedAdministratorPage, page: () => const AddAuthorizedAdministratorManagePage()), - GetPage( + GetPage( name: Routers.safetyVerificationPage, page: () => const SafetyVerificationPage(), binding: SafetyVerificationBinding(), ), - GetPage( + GetPage( name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage()), - GetPage( + GetPage( name: Routers.getDeviceListPage, page: () => const GetDeviceListPage()), - GetPage(name: Routers.getNameListPage, page: () => const GetNameListPage()), - GetPage( + GetPage(name: Routers.getNameListPage, page: () => const GetNameListPage()), + GetPage( name: Routers.authorityManagementPage, page: () => const AuthorityManagementPage()), - GetPage( + GetPage( name: Routers.addFingerprintTipPage, page: () => const AddFingerprintTipPage()), - GetPage( + GetPage( name: Routers.addFingerprintPage, page: () => const AddFingerprintPage()), - GetPage( + GetPage( name: Routers.configuringWifiPage, page: () => const ConfiguringWifiPage()), - GetPage( + GetPage( name: Routers.massSendLockGroupListPage, page: () => const MassSendLockGroupListPage()), - GetPage( + GetPage( name: Routers.massSendReceiverPage, page: () => const MassSendReceiverPage()), - GetPage( + GetPage( name: Routers.lockUserListPage, page: () => const LockUserListPage()), - GetPage( + GetPage( name: Routers.checkInCreatCompanyPage, page: () => const CheckInCreatCompanyPage()), - GetPage( + GetPage( name: Routers.checkingInStaffDetailPage, page: () => const CheckingInStaffDetailPage()), - GetPage( + GetPage( name: Routers.administratorDetailsPage, page: () => const AdministratorDetailsPage()), - GetPage( + GetPage( name: Routers.expireLockManagePage, page: () => const ExpireLockManagePage()), - GetPage( + GetPage( name: Routers.otherTypeKeyChangeDatePage, page: () => const OtherTypeKeyChangeDatePage()), - GetPage( + GetPage( name: Routers.otherTypeKeyChangeValidityDatePage, page: () => const OtherTypeKeyChangeValidityDatePage()), - GetPage(name: Routers.addICCardPage, page: () => const AddICCardPage()), - GetPage( + GetPage(name: Routers.addICCardPage, page: () => const AddICCardPage()), + GetPage( name: Routers.adminDetailChangeDatePage, page: () => const AdminDetailChangeDatePage()), - GetPage( + GetPage( name: Routers.lockAddressGaoDePage, page: () => const LockAddressGaoDePage()), - GetPage(name: Routers.safeVerifyPage, page: () => const SafeVerifyPage()), - GetPage( + GetPage(name: Routers.safeVerifyPage, page: () => const SafeVerifyPage()), + GetPage( name: Routers.minePersonInfoViewSafetyProblemPage, page: () => const MinePersonInfoViewSafetyProblemPage()), - GetPage(name: Routers.webviewShowPage, page: () => const WebviewShowPage()), - GetPage( + GetPage(name: Routers.webviewShowPage, page: () => const WebviewShowPage()), + GetPage( name: Routers.demoModeLockSetPage, page: () => const DemoModeLockSetPage()), - GetPage( + GetPage( name: Routers.demoModeLockDetailPage, page: () => const DemoModeLockDetailPage()), - GetPage( + GetPage( name: Routers.addLockSelectCountryPage, page: () => const AddLockSelectCountryPage()), - GetPage(name: Routers.faceUnlockPage, page: () => const FaceUnlockPage()), - GetPage(name: Routers.motorPowerPage, page: () => const MotorPowerPage()), - GetPage( + GetPage(name: Routers.faceUnlockPage, page: () => const FaceUnlockPage()), + GetPage(name: Routers.motorPowerPage, page: () => const MotorPowerPage()), + GetPage( name: Routers.openDoorDirectionPage, page: () => const OpenDoorDirectionPage()), - GetPage( + GetPage( name: Routers.catEyeWorkModePage, page: () => const CatEyeWorkModePage()), - GetPage( + GetPage( name: Routers.msgNotificationPage, page: () => const MsgNotificationPage()), - GetPage(name: Routers.addFacePage, page: () => const AddFacePage()), - GetPage( + GetPage(name: Routers.addFacePage, page: () => const AddFacePage()), + GetPage( name: Routers.nDaysUnopenedPage, page: () => const NDaysUnopenedPage()), - GetPage( + GetPage( name: Routers.notificationModePage, page: () => const NotificationModePage()), - GetPage( + GetPage( name: Routers.openDoorNotifyPage, page: () => const OpenDoorNotifyPage()), - GetPage(name: Routers.addFamilyPage, page: () => const AddFamilyPage()), - GetPage(name: Routers.lockUserPage, page: () => const LockUserPage()), - GetPage(name: Routers.catEyeSetPage, page: () => const CatEyeSetPage()), - GetPage( + GetPage(name: Routers.addFamilyPage, page: () => const AddFamilyPage()), + GetPage(name: Routers.lockUserPage, page: () => const LockUserPage()), + GetPage(name: Routers.catEyeSetPage, page: () => const CatEyeSetPage()), + GetPage( name: Routers.coerceOpenDoorPage, page: () => const CoerceOpenDoorPage()), - GetPage( + GetPage( name: Routers.coerceFingerprintPage, page: () => const CoerceFingerprintPage()), - GetPage( + GetPage( name: Routers.lowBatteryReminderPage, page: () => const LowBatteryReminderPage()), - GetPage( + GetPage( name: Routers.coerceFingerprintListPage, page: () => const CoerceFingerprintListPage()), - GetPage( + GetPage( name: Routers.lockMonitoringPage, page: () => const LockMonitoringPage()), - GetPage( + GetPage( name: Routers.monitoringRealTimeScreenPage, page: () => const MonitoringRealTimeScreenPage()), - GetPage(name: Routers.videoLogPage, page: () => const VideoLogPage()), - GetPage( + GetPage(name: Routers.videoLogPage, page: () => const VideoLogPage()), + GetPage( name: Routers.editVideoLogPage, page: () => const EditVideoLogPage()), - GetPage( + GetPage( name: Routers.videoLogDetailPage, page: () => const VideoLogDetailPage()), - GetPage( + GetPage( name: Routers.videoLogDownLoadPage, page: () => const VideoLogDownLoadPage()), - GetPage( + GetPage( name: Routers.remoteControlListPage, page: () => const RemoteControlListPage()), - GetPage( + GetPage( name: Routers.addRemoteControlPage, page: () => const AddRemoteControlPage()), - GetPage(name: Routers.cardListPage, page: () => const CardListPage()), - // GetPage( + GetPage(name: Routers.cardListPage, page: () => const CardListPage()), + // GetPage( // name: Routers.addCardTypeManagePage, // page: () => const AddCardTypeManagePage()), - GetPage(name: Routers.addCardPage, page: () => const AddCardPage()), - GetPage(name: Routers.cardDetailPage, page: () => const CardDetailPage()), - GetPage( + GetPage(name: Routers.addCardPage, page: () => const AddCardPage()), + GetPage(name: Routers.cardDetailPage, page: () => const CardDetailPage()), + GetPage( name: Routers.fingerprintListPage, page: () => const FingerprintListPage()), - GetPage( + GetPage( name: Routers.addFingerprintTypePage, page: () => const AddFingerprintTypePage()), - GetPage( + GetPage( name: Routers.fingerprintDetailPage, page: () => const FingerprintDetailPage()), - GetPage(name: Routers.faceListPage, page: () => const FaceListPage()), - GetPage(name: Routers.addFaceTypePage, page: () => const AddFaceTypePage()), - GetPage( + GetPage(name: Routers.faceListPage, page: () => const FaceListPage()), + GetPage(name: Routers.addFaceTypePage, page: () => const AddFaceTypePage()), + GetPage( name: Routers.passwordKeyDetailChangeDatePage, page: () => const PasswordKeyDetailChangeDatePage()), - GetPage( + GetPage( name: Routers.realTimePicturePage, page: () => const RealTimePicturePage()), - GetPage(name: Routers.doorLockLogPage, page: () => const DoorLockLogPage()), - GetPage( + GetPage(name: Routers.doorLockLogPage, page: () => const DoorLockLogPage()), + GetPage( name: Routers.catEyeCustomModePage, page: () => const CatEyeCustomModePage()), - GetPage(name: Routers.videoSlotPage, page: (() => const VideoSlotPage())), - GetPage(name: Routers.liveVideoPage, page: (() => const LiveVideoPage())), - GetPage(name: Routers.faceDetailPage, page: (() => const FaceDetailPage())), - GetPage( + GetPage(name: Routers.videoSlotPage, page: () => const VideoSlotPage()), + GetPage(name: Routers.liveVideoPage, page: () => const LiveVideoPage()), + GetPage(name: Routers.faceDetailPage, page: () => const FaceDetailPage()), + GetPage( name: Routers.messageDetailPage, - page: (() => const MessageDetailPage())), - GetPage( + page: () => const MessageDetailPage()), + GetPage( name: Routers.accessoriesListPage, - page: (() => const AccessoriesListPage())), - GetPage(name: Routers.wifiListPage, page: (() => const WifiListPage())), - GetPage( + page: () => const AccessoriesListPage()), + GetPage(name: Routers.wifiListPage, page: () => const WifiListPage()), + GetPage( name: Routers.seletKeyCyclicDatePage, - page: (() => const SeletKeyCyclicDatePage())), - GetPage(name: Routers.irisListPage, page: (() => const IrisListPage())), - GetPage( + page: () => const SeletKeyCyclicDatePage()), + GetPage(name: Routers.irisListPage, page: () => const IrisListPage()), + GetPage( name: Routers.addIrisTypeManagePage, - page: (() => const AddIrisTypeManagePage())), - GetPage(name: Routers.addIrisPage, page: (() => const AddIrisPage())), - GetPage(name: Routers.palmListPage, page: (() => const PalmListPage())), - GetPage( + page: () => const AddIrisTypeManagePage()), + GetPage(name: Routers.addIrisPage, page: () => const AddIrisPage()), + GetPage(name: Routers.palmListPage, page: () => const PalmListPage()), + GetPage( name: Routers.addPalmTypeManagePage, - page: (() => const AddPalmTypeManagePage())), - GetPage(name: Routers.addPalmPage, page: (() => const AddPalmPage())), - GetPage( + page: () => const AddPalmTypeManagePage()), + GetPage(name: Routers.addPalmPage, page: () => const AddPalmPage()), + GetPage( name: Routers.advancedFeaturesWebPage, - page: (() => const AdvancedFeaturesWebPage())), - GetPage( + page: () => const AdvancedFeaturesWebPage()), + GetPage( name: Routers.advancedFunctionRecordPage, page: () => const AdvancedFunctionRecordPage()), - GetPage( + GetPage( name: Routers.administratorAssociationLockPage, page: () => const AdministratorAssociationLockPage()), GetPage( diff --git a/lib/app_settings/app_colors.dart b/lib/app_settings/app_colors.dart index a2def155..17be1c83 100755 --- a/lib/app_settings/app_colors.dart +++ b/lib/app_settings/app_colors.dart @@ -5,7 +5,7 @@ import 'package:star_lock/flavors.dart'; class AppColors { // static Color mainColor = const Color(0xFF385DEA); static Color get mainColor => F.sw( - defaultCall: () => const Color(0xFF4777EE), + skyCall: () => const Color(0xFF4777EE), xhjCall: () => const Color(0xFF68c1b9)); static Color mainBackgroundColor = const Color(0xFFF5F5F5); diff --git a/lib/blue/blue_manage.dart b/lib/blue/blue_manage.dart index dba9581c..dcbced19 100755 --- a/lib/blue/blue_manage.dart +++ b/lib/blue/blue_manage.dart @@ -4,6 +4,7 @@ import 'dart:io'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_settings.dart'; +import 'package:star_lock/tools/commonDataManage.dart'; import 'io_tool/io_model.dart'; import 'io_tool/io_tool.dart'; @@ -17,12 +18,12 @@ typedef ConnectStateCallBack = Function( typedef ScanDevicesCallBack = Function(List); class BlueManage { - factory BlueManage() => shareManager()!; BlueManage._init() { _initBlue(); } + final List scanDevices = []; // 用来写入的服务id @@ -70,6 +71,7 @@ class BlueManage { // 保存上一次的数据,用来判断是否收到重复的数据 List lastTimeData = []; int? dataLen; + Timer? scanSingleTimer; static BlueManage? _manager; @@ -311,10 +313,24 @@ class BlueManage { {bool isAddEquipment = false}) async { connectDeviceName = deviceName; final List devicesList = scanDevices; - final bool isExistDevice = isExistScanDevices(connectDeviceName); + final bool isCurrentDevice = + CommonDataManage().currentKeyInfo.lockName == deviceName; + final String? mac = CommonDataManage().currentKeyInfo.mac; - if (isAddEquipment == false && isExistDevice == false) { + AppLog.log('开始连接 是否存在缓存:$isExistDevice 是否是当前设备:$isCurrentDevice mac:$mac'); + if (GetPlatform.isAndroid && + !isExistDevice && + isCurrentDevice && + mac != null) { + scanSingleTimer?.cancel(); + //兼容android 的低配手机 + await doNotSearchBLE(mac, connectStateCallBack); + scanSingleTimer = Timer(3.seconds, () { + scanSingleTimer?.cancel(); + startScanSingle(deviceName, 15, (List scanDevices) => null); + }); + } else if (isAddEquipment == false && isExistDevice == false) { //取消缓存直接使用,存在配对场景设备信息会更变 startScanSingle(deviceName, 15, (List scanDevices) { _connectDevice(scanDevices, deviceName, connectStateCallBack, @@ -421,7 +437,51 @@ class BlueManage { } } + //直接给蓝牙设备写入 + Future 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 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 _subScribeToCharacteristic( BluetoothCharacteristic characteristic) async { diff --git a/lib/flavors.dart b/lib/flavors.dart index 2eb513d9..a429abef 100755 --- a/lib/flavors.dart +++ b/lib/flavors.dart @@ -32,19 +32,19 @@ class F { //便捷判断并返回值 static dynamic sw( - {required fCallFunction defaultCall, fCallFunction? xhjCall}) { + {required fCallFunction skyCall, required fCallFunction? xhjCall}) { if (xhjCall == null) { - return defaultCall(); + return skyCall(); } switch (appFlavor) { - case Flavor.xhj: - return xhjCall(); + case Flavor.sky: + return skyCall(); case Flavor.local: case Flavor.dev: case Flavor.pre: - case Flavor.sky: + case Flavor.xhj: default: - return defaultCall(); + return xhjCall(); } } @@ -72,7 +72,7 @@ class F { case Flavor.dev: return '${"starLock".tr}-dev'; case Flavor.pre: - return "starLock".tr; + return 'starLock'.tr; case Flavor.sky: return '锁通通'; case Flavor.xhj: diff --git a/lib/login/login/starLock_login_logic.dart b/lib/login/login/starLock_login_logic.dart index 2e3cc55e..9826cbce 100755 --- a/lib/login/login/starLock_login_logic.dart +++ b/lib/login/login/starLock_login_logic.dart @@ -39,6 +39,7 @@ class StarLockLoginLogic extends BaseGetXController { } Future login() async { + FocusScope.of(Get.context!).requestFocus(FocusNode()); //关闭键盘 final LoginEntity entity = await ApiRepository.to.login( loginType: '1', password: state.pwd.value, @@ -49,7 +50,7 @@ class StarLockLoginLogic extends BaseGetXController { Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true); eventBus.fire(MineInfoChangeRefreshUI()); XSJPushProvider().initJPushService(); - XSJPushProvider().initLocalNotification(false); + XSJPushProvider().initLocalNotification(isCancelLocalPush: false); Get.offNamedUntil(Routers.starLockMain, (Route route) => false); BlueManage().scanDevices.clear(); //清除设备缓存 } diff --git a/lib/login/login/starLock_login_page.dart b/lib/login/login/starLock_login_page.dart index 65855ad9..136a3a7c 100755 --- a/lib/login/login/starLock_login_page.dart +++ b/lib/login/login/starLock_login_page.dart @@ -239,9 +239,7 @@ class _StarLockLoginPageState extends State { child: SizedBox( width: 10.sp, )), - F.isLite - ? Container() - : GestureDetector( + if (F.isLite) Container() else GestureDetector( child: SizedBox( // width: 150.w, height: 50.h, diff --git a/lib/login/login/starLock_login_xhj_page.dart b/lib/login/login/starLock_login_xhj_page.dart index 9b30a3a1..22c16a8d 100755 --- a/lib/login/login/starLock_login_xhj_page.dart +++ b/lib/login/login/starLock_login_xhj_page.dart @@ -3,6 +3,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/flavors.dart'; +import 'package:star_lock/login/login/starLock_login_state.dart'; import '../../appRouters.dart'; import '../../app_settings/app_colors.dart'; @@ -22,10 +23,8 @@ class StarLockLoginXHJPage extends StatefulWidget { } class _StarLockLoginPageState extends State { - final logic = Get.put(StarLockLoginLogic()); - final state = Get - .find() - .state; + final StarLockLoginLogic logic = Get.put(StarLockLoginLogic()); + final StarLockLoginState state = Get.find().state; @override Widget build(BuildContext context) { @@ -33,269 +32,291 @@ class _StarLockLoginPageState extends State { resizeToAvoidBottomInset: false, backgroundColor: const Color(0xFFFFFFFF), body: ListView( - padding: EdgeInsets.only(top: 120.h, left: 40.w, right: 40.w), - children: [ - Text( - '${"欢迎使用".tr}${F.title}', - style: TextStyle( - color: AppColors.darkGrayTextColor, - fontSize: 48.sp, + padding: EdgeInsets.only( + top: 120.h, + ), + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 40.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${"欢迎使用".tr}${F.title}', + style: TextStyle( + color: AppColors.darkGrayTextColor, + fontSize: 48.sp, + ), + ), + SizedBox(height: 30.h), + GestureDetector( + onTap: () async { + final result = + await Get.toNamed(Routers.selectCountryRegionPage); + if (result != null) { + result as Map; + state.countryCode.value = result['code']; + state.countryName.value = result['countryName']; + } + }, + child: Container( + color: Colors.transparent, + child: Row( + children: [ + SizedBox( + width: 5.w, + ), + Text( + TranslationLoader.lanKeys!.countryAndRegion!.tr, + style: TextStyle( + fontSize: 22.sp, + color: AppColors.darkGrayTextColor), + ), + SizedBox( + width: 40.w, + ), + Obx(() { + return Text( + '${state.countryName.value} +${state.countryCode.value}', + style: TextStyle( + fontSize: 22.sp, color: AppColors.mainColor), + ); + }) + ], + ), + ), + ), + LoginInput( + controller: state.emailOrPhoneController, + onchangeAction: (v) { + logic.checkNext(state.emailOrPhoneController); + }, + leftWidget: Padding( + padding: EdgeInsets.only( + top: 30.w, + bottom: 20.w, + ), + ), + rightSlot: IconButton( + icon: const Icon(Icons.close), + onPressed: () {}, + ), + label: TranslationLoader + .lanKeys!.pleaseEnterNumberOrEmail!.tr, + // keyboardType: TextInputType.number, + inputFormatters: [ + LengthLimitingTextInputFormatter(30), + ]), + LoginInput( + controller: state.pwdController, + onchangeAction: (v) { + logic.checkNext(state.pwdController); + }, + isPwd: true, + // isSuffixIcon: 2, + leftWidget: Padding( + padding: EdgeInsets.only( + top: 30.w, + bottom: 20.w, + ), + ), + label: + '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}', + inputFormatters: [ + LengthLimitingTextInputFormatter(20), + ]), + SizedBox(height: 10.h), + ], ), ), - SizedBox(height: 30.h), - GestureDetector( - onTap: () async { - var result = await Get.toNamed(Routers.selectCountryRegionPage); - if (result != null) { - result as Map; - state.countryCode.value = result['code']; - state.countryName.value = result['countryName']; - } - }, - child: Container( - color: Colors.transparent, - child: Row( - children: [ - SizedBox( - width: 5.w, - ), - Text( - TranslationLoader.lanKeys!.countryAndRegion!.tr, - style: TextStyle( - fontSize: 22.sp, color: AppColors.darkGrayTextColor), - ), - SizedBox( - width: 40.w, - ), - Obx(() { - return Text( - '${state.countryName.value} +${state.countryCode - .value}', - style: TextStyle( - fontSize: 22.sp, color: AppColors.mainColor), - ); - }) - ], - ), - ), - ), - LoginInput( - controller: state.emailOrPhoneController, - onchangeAction: (v) { - logic.checkNext(state.emailOrPhoneController); - }, - leftWidget: Padding( - padding: EdgeInsets.only( - top: 30.w, - bottom: 20.w, - ), - ), - rightSlot: IconButton( - icon: Icon(Icons.close), - onPressed: () {}, - ), - label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr, - // keyboardType: TextInputType.number, - inputFormatters: [ - LengthLimitingTextInputFormatter(30), - ]), - LoginInput( - controller: state.pwdController, - onchangeAction: (v) { - logic.checkNext(state.pwdController); - }, - isPwd: true, - // isSuffixIcon: 2, - leftWidget: Padding( - padding: EdgeInsets.only( - top: 30.w, - bottom: 20.w, - ), - ), - label: - "${TranslationLoader.lanKeys!.pleaseEnter! - .tr}${TranslationLoader.lanKeys!.password!.tr}", - inputFormatters: [ - LengthLimitingTextInputFormatter(20), - ]), - SizedBox(height: 30.h), GestureDetector( onTap: () { state.agree.value = !state.agree.value; logic.changeAgreeState(); }, - child: Padding( - padding: EdgeInsets.symmetric(vertical: 10.h), + child: Container( + color: Colors.transparent, + padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 40.w), child: Row( mainAxisAlignment: MainAxisAlignment.start, - children: [ + children: [ Obx( - () => - Container( - padding: EdgeInsets.only( - left: 5.w, - right: 10.w, - ), - child: Image.asset( - state.agree.value - ? 'images/icon_round_select.png' - : 'images/icon_round_unSelect.png', - width: 20.w, - height: 20.w, - ), - ), + () => Container( + padding: EdgeInsets.only( + left: 5.w, + right: 10.w, + ), + child: Image.asset( + state.agree.value + ? 'images/icon_round_select.png' + : 'images/icon_round_unSelect.png', + width: 20.w, + height: 20.w, + ), + ), ), Flexible( child: RichText( text: TextSpan( - text: TranslationLoader.lanKeys!.readAndAgree!.tr, - style: TextStyle( - color: const Color(0xff333333), - fontSize: 20.sp), - children: [ - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: GestureDetector( - child: Text( - '《${TranslationLoader.lanKeys! - .userAgreement!.tr}》', - style: TextStyle( - color: AppColors.mainColor, - fontSize: 20.sp)), - onTap: () { - Get.toNamed(Routers.webviewShowPage, - arguments: { - "url": XSConstantMacro - .userAgreementURL, - "title": '用户协议'.tr - }); - }, - )), - WidgetSpan( - alignment: PlaceholderAlignment.middle, - child: GestureDetector( - child: Text( - '《${TranslationLoader.lanKeys! - .privacyPolicy!.tr}》', - style: TextStyle( - color: AppColors.mainColor, - fontSize: 20.sp)), - onTap: () { - Get.toNamed(Routers.webviewShowPage, - arguments: { - "url": XSConstantMacro - .privacyPolicyURL, - "title": '隐私政策'.tr - }); - }, - )), - ], - )), + text: TranslationLoader.lanKeys!.readAndAgree!.tr, + style: TextStyle( + color: const Color(0xff333333), fontSize: 20.sp), + children: [ + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: GestureDetector( + child: Text( + '《${TranslationLoader.lanKeys!.userAgreement!.tr}》', + style: TextStyle( + color: AppColors.mainColor, + fontSize: 20.sp)), + onTap: () { + Get.toNamed(Routers.webviewShowPage, + arguments: { + 'url': XSConstantMacro.userAgreementURL, + 'title': '用户协议'.tr + }); + }, + )), + WidgetSpan( + alignment: PlaceholderAlignment.middle, + child: GestureDetector( + child: Text( + '《${TranslationLoader.lanKeys!.privacyPolicy!.tr}》', + style: TextStyle( + color: AppColors.mainColor, + fontSize: 20.sp)), + onTap: () { + Get.toNamed(Routers.webviewShowPage, + arguments: { + 'url': XSConstantMacro.privacyPolicyURL, + 'title': '隐私政策'.tr + }); + }, + )), + ], + )), ) ], ), ), ), - SizedBox(height: 15.w), - Obx(() => - SubmitBtn( - btnName: TranslationLoader.lanKeys!.login!.tr, - fontSize: 28.sp, - borderRadius: 20.w, - padding: EdgeInsets.only(top: 25.w, bottom: 25.w), - isDisabled: state.canNext.value, - onClick: state.canNext.value - ? () { - if (state.agree.value == false) { - logic.showToast('请先同意用户协议及隐私政策'.tr); - return; - } else { - logic.login(); - } - } - : null)), - SizedBox(height: 10.h), - ElevatedButton( - onPressed: () async { - var data = await Get.toNamed(Routers.starLockRegisterPage); - if (data != null) { - state.emailOrPhoneController.text = data['phoneOrEmailStr']; - logic.checkNext(state.emailOrPhoneController); - state.pwdController.text = data['pwd']; - logic.checkNext(state.pwdController); - setState(() {}); - } - }, - style: ElevatedButton.styleFrom( - backgroundColor: AppColors.mainColor), - child: Text( - TranslationLoader.lanKeys!.register!.tr, - style: TextStyle(fontSize: 22.sp, color: Colors.white), - ), - ), - SizedBox(height: 5.w), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - child: SizedBox( - // width: 150.w, - height: 50.h, - // color: Colors.red, - child: Center( + Padding( + padding: EdgeInsets.symmetric(horizontal: 40.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 5.w), + Obx(() => SubmitBtn( + btnName: TranslationLoader.lanKeys!.login!.tr, + fontSize: 28.sp, + borderRadius: 20.w, + padding: EdgeInsets.only(top: 25.w, bottom: 25.w), + isDisabled: state.canNext.value, + onClick: state.canNext.value + ? () { + if (state.agree.value == false) { + logic.showToast('请先同意用户协议及隐私政策'.tr); + return; + } else { + logic.login(); + } + } + : null)), + SizedBox(height: 10.h), + SizedBox( + width: Get.width, + child: ElevatedButton( + onPressed: () async { + final dynamic data = + await Get.toNamed(Routers.starLockRegisterPage); + if (data != null) { + state.emailOrPhoneController.text = + data['phoneOrEmailStr']; + logic.checkNext(state.emailOrPhoneController); + state.pwdController.text = data['pwd']; + logic.checkNext(state.pwdController); + setState(() {}); + } + }, + style: ElevatedButton.styleFrom( + backgroundColor: AppColors.mainColor), child: Text( - '${TranslationLoader.lanKeys!.forgetPassword!.tr}?', - style: TextStyle( - fontSize: 22.sp, color: AppColors.mainColor)), + TranslationLoader.lanKeys!.register!.tr, + style: TextStyle(fontSize: 22.sp, color: Colors.white), + ), ), ), - onTap: () { - Navigator.pushNamed( - context, Routers.starLockForgetPasswordPage); - }, - ), - Expanded( - child: SizedBox( - width: 10.sp, - )), - F.isLite - ? Container() - : GestureDetector( - child: SizedBox( - // width: 150.w, - height: 50.h, - // color: Colors.red, - child: Center( - child: Text('演示模式'.tr, - style: TextStyle( - fontSize: 22.sp, - color: AppColors.mainColor)), - ), + SizedBox(height: 5.w), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + child: SizedBox( + // width: 150.w, + height: 50.h, + // color: Colors.red, + child: Center( + child: Text( + '${TranslationLoader.lanKeys!.forgetPassword!.tr}?', + style: TextStyle( + fontSize: 22.sp, + color: AppColors.mainColor)), + ), + ), + onTap: () { + Navigator.pushNamed( + context, Routers.starLockForgetPasswordPage); + }, + ), + Expanded( + child: SizedBox( + width: 10.sp, + )), + if (F.isLite) + Container() + else + GestureDetector( + child: SizedBox( + // width: 150.w, + height: 50.h, + // color: Colors.red, + child: Center( + child: Text('演示模式'.tr, + style: TextStyle( + fontSize: 22.sp, + color: AppColors.mainColor)), + ), + ), + onTap: () { + Get.toNamed(Routers.demoModeLockDetailPage); + }, + ) + ], ), - onTap: () { - Get.toNamed(Routers.demoModeLockDetailPage); - }, - ) - ], - ), + ], + ), + ) ], )); } - Widget loginInput({TextEditingController? controller, - List? inputFormatters, - String? hintText, - bool? isHaveLeftWidget, - Widget? leftWidget, - String? label, - bool? isPwd, - BlockStrCallback? onchangeAction}) { + Widget loginInput( + {TextEditingController? controller, + List? inputFormatters, + String? hintText, + bool? isHaveLeftWidget, + Widget? leftWidget, + String? label, + bool? isPwd, + BlockStrCallback? onchangeAction}) { return Container( width: 1.sp, + color: Colors.transparent, child: Column( - children: [ + children: [ Row( - children: [ + children: [ Container( color: Colors.red, child: Image.asset( diff --git a/lib/main/lockDetail/lockDetail/lockDetail_list_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_list_page.dart index c1941350..bac4a877 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_list_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_list_page.dart @@ -1,36 +1,20 @@ -import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; -import 'package:intl/intl.dart'; -import 'package:star_lock/flavors.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart'; -import 'package:star_lock/tools/showTipView.dart'; import 'package:star_lock/tools/titleAppBar.dart'; -import 'package:star_lock/widget/flavors_img.dart'; -import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; -import '../../../blue/blue_manage.dart'; -import '../../../blue/io_tool/io_tool.dart'; -import '../../../common/XSConstantMacro/XSConstantMacro.dart'; -import '../../../tools/appRouteObserver.dart'; -import '../../../tools/commonDataManage.dart'; -import '../../../tools/dateTool.dart'; -import '../../../tools/eventBusEventManage.dart'; -import '../../../tools/storage.dart'; -import '../../../translations/trans_lib.dart'; -import '../../lockMian/entity/lockListInfo_entity.dart'; import 'lockDetail_logic.dart'; class LockDetailListPage extends StatefulWidget { + + const LockDetailListPage({required this.title, required this.items, Key? key}) + : super(key: key); final String title; final List items; - const LockDetailListPage({Key? key, required this.title, required this.items}) - : super(key: key); - @override State createState() => _LockDetailListPageState(); } @@ -59,7 +43,7 @@ class _LockDetailListPageState extends State body: ListView.builder( padding: EdgeInsets.only(top: 15.h), itemCount: widget.items.length, - itemBuilder: (context, index) => widget.items[index]), + itemBuilder: (BuildContext context, int index) => widget.items[index]), ); } } diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index c079f792..bae84a18 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -504,8 +504,8 @@ class LockDetailLogic extends BaseGetXController { void resetOpenDoorState() { state.openLockBtnState.value = 0; state.openDoorBtnisUneable.value = false; - state.animationController!.reset(); - state.animationController!.forward(); + state.animationController?.reset(); + state.animationController?.forward(); eventBus.fire(RefreshLockDetailInfoDataEvent()); } @@ -513,7 +513,6 @@ class LockDetailLogic extends BaseGetXController { Future onReady() async { super.onReady(); getServerDatetime(); - await PermissionDialog.request(Permission.location); await PermissionDialog.requestBluetooth(); } diff --git a/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart index eb1d8703..57a5b20a 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_main_page.dart @@ -32,7 +32,7 @@ class _LockDetailMainPageState extends State { isOnlyOneData = obj["isOnlyOneData"]; return F.sw( - defaultCall: () => Scaffold( + skyCall: () => Scaffold( backgroundColor: Colors.white, appBar: TitleAppBar( barTitle: F.navTitle, diff --git a/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 9fc2b0fd..63d46fa0 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -145,7 +145,7 @@ class _LockDetailPageState extends State @override Widget build(BuildContext context) { loadData(); - return F.sw(defaultCall: skWidget, xhjCall: xhjWidget); + return F.sw(skyCall: skWidget, xhjCall: xhjWidget); } //鑫泓佳布局 @@ -342,56 +342,72 @@ class _LockDetailPageState extends State adminInfoView(center: false, max: false), ], ), - Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Image.asset( - showElectricIcon(state.electricQuantity.value), - width: 30.w, - height: 24.w), - SizedBox(width: 2.w), - Text('${state.electricQuantity.value}%', - style: TextStyle( - fontSize: 18.sp, - color: AppColors.darkGrayTextColor)), - SizedBox(width: 2.w), - Icon( - Icons.info, // 使用内置的 warning 图标,它是一个叹号 - color: AppColors.mainColor, // 设置图标颜色为红色 - size: 25.w, // 设置图标大小为 30 + GestureDetector( + onTap: () { + ShowTipView().showSureAlertDialog( + "${"锁电量更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}"); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Image.asset( + showElectricIcon(state.electricQuantity.value), + width: 30.w, + height: 24.w), + SizedBox(width: 2.w), + Text('${state.electricQuantity.value}%', + style: TextStyle( + fontSize: 18.sp, + color: AppColors.darkGrayTextColor)), + SizedBox(width: 2.w), + Icon( + Icons.info, // 使用内置的 warning 图标,它是一个叹号 + color: AppColors.mainColor, // 设置图标颜色为红色 + size: 25.w, // 设置图标大小为 30 + ), + SizedBox(width: 20.w), + ], + ), + SizedBox( + height: 15.h, + ), + Visibility( + visible: state.keyInfos.value.lockFeature! + .isSupportBackupBattery == + 1, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + FlavorsImg( + child: Image.asset( + showElectricIcon( + state.electricQuantityStandby.value), + width: 30.w, + height: 24.w), + ), + SizedBox(width: 2.w), + Text('${state.electricQuantityStandby.value}%', + style: TextStyle( + fontSize: 18.sp, + color: AppColors.darkGrayTextColor)), + SizedBox(width: 2.w), + FlavorsImg( + child: Icon( + Icons.info, // 使用内置的 warning 图标,它是一个叹号 + color: AppColors.mainColor, // 设置图标颜色为红色 + size: 25.w, // 设置图标大小为 30 + ), + ), + SizedBox(width: 20.w), + ], ), - SizedBox(width: 20.w), - ], - ), - SizedBox( - height: 15.h, - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Image.asset( - showElectricIcon(state.electricQuantity.value), - width: 30.w, - height: 24.w), - SizedBox(width: 2.w), - Text('--%', - style: TextStyle( - fontSize: 18.sp, - color: AppColors.darkGrayTextColor)), - SizedBox(width: 2.w), - Icon( - Icons.info, // 使用内置的 warning 图标,它是一个叹号 - color: AppColors.mainColor, // 设置图标颜色为红色 - size: 25.w, // 设置图标大小为 30 - ), - SizedBox(width: 20.w), - ], - ) - ], + ) + ], + ), ) ], ), @@ -480,7 +496,7 @@ class _LockDetailPageState extends State return Column( children: [ F.sw( - defaultCall: () => SizedBox(height: 50.h), + skyCall: () => SizedBox(height: 50.h), xhjCall: () => Padding( padding: EdgeInsets.only( top: 12.h, @@ -574,7 +590,7 @@ class _LockDetailPageState extends State ], ), F.sw( - defaultCall: () => SizedBox(height: 30.h), + skyCall: () => SizedBox(height: 30.h), xhjCall: () => SizedBox(height: 15.h), ), Container( @@ -689,7 +705,7 @@ class _LockDetailPageState extends State SizedBox( height: 30.h, ), - F.sw(defaultCall: adminInfoView, xhjCall: () => const SizedBox()), + F.sw(skyCall: adminInfoView, xhjCall: () => const SizedBox()), SizedBox( height: 20.h, ), @@ -1137,7 +1153,7 @@ class _LockDetailPageState extends State Widget bottomItem( String iconUrl, String name, bool bottomBtnisEable, Function() onClick) { final Widget child = F.sw( - defaultCall: () => Container( + skyCall: () => Container( color: Colors.white, child: Column( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart index e4134749..46aebd15 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart @@ -4,6 +4,8 @@ import 'package:flutter/scheduler.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:get/get.dart'; import 'package:star_lock/blue/io_type.dart'; +import 'package:star_lock/login/login/entity/LoginEntity.dart'; +import 'package:star_lock/main/lockMian/entity/lockListInfo_entity.dart'; import 'package:star_lock/tools/showTipView.dart'; import '../../../../blue/blue_manage.dart'; @@ -14,7 +16,9 @@ import '../../../../blue/io_reply.dart'; import '../../../../blue/io_tool/io_tool.dart'; import '../../../../blue/io_tool/manager_event_bus.dart'; import '../../../../blue/sender_manage.dart'; -import '../../../../login/login/entity/LoginEntity.dart'; + +import '../../../../flavors.dart'; + import '../../../../network/api_repository.dart'; import '../../../../tools/baseGetXController.dart'; import '../../../../tools/commonDataManage.dart'; @@ -33,9 +37,10 @@ class LockSetLogic extends BaseGetXController { // 监听蓝牙协议返回结果 late StreamSubscription _replySubscription; + void _initReplySubscription() { _replySubscription = - EventBusManager().eventBus!.on().listen((reply) async { + EventBusManager().eventBus!.on().listen((Reply reply) async { // 删除用户 // if (reply is DeletUserReply) { // _replyDeletUserKey(reply); @@ -107,8 +112,8 @@ class LockSetLogic extends BaseGetXController { // 恢复出厂设置数据解析 Future _replyFactoryDataResetKey(Reply reply) async { - var token = reply.data.sublist(2, 6); - var saveStrList = changeIntListToStringList(token); + List token = reply.data.sublist(2, 6); + List saveStrList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, saveStrList); int status = reply.data[6]; @@ -121,13 +126,15 @@ class LockSetLogic extends BaseGetXController { break; case 0x06: //无权限 - var privateKey = await Storage.getStringList(saveBluePrivateKey); + List? privateKey = + await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); - var publicKey = await Storage.getStringList(saveBluePublicKey); + List? publicKey = + await Storage.getStringList(saveBluePublicKey); List publicKeyDataList = changeStringListToIntList(publicKey!); - var token = await Storage.getStringList(saveBlueToken); + List? token = await Storage.getStringList(saveBlueToken); List getTokenList = changeStringListToIntList(token!); IoSenderManage.senderFactoryDataReset( @@ -285,13 +292,15 @@ class LockSetLogic extends BaseGetXController { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { - var privateKey = await Storage.getStringList(saveBluePrivateKey); + List? privateKey = + await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); - var publicKey = await Storage.getStringList(saveBluePublicKey); + List? publicKey = + await Storage.getStringList(saveBluePublicKey); List publicKeyDataList = changeStringListToIntList(publicKey!); - var token = await Storage.getStringList(saveBlueToken); + List? token = await Storage.getStringList(saveBlueToken); List getTokenList = changeStringListToIntList(token!); IoSenderManage.senderFactoryDataReset( @@ -347,18 +356,20 @@ class LockSetLogic extends BaseGetXController { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { if (connectionState == BluetoothConnectionState.connected) { - var privateKey = await Storage.getStringList(saveBluePrivateKey); + List? privateKey = + await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); - var token = await Storage.getStringList(saveBlueToken); + List? token = await Storage.getStringList(saveBlueToken); List getTokenList = changeStringListToIntList(token!); - var publicKey = await Storage.getStringList(saveBluePublicKey); + List? publicKey = + await Storage.getStringList(saveBluePublicKey); List getPublicKeyList = changeStringListToIntList(publicKey!); state.settingUpSupportFeatures = type; - var featureEnable = 0; + int featureEnable = 0; if (type == 55) { // APP开锁时是否需联网 featureEnable = state.isOpenLockNeedOnline.value == 1 ? 0 : 1; @@ -419,9 +430,9 @@ class LockSetLogic extends BaseGetXController { } // 开启考勤获取是否有公司 - void openCheckingInData( + Future openCheckingInData( BlockSetCheckInCallback blockSetCheckInCallback) async { - var entity = await ApiRepository.to.openCheckingInData( + CheckingInInfoDataEntity entity = await ApiRepository.to.openCheckingInData( lockId: state.lockSetInfoData.value.lockId.toString(), ); if (entity.errorCode!.codeIsSuccessful) { @@ -430,8 +441,8 @@ class LockSetLogic extends BaseGetXController { } // 设置是否打开考勤 - void setLockSetGeneralSetting() async { - var entity = await ApiRepository.to.setCheckInData( + Future setLockSetGeneralSetting() async { + LoginEntity entity = await ApiRepository.to.setCheckInData( lockId: state.lockSetInfoData.value.lockId!, attendance: state.isAttendance.value == 1 ? 0 : 1, ); @@ -448,7 +459,7 @@ class LockSetLogic extends BaseGetXController { // 设置是否打开开锁提醒 Future setLockPickingReminder() async { - var entity = await ApiRepository.to.setLockPickingReminderData( + LoginEntity entity = await ApiRepository.to.setLockPickingReminderData( lockId: state.lockSetInfoData.value.lockId!, unlockReminder: state.isLockPickingReminder.value == 1 ? 0 : 1, ); @@ -464,8 +475,8 @@ class LockSetLogic extends BaseGetXController { } // 设置是否打开开锁时是否需联网 - void setLockSetOpenLockNeedOnline() async { - var entity = await ApiRepository.to.setOpenLockNeedOnlineData( + Future setLockSetOpenLockNeedOnline() async { + LoginEntity entity = await ApiRepository.to.setOpenLockNeedOnlineData( lockId: state.lockSetInfoData.value.lockId!, appUnlockOnline: state.isOpenLockNeedOnline.value == 1 ? 0 : 1, ); @@ -485,16 +496,18 @@ class LockSetLogic extends BaseGetXController { // 下级界面修改成功后传递数据 StreamSubscription? _passCurrentLockInformationEvent; + void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus - _passCurrentLockInformationEvent = - eventBus.on().listen((event) { + _passCurrentLockInformationEvent = eventBus + .on() + .listen((PassCurrentLockInformationEvent event) { getLockSettingInfoData(); }); } void showDeletAlertTipDialog({String? showContent = ''}) { - var content = showContent!.isEmpty + String content = showContent!.isEmpty ? "${"删除设备失败,请确保在设备附近,设备未被连接,设备已打开".tr}${BlueManage().connectDeviceName!.contains("T9A") == true ? "。如果是全自动锁,请使屏幕变亮".tr : ""}" : showContent; ShowTipView().showSureAlertDialog(content); @@ -515,7 +528,7 @@ class LockSetLogic extends BaseGetXController { } else if (state.lockBasicInfo.value.keyRight == 1) { // 授权管理员弹框提示 ShowTipView().showDeleteAdministratorIsHaveAllDataDialog( - '同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (a) { + '同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool a) { // 授权管理员删除 state.deleteAdministratorIsHaveAllData.value = a; deletKeyData(); @@ -529,8 +542,8 @@ class LockSetLogic extends BaseGetXController { } // 查询账户密码 - void checkLoginPassword() async { - var entity = await ApiRepository.to.checkLoginPassword( + Future checkLoginPassword() async { + LockListInfoEntity entity = await ApiRepository.to.checkLoginPassword( password: state.passwordTF.text, ); if (entity.errorCode!.codeIsSuccessful) { @@ -540,21 +553,21 @@ class LockSetLogic extends BaseGetXController { } // 当是锁拥有者的时候,删除锁 - void deletLockInfoData() async { - var entity = await ApiRepository.to.deletOwnerLockData( + Future deletLockInfoData() async { + LockListInfoEntity entity = await ApiRepository.to.deletOwnerLockData( lockId: state.lockSetInfoData.value.lockId!, ); if (entity.errorCode!.codeIsSuccessful) { - BlueManage().connectDeviceMacAddress = ""; + BlueManage().connectDeviceMacAddress = ''; SchedulerBinding.instance.addPostFrameCallback((_) { eventBus.fire(RefreshLockListInfoDataEvent()); }); - if(state.isOnlyOneData.value == true){ - Future.delayed(const Duration(milliseconds: 200)).then((e) { + if (state.isOnlyOneData.value == true) { + Future.delayed(const Duration(milliseconds: 200)).then((e) { Get.close(1); }); - }else{ - Future.delayed(const Duration(milliseconds: 200)).then((e) { + } else { + Future.delayed(const Duration(milliseconds: 200)).then((e) { Get.close(2); }); } @@ -562,27 +575,27 @@ class LockSetLogic extends BaseGetXController { } // 普通用户或者授权管理员删除钥匙 - void deletKeyData() async { - var entity = await ApiRepository.to.deletOwnerKeyData( + Future deletKeyData() async { + final LockListInfoEntity entity = await ApiRepository.to.deletOwnerKeyData( lockId: state.lockSetInfoData.value.lockId.toString(), keyId: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(), - includeUnderlings: state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0 - ); + includeUnderlings: + state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0); if (entity.errorCode!.codeIsSuccessful) { - BlueManage().connectDeviceMacAddress = ""; + BlueManage().connectDeviceMacAddress = ''; SchedulerBinding.instance.addPostFrameCallback((_) { eventBus.fire(RefreshLockListInfoDataEvent()); }); - if(state.isOnlyOneData.value == true){ - Future.delayed(const Duration(milliseconds: 200)).then((e) { - Get.close(1); - }); - }else{ - Future.delayed(const Duration(milliseconds: 200)).then((e) { - Get.close(2); - }); - } - // Get.offAllNamed(Routers.starLockMain); + final bool isXHJ = F.isXHJ; + final bool isOnlyOneData = state.isOnlyOneData.value == true; + Future.delayed(const Duration(milliseconds: 200)).then((e) { + if (isXHJ) { + Get.close(3); + } else { + final int onlyOneDataInt = isOnlyOneData ? 1 : 2; + Get.close(onlyOneDataInt); + } + }); } } diff --git a/lib/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart b/lib/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart index 411bae76..e577367b 100755 --- a/lib/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart +++ b/lib/main/lockDetail/messageWarn/lockUser/lockUser_logic.dart @@ -16,6 +16,7 @@ class LockUserLogic extends BaseGetXController { searchStr: state.searchController.text, ); if (entity.errorCode!.codeIsSuccessful) { + state.lockUserList.clear(); //当前钥匙类型 1:电子钥匙 2:密码钥匙 3:指纹钥匙 4:卡钥匙 5:人脸钥匙 final LockUserData data1 = entity.data![0]; data1.lockUserList?.forEach((LockUserListKeys element) { diff --git a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart index db2c9b86..be7f7379 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_logic.dart @@ -24,14 +24,16 @@ class PasswordKeyListLogic extends BaseGetXController { // 获取解析后的数据 late StreamSubscription _replySubscription; void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((reply) { - + _replySubscription = + EventBusManager().eventBus!.on().listen((reply) { // 添加卡片开始(重置锁里面所有卡) - if((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) { + if ((reply is SenderCustomPasswordsReply) && + (state.ifCurrentScreen.value == true)) { _replyAddPassword(reply); } - if((reply is SenderResetPasswordsReply) && (state.ifCurrentScreen.value == true)){ + if ((reply is SenderResetPasswordsReply) && + (state.ifCurrentScreen.value == true)) { _replyResetPassword(reply); } }); @@ -41,14 +43,14 @@ class PasswordKeyListLogic extends BaseGetXController { Future _replyAddPassword(Reply reply) async { int status = reply.data[2]; - switch(status){ + switch (status) { case 0x00: - //成功 + //成功 cancelBlueConnetctToastTimer(); deletePwdRequest(); break; case 0x06: - //无权限 + //无权限 var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -60,15 +62,15 @@ class PasswordKeyListLogic extends BaseGetXController { Storage.setStringList(saveBlueToken, saveStrList); IoSenderManage.senderCustomPasswordsCommand( - keyID:"0", - userID:(await Storage.getUid())!, - pwdNo:state.itemData.isCustom == 1 ? state.pwdNo : 0, - pwd:state.pwd,//state.deletPWD, + keyID: "0", + userID: (await Storage.getUid())!, + pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0, + pwd: state.pwd, //state.deletPWD, operate: state.itemData.isCustom == 1 ? 2 : 3, isAdmin: 0, useCountLimit: 0xffff, - startTime:0x11223344, - endTime:0x11223344, + startTime: 0x11223344, + endTime: 0x11223344, needAuthor: 1, isBeforeAddUser: false, signKey: signKeyDataList, @@ -85,16 +87,16 @@ class PasswordKeyListLogic extends BaseGetXController { // 重置密码 Future _replyResetPassword(Reply reply) async { int status = reply.data[2]; - switch(status){ + switch (status) { case 0x00: - //成功 + //成功 cancelBlueConnetctToastTimer(); state.sureBtnState.value = 0; state.encrpyKey = reply.data.sublist(9, 17); resetPasswordKeyListRequest(); break; case 0x06: - //无权限 + //无权限 var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -106,8 +108,8 @@ class PasswordKeyListLogic extends BaseGetXController { Storage.setStringList(saveBlueToken, saveStrList); IoSenderManage.senderResetPasswordsCommand( - keyID:"0", - userID:(await Storage.getUid())!, + keyID: "0", + userID: (await Storage.getUid())!, needAuthor: 1, isBeforeAddUser: false, signKey: signKeyDataList, @@ -125,10 +127,11 @@ class PasswordKeyListLogic extends BaseGetXController { // 设置自定义密码 这里用作删除密码 Future senderCustomPasswords() async { showEasyLoading(); - showBlueConnetctToastTimer(action: (){ + showBlueConnetctToastTimer(action: () { dismissEasyLoading(); }); - BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); @@ -140,25 +143,26 @@ class PasswordKeyListLogic extends BaseGetXController { List getTokenList = changeStringListToIntList(token!); IoSenderManage.senderCustomPasswordsCommand( - keyID:"0", - userID:(await Storage.getUid())!, - pwdNo:state.itemData.isCustom == 1 ? state.pwdNo : 0, - pwd:state.pwd,//state.deletPWD, + keyID: "0", + userID: (await Storage.getUid())!, + pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0, + pwd: state.pwd, //state.deletPWD, operate: state.itemData.isCustom == 1 ? 2 : 3, isAdmin: 0, useCountLimit: 0xffff, - startTime:0x11223344, - endTime:0x11223344, + startTime: 0x11223344, + endTime: 0x11223344, needAuthor: 1, isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: getTokenList); - } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { dismissEasyLoading(); cancelBlueConnetctToastTimer(); state.sureBtnState.value = 0; - if(state.ifCurrentScreen.value == true){ + if (state.ifCurrentScreen.value == true) { showBlueConnetctToast(); } } @@ -167,17 +171,18 @@ class PasswordKeyListLogic extends BaseGetXController { // 重置密码 Future senderResetPasswords() async { - if(state.sureBtnState.value == 1){ + if (state.sureBtnState.value == 1) { return; } state.sureBtnState.value = 1; showEasyLoading(); - showBlueConnetctToastTimer(action: (){ + showBlueConnetctToastTimer(action: () { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { var signKey = await Storage.getStringList(saveBlueSignKey); List signKeyDataList = changeStringListToIntList(signKey!); @@ -189,43 +194,80 @@ class PasswordKeyListLogic extends BaseGetXController { List getTokenList = changeStringListToIntList(token!); IoSenderManage.senderResetPasswordsCommand( - keyID:"0", - userID:(await Storage.getUid())!, + keyID: "0", + userID: (await Storage.getUid())!, needAuthor: 1, isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: getTokenList); - } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { dismissEasyLoading(); cancelBlueConnetctToastTimer(); state.sureBtnState.value = 0; - if(state.ifCurrentScreen.value == true){ + if (state.ifCurrentScreen.value == true) { showBlueConnetctToast(); } } }); } + /** + * //请求操作记录列表(门锁日志) + void mockNetworkDataRequest({required bool isRefresh}) async { + // 如果是下拉刷新,清空已有数据 + if (isRefresh) { + state.lockLogItemList.clear(); + pageNo = 1; + } + DoorLockLogEntity entity = await ApiRepository.to.lockEventList( + lockId: state.keyInfos.value.lockId!, + lockEventType: state.dropdownValue.value, + pageNo: pageNo, + pageSize: int.parse(pageSize), + startDate: state.startDate.value, + endDate: state.endDate.value); + if (entity.errorCode!.codeIsSuccessful) { + // 更新数据列表 + state.lockLogItemList.addAll(entity.data!.itemList!); + // 更新页码 + pageNo++; + } + } + */ + //请求密码钥匙列表 - Future mockNetworkDataRequest() async { - PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList( + Future mockNetworkDataRequest( + {required bool isRefresh}) async { + // 如果是下拉刷新,清空已有数据 + if (isRefresh) { + state.itemDataList.clear(); + pageNo = 1; + } + + final PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList( state.keyInfo.value.keyStatus.toString(), state.keyInfo.value.lockId.toString(), pageNo.toString(), pageSize.toString(), state.searchController.text); if (entity.errorCode!.codeIsSuccessful) { - if (pageNo == 1) { - state.itemDataList.value.clear(); - state.itemDataList.value = entity.data!.itemList!; - pageNo++; - } else { - if (entity.data!.itemList!.isNotEmpty) { - state.itemDataList.value.addAll(entity.data!.itemList!); - pageNo++; - } - } + // 更新数据列表 + state.itemDataList.addAll(entity.data!.itemList!); + // 更新页码 + pageNo++; + + // if (pageNo == 1) { + // state.itemDataList.value.clear(); + // state.itemDataList.value = entity.data!.itemList!; + // pageNo++; + // } else { + // if (entity.data!.itemList!.isNotEmpty) { + // state.itemDataList.value.addAll(entity.data!.itemList!); + // pageNo++; + // } + // } } return entity; } @@ -233,13 +275,12 @@ class PasswordKeyListLogic extends BaseGetXController { //密码钥匙重置请求 Future resetPasswordKeyListRequest() async { PasswordKeyListEntity entity = await ApiRepository.to.keyboardPwdReset( - lockId:state.keyInfo.value.lockId.toString(), - passwordKey: state.encrpyKey - ); + lockId: state.keyInfo.value.lockId.toString(), + passwordKey: state.encrpyKey); if (entity.errorCode!.codeIsSuccessful) { - showToast("重置成功".tr, something: (){ + showToast("重置成功".tr, something: () { pageNo = 1; - mockNetworkDataRequest(); + mockNetworkDataRequest(isRefresh: true); }); } } @@ -247,13 +288,13 @@ class PasswordKeyListLogic extends BaseGetXController { //删除密码请求 deleteType:1-蓝牙 2-网关 Future deletePwdRequest() async { PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd( - lockId:state.itemData.lockId!.toString(), - keyboardPwdId:state.itemData.keyboardPwdId!.toString(), - deleteType:1); + lockId: state.itemData.lockId!.toString(), + keyboardPwdId: state.itemData.keyboardPwdId!.toString(), + deleteType: 1); if (entity.errorCode!.codeIsSuccessful) { - showToast("删除成功".tr, something: (){ + showToast("删除成功".tr, something: () { pageNo = 1; - mockNetworkDataRequest(); + mockNetworkDataRequest(isRefresh: true); }); } } @@ -262,80 +303,76 @@ class PasswordKeyListLogic extends BaseGetXController { String getUseDateStr(PasswordKeyListItem indexEntity) { int? getPwdType = indexEntity.keyboardPwdType; String useDateStr = ''; - DateTime sendDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); - DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); - DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); + DateTime sendDateStr = + DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); + DateTime startDateStr = + DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); + DateTime endDateStr = + DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); int starHour = indexEntity.hoursStart!; int endHour = indexEntity.hoursEnd!; // AppLog.log('indexEntity.keyboardPwdName:${indexEntity.keyboardPwdName} indexEntity.keyboardPwdStatus:${indexEntity.keyboardPwdStatus} indexEntity.startDate!${indexEntity.startDate!} indexEntity.endDate!${indexEntity.endDate!} starHour:$starHour endHour:$endHour'); switch (getPwdType) { case 1: - //单次 1 只能在开始时间后6小时内使用一次 - useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}'; + //单次 1 只能在开始时间后6小时内使用一次 + useDateStr = + '${startDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}'; break; case 2: - //永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效 - useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr} ${indexEntity.isCustom! == 1? "自定义".tr : ""}'; + //永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效 + useDateStr = + '${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr} ${indexEntity.isCustom! == 1 ? "自定义".tr : ""}'; break; case 3: - //限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效 + //限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效 useDateStr = - '${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} ${"限时".tr} ${indexEntity.isCustom! == 1? "自定义".tr : ""}'; + '${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} ${"限时".tr} ${indexEntity.isCustom! == 1 ? "自定义".tr : ""}'; break; case 4: - //删除 4 在锁上使用后会删除之前在锁上使用过的密码 - useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}'; + //删除 4 在锁上使用后会删除之前在锁上使用过的密码 + useDateStr = + '${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}'; break; case 5: - //周未循环 5 在周未开始和结束时间指定时间段内有效 - useDateStr = - '${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}'; + //周未循环 5 在周未开始和结束时间指定时间段内有效 + useDateStr = '${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 6: - //每日循环 6 每天开始和结束时间指定时间段内有效 - useDateStr = - '${"每日".tr}$starHour:00-$endHour:00 ${"循环"}'; + //每日循环 6 每天开始和结束时间指定时间段内有效 + useDateStr = '${"每日".tr}$starHour:00-$endHour:00 ${"循环"}'; break; case 7: - //工作日循环 7 工作日开始和结束时间指定的时间段内有效 - useDateStr = - '${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}'; + //工作日循环 7 工作日开始和结束时间指定的时间段内有效 + useDateStr = '${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 8: - //周一循环 8 每周一开始和结束时间指定时间段内有效 - useDateStr = - '${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}'; + //周一循环 8 每周一开始和结束时间指定时间段内有效 + useDateStr = '${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 9: - //周二循环 9 每周二开始和结束时间指定时间段内有效 - useDateStr = - '${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}'; + //周二循环 9 每周二开始和结束时间指定时间段内有效 + useDateStr = '${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 10: - //周三循环 10 每周三开始和结束时间指定时间段内有效 - useDateStr = - '${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}'; + //周三循环 10 每周三开始和结束时间指定时间段内有效 + useDateStr = '${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 11: - //周四循环 11 每周四开始和结束时间指定时间段内有效 - useDateStr = - '${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}'; + //周四循环 11 每周四开始和结束时间指定时间段内有效 + useDateStr = '${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 12: - //周五循环 12 每周五开始和结束时间指定时间段内有效 - useDateStr = - '${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}'; + //周五循环 12 每周五开始和结束时间指定时间段内有效 + useDateStr = '${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 13: - //周六循环 13 每周六开始和结束时间指定时间段内有效 - useDateStr = - '${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}'; + //周六循环 13 每周六开始和结束时间指定时间段内有效 + useDateStr = '${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; case 14: - //周天循环 14 每周日开始和结束时间指定时间段内有效 - useDateStr = - '${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}'; + //周天循环 14 每周日开始和结束时间指定时间段内有效 + useDateStr = '${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}'; break; default: @@ -347,9 +384,9 @@ class PasswordKeyListLogic extends BaseGetXController { StreamSubscription? _getPasswordListRefreshUIEvent; void _getPasswordListRefreshUIAction() { // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus - _getPasswordListRefreshUIEvent = eventBus.on().listen((event) { - pageNo = 1; - mockNetworkDataRequest(); + _getPasswordListRefreshUIEvent = + eventBus.on().listen((event) { + mockNetworkDataRequest(isRefresh: true); }); } diff --git a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart index e4b55287..558f3b01 100755 --- a/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart +++ b/lib/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_slidable/flutter_slidable.dart'; @@ -24,14 +23,17 @@ class PasswordKeyListPage extends StatefulWidget { State createState() => _PasswordKeyListPageState(); } -class _PasswordKeyListPageState extends State with RouteAware { +class _PasswordKeyListPageState extends State + with RouteAware { final logic = Get.put(PasswordKeyListLogic()); final state = Get.find().state; - Future getHttpData() async { + Future getHttpData({required bool isRefresh}) async { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - logic.mockNetworkDataRequest().then((PasswordKeyListEntity value){ + logic + .mockNetworkDataRequest(isRefresh: isRefresh) + .then((PasswordKeyListEntity value) { setState(() {}); }); } @@ -41,7 +43,7 @@ class _PasswordKeyListPageState extends State with RouteAwa void initState() { super.initState(); - getHttpData(); + getHttpData(isRefresh: true); } @override @@ -61,11 +63,12 @@ class _PasswordKeyListPageState extends State with RouteAwa onPressed: () async { var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); if (isDemoMode == false) { - if(state.itemDataList.isEmpty){ + if (state.itemDataList.isEmpty) { logic.showToast("暂无密码,无需重置".tr); return; } - ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, () { + ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, + () { logic.senderResetPasswords(); }); } else { @@ -76,12 +79,11 @@ class _PasswordKeyListPageState extends State with RouteAwa ], ), body: EasyRefreshTool( - onRefresh: (){ - logic.pageNo = 1; - getHttpData(); + onRefresh: () { + getHttpData(isRefresh: true); }, - onLoad: (){ - getHttpData(); + onLoad: () { + getHttpData(isRefresh: false); }, child: Column( children: [ @@ -89,26 +91,25 @@ class _PasswordKeyListPageState extends State with RouteAwa KeySearchWidget( editingController: state.searchController, onSubmittedAction: () { - logic.pageNo = 1; - getHttpData(); + getHttpData(isRefresh: true); }, ), SizedBox( height: 20.h, ), - Expanded( - child: _buildMainUI()), + Expanded(child: _buildMainUI()), SizedBox( height: 20.h, ), AddBottomWhiteBtn( btnName: TranslationLoader.lanKeys!.getPassword!.tr, onClick: () { - Navigator.pushNamed(context, Routers.passwordKeyPerpetualPage, - arguments: {"keyInfo": state.keyInfo.value}).then((val) { + Navigator.pushNamed( + context, Routers.passwordKeyPerpetualPage, + arguments: {"keyInfo": state.keyInfo.value}) + .then((val) { if (val != null) { - logic.pageNo = 1; - getHttpData(); + getHttpData(isRefresh: true); } }); }), @@ -122,58 +123,68 @@ class _PasswordKeyListPageState extends State with RouteAwa Widget _buildMainUI() { return Obx(() => state.itemDataList.value.isEmpty - ? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h) + ? NoData( + noDataHeight: 1.sh - + ScreenUtil().statusBarHeight - + ScreenUtil().bottomBarHeight - + 190.h - + 64.h) : SlidableAutoCloseBehavior( - child: ListView.separated( - itemCount: state.itemDataList.value.length, - itemBuilder: (c, index) { - PasswordKeyListItem passwordKeyListItem = state.itemDataList.value[index]; - String useDateStr = logic.getUseDateStr(passwordKeyListItem);// 使用期限 + child: ListView.separated( + itemCount: state.itemDataList.value.length, + itemBuilder: (c, index) { + PasswordKeyListItem passwordKeyListItem = + state.itemDataList.value[index]; + String useDateStr = + logic.getUseDateStr(passwordKeyListItem); // 使用期限 - return Slidable( - key:ValueKey(passwordKeyListItem.keyboardPwdId), - endActionPane: ActionPane( - extentRatio: 0.2, - motion: const ScrollMotion(), - children: [ - SlidableAction( - onPressed: (BuildContext context){ - ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async { - state.itemData = passwordKeyListItem; - state.pwdNo = passwordKeyListItem.pwdUserNo!; - state.pwd = passwordKeyListItem.keyboardPwd!; - logic.senderCustomPasswords(); - }); - }, - backgroundColor: Colors.red, - foregroundColor: Colors.white, - label: '删除'.tr, - padding: EdgeInsets.only(left: 5.w, right: 5.w), + return Slidable( + key: ValueKey(passwordKeyListItem.keyboardPwdId), + endActionPane: ActionPane( + extentRatio: 0.2, + motion: const ScrollMotion(), + children: [ + SlidableAction( + onPressed: (BuildContext context) { + ShowTipView().showIosTipWithContentDialog( + "确定要删除吗?".tr, () async { + state.itemData = passwordKeyListItem; + state.pwdNo = passwordKeyListItem.pwdUserNo!; + state.pwd = passwordKeyListItem.keyboardPwd!; + logic.senderCustomPasswords(); + }); + }, + backgroundColor: Colors.red, + foregroundColor: Colors.white, + label: '删除'.tr, + padding: EdgeInsets.only(left: 5.w, right: 5.w), + ), + ], ), - ], - ), - child: _electronicKeyItem(index, 'images/icon_password.png', passwordKeyListItem.keyboardPwdName!, useDateStr, () { - Navigator.pushNamed(context, Routers.passwordKeyDetailPage, - arguments: {"itemData": passwordKeyListItem}).then((val) { - if (val != null) { - logic.pageNo = 1; - getHttpData(); - } - }); - }), - ); - }, - separatorBuilder: (BuildContext context, int index) { - return const Divider( - height: 1, - color: AppColors.greyLineColor, - ); - }, - ), - )); + child: _electronicKeyItem(index, 'images/icon_password.png', + passwordKeyListItem.keyboardPwdName!, useDateStr, () { + Navigator.pushNamed(context, Routers.passwordKeyDetailPage, + arguments: {"itemData": passwordKeyListItem}) + .then((val) { + if (val != null) { + getHttpData(isRefresh: true); + } + }); + }), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return const Divider( + height: 1, + color: AppColors.greyLineColor, + ); + }, + ), + )); } - Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, String lockTypeTitle, String useDateStr, Function()? action) { + Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, + String lockTypeTitle, String useDateStr, Function()? action) { PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex]; return GestureDetector( @@ -185,8 +196,14 @@ class _PasswordKeyListPageState extends State with RouteAwa child: Row( children: [ SizedBox(width: 30.w), - Image.asset(lockTypeIcon, width: 60.w, height: 60.w,), - SizedBox(width: 20.w,), + Image.asset( + lockTypeIcon, + width: 60.w, + height: 60.w, + ), + SizedBox( + width: 20.w, + ), Expanded( child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -194,22 +211,28 @@ class _PasswordKeyListPageState extends State with RouteAwa Row( children: [ SizedBox( - width: passwordKeyListItem.keyboardPwdStatus == 2 ? 1.sw - 110.w - 100.w : 1.sw - 110.w - 50.w, - child: Row( - children: [ - Flexible( - child: Text( - lockTypeTitle, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor) - ), - ) - ] - ), + width: passwordKeyListItem.keyboardPwdStatus == 2 + ? 1.sw - 110.w - 100.w + : 1.sw - 110.w - 50.w, + child: Row(children: [ + Flexible( + child: Text(lockTypeTitle, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 24.sp, + color: AppColors.blackColor)), + ) + ]), ), SizedBox(width: 10.w), - passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已过期'.tr, style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(), + passwordKeyListItem.keyboardPwdStatus == 2 + ? Text( + '已过期'.tr, + style: + TextStyle(color: Colors.red, fontSize: 20.sp), + ) + : Container(), // SizedBox(width: 15.w) ], ), @@ -222,7 +245,9 @@ class _PasswordKeyListPageState extends State with RouteAwa useDateStr, maxLines: 1, overflow: TextOverflow.ellipsis, - style: TextStyle(fontSize: 18.sp, color: AppColors.placeholderTextColor), + style: TextStyle( + fontSize: 18.sp, + color: AppColors.placeholderTextColor), ), ), ], @@ -288,5 +313,4 @@ class _PasswordKeyListPageState extends State with RouteAwa state.ifCurrentScreen.value = false; state.sureBtnState.value = 0; } - } diff --git a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart index bb083396..a6cdee70 100755 --- a/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart +++ b/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart @@ -1,4 +1,3 @@ - import 'dart:async'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; @@ -27,7 +26,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { /// getKeyType 单次1 永久2 限期3 删除4 周未循环5 每日循环6 工作日循环7 周一循环8 周二循环9 周三循环10 周四循环11 周五循环12 周六循环13 周天循环14 //获取密码请求 Future getKeyboardPwdRequest() async { - final int startDate = DateTool().dateToTimestamp(state.beginTime.value, 1); + int startDate = DateTool().dateToTimestamp(state.beginTime.value, 1); final int endDate = DateTool().dateToTimestamp(state.endTime.value, 1); final String lockId = state.keyInfo.value.lockId.toString(); String getKeyType = '0'; @@ -40,20 +39,33 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { if (state.widgetType.value == 0) { //永久 getKeyType = '2'; + //永久密码startTime传当前时间戳 + startDate = DateTime.now().millisecondsSinceEpoch; } else if (state.widgetType.value == 1) { //限时 // 鑫鸿佳不需要生效时间 - if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XHJ && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_SYD || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_JL)){ - if (endDate <= DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { + if (CommonDataManage().currentKeyInfo.vendor == + IoModelVendor.vendor_XHJ && + (CommonDataManage().currentKeyInfo.model == + IoModelVendor.model_XHJ_SYD || + CommonDataManage().currentKeyInfo.model == + IoModelVendor.model_XHJ_JL)) { + if (endDate <= + DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { showToast('失效时间要大于当前时间'.tr); return; } } // 芯连需要生效时间 - if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)){ + if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && + (CommonDataManage().currentKeyInfo.model == + IoModelVendor.model_XL_BLE || + CommonDataManage().currentKeyInfo.model == + IoModelVendor.model_XL_WIFI)) { //限时 - if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { + if (startDate < + DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { showToast('生效时间不能小于当前时间'.tr); return; } @@ -72,8 +84,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { } else if (state.widgetType.value == 4) { //循环 // 芯连需要结束时间 - if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)){ - if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { + if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && + (CommonDataManage().currentKeyInfo.model == + IoModelVendor.model_XL_BLE || + CommonDataManage().currentKeyInfo.model == + IoModelVendor.model_XL_WIFI)) { + if (endDate < + DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { showToast('结束时间不能小于当前时间'.tr); return; } @@ -116,7 +133,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { startDate: startDate.toString(), startHours: state.loopStartHours.value, endHours: state.loopEndHours.value, - isCoerced: 1); + isCoerced: 2); if (entity.errorCode!.codeIsSuccessful) { state.isSendSuccess.value = true; state.sendSucceedType.value = state.widgetType.value; @@ -142,19 +159,20 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { //是否为永久 if (state.isPermanent.value == false) { getKeyType = '3'; - getEffectiveDateTime = DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString(); - getFailureDateTime = DateTool().dateToTimestamp(state.customEndTime.value, 1).toString(); + getEffectiveDateTime = + DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString(); + getFailureDateTime = + DateTool().dateToTimestamp(state.customEndTime.value, 1).toString(); } final PasswordKeyEntity entity = await ApiRepository.to.addPasswordKey( - lockId:lockId, - keyboardPwdName:state.nameController.text, - keyboardPwd:state.pwdController.text, - keyboardPwdType:getKeyType, - startDate:getEffectiveDateTime, - endDate:getFailureDateTime, - addType:'1', - pwdRight:state.isAdministrator.value == true ? 1 : 0 - ); + lockId: lockId, + keyboardPwdName: state.nameController.text, + keyboardPwd: state.pwdController.text, + keyboardPwdType: getKeyType, + startDate: getEffectiveDateTime, + endDate: getFailureDateTime, + addType: '1', + pwdRight: state.isAdministrator.value == true ? 1 : 0); if (entity.errorCode!.codeIsSuccessful) { state.isSendSuccess.value = true; state.sendSucceedType.value = state.widgetType.value; @@ -189,10 +207,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { showToast('请输入密码'.tr); return; } - final PasswordKeyEntity entity = await ApiRepository.to.checkKeyboardpwdName( - lockId:state.keyInfo.value.lockId.toString(), - keyboardPwdName:state.nameController.text, - keyboardPwd:state.pwdController.text,); + final PasswordKeyEntity entity = + await ApiRepository.to.checkKeyboardpwdName( + lockId: state.keyInfo.value.lockId.toString(), + keyboardPwdName: state.nameController.text, + keyboardPwd: state.pwdController.text, + ); if (entity.errorCode!.codeIsSuccessful) { senderCustomPasswords(); } else { @@ -204,9 +224,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { // 监听设备返回的数据 late StreamSubscription _replySubscription; void _initReplySubscription() { - _replySubscription = EventBusManager().eventBus!.on().listen((Reply reply) async { + _replySubscription = + EventBusManager().eventBus!.on().listen((Reply reply) async { // 设置自定义密码 - if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) { + if ((reply is SenderCustomPasswordsReply) && + (state.ifCurrentScreen.value == true)) { final int status = reply.data[2]; switch (status) { case 0x00: @@ -218,33 +240,33 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { state.pwdNumber.value = listChangInt(reply.data.sublist(9, 11)); // AppLog.log("密码编号:${state.pwdNumber.value}"); - switch(reply.data[11]){ + switch (reply.data[11]) { case 0: // 成功 addKeyboardPwdRequest(); break; case 0xff: - // 注册人脸失败 + // 注册人脸失败 showToast('退出添加'.tr); break; case 0xFE: - // 管理员已满 + // 管理员已满 showToast('管理员已满'.tr); break; case 0xFD: - // 用户已满 + // 用户已满 showToast('用户已满'.tr); break; case 0xFC: - // 指纹已满 + // 指纹已满 showToast('锁上面添加密码已满'.tr); break; case 0xFB: - // 指纹已存在 + // 指纹已存在 showToast('密码已存在'.tr); break; default: - // 添加密码 + // 添加密码 break; } break; @@ -255,14 +277,20 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { final List saveStrList = changeIntListToStringList(token); Storage.setStringList(saveBlueToken, saveStrList); - final List? privateKey = await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = + await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = + changeStringListToIntList(privateKey!); - final List? signKey = await Storage.getStringList(saveBlueSignKey); - final List signKeyDataList = changeStringListToIntList(signKey!); + final List? signKey = + await Storage.getStringList(saveBlueSignKey); + final List signKeyDataList = + changeStringListToIntList(signKey!); - int startDate = DateTool().dateToTimestamp(state.customBeginTime.value, 1); - int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1); + int startDate = + DateTool().dateToTimestamp(state.customBeginTime.value, 1); + int endDate = + DateTool().dateToTimestamp(state.customEndTime.value, 1); //非永久 须有时限 if (state.isPermanent.value == true) { startDate = 0; @@ -272,12 +300,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { keyID: '1', userID: await Storage.getUid(), pwdNo: 0, - pwd:state.pwdController.text, + pwd: state.pwdController.text, operate: 0, isAdmin: state.isAdministrator.value == true ? 1 : 0, useCountLimit: 0xffff, - startTime: startDate ~/1000, - endTime: endDate ~/1000, + startTime: startDate ~/ 1000, + endTime: endDate ~/ 1000, needAuthor: 1, isBeforeAddUser: false, signKey: signKeyDataList, @@ -311,7 +339,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1); //非永久 须有时限 if (state.isPermanent.value == false) { - if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) { + if (startDate < + DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) { showToast('生效时间要大于当前时间'); return; } @@ -320,33 +349,38 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { showToast('失效时间需大于生效时间'); return; } - }else{ + } else { startDate = 0; endDate = 0; } - if (state.pwdController.text.length < 6 || state.pwdController.text.length > 9) { + if (state.pwdController.text.length < 6 || + state.pwdController.text.length > 9) { showToast('请输入6-9位数字密码'); return; } - if(state.sureBtnState.value == 1){ + if (state.sureBtnState.value == 1) { return; } state.sureBtnState.value = 1; showEasyLoading(); - showBlueConnetctToastTimer(action: (){ + showBlueConnetctToastTimer(action: () { dismissEasyLoading(); state.sureBtnState.value = 0; }); - BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async { + BlueManage().blueSendData(BlueManage().connectDeviceName, + (BluetoothConnectionState deviceConnectionState) async { if (deviceConnectionState == BluetoothConnectionState.connected) { - final List? signKey = await Storage.getStringList(saveBlueSignKey); + final List? signKey = + await Storage.getStringList(saveBlueSignKey); final List signKeyDataList = changeStringListToIntList(signKey!); - final List? privateKey = await Storage.getStringList(saveBluePrivateKey); - final List getPrivateKeyList = changeStringListToIntList(privateKey!); + final List? privateKey = + await Storage.getStringList(saveBluePrivateKey); + final List getPrivateKeyList = + changeStringListToIntList(privateKey!); final List? token = await Storage.getStringList(saveBlueToken); final List getTokenList = changeStringListToIntList(token!); @@ -355,22 +389,23 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { keyID: '1', userID: await Storage.getUid(), pwdNo: 0, - pwd:state.pwdController.text, + pwd: state.pwdController.text, operate: 0, isAdmin: state.isAdministrator.value == true ? 1 : 0, useCountLimit: 0xffff, - startTime: startDate ~/1000, - endTime: endDate ~/1000, + startTime: startDate ~/ 1000, + endTime: endDate ~/ 1000, needAuthor: 1, isBeforeAddUser: false, signKey: signKeyDataList, privateKey: getPrivateKeyList, token: getTokenList); - } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { + } else if (deviceConnectionState == + BluetoothConnectionState.disconnected) { dismissEasyLoading(); cancelBlueConnetctToastTimer(); state.sureBtnState.value = 0; - if(state.ifCurrentScreen.value == true){ + if (state.ifCurrentScreen.value == true) { showBlueConnetctToast(); } } @@ -393,24 +428,25 @@ class PasswordKeyPerpetualLogic extends BaseGetXController { case 1: //限时 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效 useDateStr = - '类型:限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}'; + '类型:限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}'; break; case 2: //单次 只能在开始时间后6小时内使用一次 useDateStr = - '类型:单次\n有效期:${state.beginTime.value} -- ${state.endTime.value}'; + '类型:单次\n有效期:${state.beginTime.value} -- ${state.endTime.value}'; + break; + case 3: + //自定义 + if (state.isPermanent.value == false) { + '类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}'; + } else { + useDateStr = '类型:自定义-永久'; + } break; - case 3: - //自定义 - if (state.isPermanent.value == false) { - '类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}'; - } else { - useDateStr = '类型:自定义-永久'; - } - break; case 4: //周未循环 在周未开始和结束时间指定时间段内有效 - useDateStr = '类型:循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}'; + useDateStr = + '类型:循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}'; break; case 5: //删除 4 在锁上使用后会删除之前在锁上使用过的密码 diff --git a/lib/main/lockMian/entity/lockListInfo_entity.dart b/lib/main/lockMian/entity/lockListInfo_entity.dart index 4e484fc3..c3a63756 100755 --- a/lib/main/lockMian/entity/lockListInfo_entity.dart +++ b/lib/main/lockMian/entity/lockListInfo_entity.dart @@ -70,7 +70,9 @@ class GroupList { List? lockList; bool _isChecked = false; + bool get isChecked => _isChecked ?? false; + set isChecked(bool value) => _isChecked = value; GroupList({this.groupName, this.groupId, this.lockList}); @@ -131,41 +133,44 @@ class LockListInfoItemEntity { LockFeature? lockFeature; LockSetting? lockSetting; int? hasGateway; + String? mac; - LockListInfoItemEntity( - {this.keyId, - this.lockId, - this.lockName, - this.lockAlias, - this.electricQuantity, - this.fwVersion, - this.hwVersion, - this.keyType, - this.passageMode, - this.userType, - this.startDate, - this.endDate, - this.weekDays, - this.remoteEnable, - this.faceAuthentication, - this.lastFaceValidateTime, - this.nextFaceValidateTime, - this.keyRight, - this.keyStatus, - this.isLockOwner, - this.bluetooth, - this.lockFeature, - this.lockSetting, - this.sendDate, - this.lockUserNo, - this.electricQuantityDate, - this.electricQuantityStandby, - this.senderUserId, - this.isOnlyManageSelf, - this.restoreCount, - this.model, - this.vendor, - this.hasGateway}); + LockListInfoItemEntity({ + this.keyId, + this.lockId, + this.lockName, + this.lockAlias, + this.electricQuantity, + this.fwVersion, + this.hwVersion, + this.keyType, + this.passageMode, + this.userType, + this.startDate, + this.endDate, + this.weekDays, + this.remoteEnable, + this.faceAuthentication, + this.lastFaceValidateTime, + this.nextFaceValidateTime, + this.keyRight, + this.keyStatus, + this.isLockOwner, + this.bluetooth, + this.lockFeature, + this.lockSetting, + this.sendDate, + this.lockUserNo, + this.electricQuantityDate, + this.electricQuantityStandby, + this.senderUserId, + this.isOnlyManageSelf, + this.restoreCount, + this.model, + this.vendor, + this.hasGateway, + this.mac, + }); LockListInfoItemEntity.fromJson(Map json) { keyId = json['keyId']; @@ -207,6 +212,7 @@ class LockListInfoItemEntity { ? LockSetting.fromJson(json['lockSetting']) : null; hasGateway = json['hasGateway']; + mac = json['mac']; } Map toJson() { @@ -250,12 +256,13 @@ class LockListInfoItemEntity { data['lockSetting'] = lockSetting!.toJson(); } data['hasGateway'] = hasGateway; + data['mac'] = mac; return data; } //是否是锁拥有者 也代表是超级管理员 - bool isLockOwnerBool(){ - return isLockOwner== 1; + bool isLockOwnerBool() { + return isLockOwner == 1; } } @@ -304,18 +311,20 @@ class LockFeature { int? videoIntercom; int? isSupportCatEye; int? isSupportBackupBattery; - LockFeature( - {this.password, - this.icCard, - this.fingerprint, - this.fingerVein, - this.palmVein, - this.isSupportIris, - this.d3Face, - this.bluetoothRemoteControl, - this.videoIntercom, - this.isSupportCatEye, - this.isSupportBackupBattery}); + + LockFeature({ + this.password, + this.icCard, + this.fingerprint, + this.fingerVein, + this.palmVein, + this.isSupportIris, + this.d3Face, + this.bluetoothRemoteControl, + this.videoIntercom, + this.isSupportCatEye, + this.isSupportBackupBattery, + }); LockFeature.fromJson(Map json) { password = json['password']; @@ -352,6 +361,7 @@ class LockSetting { int? attendance; int? appUnlockOnline; int? remoteUnlock; + LockSetting({ this.attendance, this.appUnlockOnline, diff --git a/lib/main/lockMian/lockList/lockList_xhj_page.dart b/lib/main/lockMian/lockList/lockList_xhj_page.dart index 54f439e8..37e18bef 100755 --- a/lib/main/lockMian/lockList/lockList_xhj_page.dart +++ b/lib/main/lockMian/lockList/lockList_xhj_page.dart @@ -14,7 +14,6 @@ import 'lockListGroup_view.dart'; import 'lockList_logic.dart'; class LockListXHJPage extends StatefulWidget { - const LockListXHJPage({required this.lockListInfoGroupEntity, Key? key}) : super(key: key); final LockListInfoGroupEntity lockListInfoGroupEntity; @@ -66,20 +65,15 @@ class _LockListXHJPageState extends State with RouteAware { ), ), Expanded( - child: ListView.separated( - itemCount: logic.groupDataList.length, - itemBuilder: (BuildContext context, int index) { - final GroupList itemData = logic.groupDataList[index]; - return _buildLockExpandedList(context, index, itemData); - }, - shrinkWrap: true, - physics: const AlwaysScrollableScrollPhysics(), - separatorBuilder: (BuildContext context, int index) { - return const Divider( - height: 1, - color: AppColors.greyLineColor, - ); - }), + child: ListView.builder( + itemCount: logic.groupDataList.length, + itemBuilder: (BuildContext context, int index) { + final GroupList itemData = logic.groupDataList[index]; + return _buildLockExpandedList(context, index, itemData); + }, + shrinkWrap: true, + physics: const AlwaysScrollableScrollPhysics(), + ), ), ], ), @@ -88,7 +82,8 @@ class _LockListXHJPageState extends State with RouteAware { } //设备多层级列表 - Widget _buildLockExpandedList(context, index, GroupList itemData) { + Widget _buildLockExpandedList( + BuildContext context, int index, GroupList itemData) { final List lockItemList = itemData.lockList ?? []; return LockListGroupView( @@ -111,7 +106,7 @@ class _LockListXHJPageState extends State with RouteAware { )); } - List forItems(List lockItemList) { + List forItems(List lockItemList) { final List list = []; for (int i = 0, j = 0; i < lockItemList.length; i++, j++) { final LockListInfoItemEntity keyInfo = lockItemList[i]; @@ -120,9 +115,9 @@ class _LockListXHJPageState extends State with RouteAware { isLast = true; } list.add(Slidable( - key: ValueKey(keyInfo.keyId), + key: ValueKey(keyInfo.keyId), endActionPane: ActionPane( - extentRatio: 0.2, + extentRatio: 0.5, motion: const ScrollMotion(), children: [ SlidableAction( @@ -133,6 +128,7 @@ class _LockListXHJPageState extends State with RouteAware { backgroundColor: Colors.red, foregroundColor: Colors.white, label: '删除'.tr, + borderRadius: BorderRadius.all(Radius.circular(20.w)), padding: EdgeInsets.only(left: 5.w, right: 5.w), ), ], @@ -141,24 +137,24 @@ class _LockListXHJPageState extends State with RouteAware { if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusWaitIneffective)) { - logic.showToast("您的钥匙未生效".tr); + logic.showToast('您的钥匙未生效'.tr); return; } if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusFrozen)) { - logic.showToast("您的钥匙已冻结".tr); + logic.showToast('您的钥匙已冻结'.tr); return; } if ((keyInfo.keyType == XSConstantMacro.keyTypeTime || keyInfo.keyType == XSConstantMacro.keyTypeLoop) && (keyInfo.keyStatus == XSConstantMacro.keyStatusExpired)) { - logic.showToast("您的钥匙已过期".tr); + logic.showToast('您的钥匙已过期'.tr); return; } Get.toNamed(Routers.lockDetailMainPage, arguments: { - "keyInfo": keyInfo, - "isOnlyOneData": false, + 'keyInfo': keyInfo, + 'isOnlyOneData': false, }); }), )); @@ -188,7 +184,7 @@ class _LockListXHJPageState extends State with RouteAware { borderRadius: BorderRadius.circular(20.w), ), child: Padding( - padding: EdgeInsets.symmetric(horizontal: 30.w, vertical: 10.h), + padding: EdgeInsets.symmetric(horizontal: 15.w, vertical: 5.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, @@ -197,27 +193,30 @@ class _LockListXHJPageState extends State with RouteAware { children: [ Image.asset( 'images/icon_lock_circle.png', - width: 32.r, - height: 32.r, + width: 48.r, + height: 48.r, color: AppColors.mainColor, ), ], ), SizedBox( - height: 15.h, + height: 10.h, + ), + FittedBox( + fit: BoxFit.scaleDown, + child: Text(keyInfo.lockAlias!, + style: TextStyle( + fontSize: 24.sp, + fontWeight: FontWeight.w500, + color: keyInfo.passageMode == 1 + ? AppColors.openPassageModeColor + : AppColors.darkGrayTextColor, + overflow: TextOverflow.ellipsis, + ), + maxLines: 1), ), - Text(keyInfo.lockAlias!, - style: TextStyle( - fontSize: 32.sp, - fontWeight: FontWeight.w500, - color: keyInfo.passageMode == 1 - ? AppColors.openPassageModeColor - : AppColors.darkGrayTextColor, - overflow: TextOverflow.ellipsis, - ), - maxLines: 1), Visibility( - visible: keyInfo.passageMode == 1 ? true : false, + visible: keyInfo.passageMode == 1, child: Padding( padding: EdgeInsets.only(top: 5.h), child: Row( @@ -228,7 +227,7 @@ class _LockListXHJPageState extends State with RouteAware { borderRadius: BorderRadius.circular(5.w), color: AppColors.openPassageModeColor, ), - child: Text("常开模式开启".tr, + child: Text('常开模式开启'.tr, style: TextStyle( fontSize: 18.sp, color: AppColors.appBarIconColor)), @@ -237,14 +236,13 @@ class _LockListXHJPageState extends State with RouteAware { ), )), Visibility( - visible: - keyInfo.lockSetting!.remoteUnlock == 1 ? true : false, + visible: keyInfo.lockSetting!.remoteUnlock == 1, child: Padding( padding: EdgeInsets.only(top: 5.h), child: Row( children: [ Text( - "远程开锁".tr, + '远程开锁'.tr, style: TextStyle( fontSize: 18.sp, color: AppColors.darkGrayTextColor), @@ -253,16 +251,14 @@ class _LockListXHJPageState extends State with RouteAware { ), )), Visibility( - visible: ((keyInfo.keyType == XSConstantMacro.keyTypeTime || - keyInfo.keyType == XSConstantMacro.keyTypeLoop) && - (keyInfo.keyStatus == - XSConstantMacro.keyStatusWaitIneffective || - keyInfo.keyStatus == - XSConstantMacro.keyStatusFrozen || - keyInfo.keyStatus == - XSConstantMacro.keyStatusExpired)) - ? true - : false, + visible: (keyInfo.keyType == XSConstantMacro.keyTypeTime || + keyInfo.keyType == XSConstantMacro.keyTypeLoop) && + (keyInfo.keyStatus == + XSConstantMacro.keyStatusWaitIneffective || + keyInfo.keyStatus == + XSConstantMacro.keyStatusFrozen || + keyInfo.keyStatus == + XSConstantMacro.keyStatusExpired), child: Padding( padding: EdgeInsets.only(top: 20.h), child: Row( @@ -292,9 +288,9 @@ class _LockListXHJPageState extends State with RouteAware { child: Text( keyInfo.isLockOwner == 1 ? '超级管理员'.tr - : (keyInfo.keyRight == 1 ? "授权管理员".tr : "普通用户".tr), + : (keyInfo.keyRight == 1 ? '授权管理员'.tr : '普通用户'.tr), style: TextStyle( - fontSize: 18.sp, color: AppColors.darkGrayTextColor), + fontSize: 16.sp, color: AppColors.darkGrayTextColor), ), ), Image.asset( @@ -304,9 +300,9 @@ class _LockListXHJPageState extends State with RouteAware { ), SizedBox(width: 2.w), Text( - "${keyInfo.electricQuantity!}%", + '${keyInfo.electricQuantity!}%', style: TextStyle( - fontSize: 18.sp, color: AppColors.darkGrayTextColor), + fontSize: 16.sp, color: AppColors.darkGrayTextColor), ), ], ), @@ -315,7 +311,7 @@ class _LockListXHJPageState extends State with RouteAware { keyInfo.startDate, keyInfo.endDate, keyInfo.keyType)) .join('\u{200B}'), style: TextStyle( - fontSize: 18.sp, color: AppColors.darkGrayTextColor), + fontSize: 16.sp, color: AppColors.darkGrayTextColor), ) ], ), @@ -326,7 +322,6 @@ class _LockListXHJPageState extends State with RouteAware { @override void didChangeDependencies() { - // TODO: implement didChangeDependencies super.didChangeDependencies(); /// 路由订阅 @@ -335,7 +330,6 @@ class _LockListXHJPageState extends State with RouteAware { @override void dispose() { - // TODO: implement dispose /// 取消路由订阅 AppRouteObserver().routeObserver.unsubscribe(this); super.dispose(); diff --git a/lib/main/lockMian/lockMain/lockMain_page.dart b/lib/main/lockMian/lockMain/lockMain_page.dart index 43ec0957..dea9f5db 100755 --- a/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/lib/main/lockMian/lockMain/lockMain_page.dart @@ -116,7 +116,7 @@ class _StarLockMainPageState extends State with BaseWidget { ); } child = F.sw( - defaultCall: () => child, + skyCall: () => child, xhjCall: () => Container( decoration: const BoxDecoration( image: DecorationImage( @@ -133,7 +133,7 @@ class _StarLockMainPageState extends State with BaseWidget { Widget returnWidget; if (type == 1) { - type = F.sw(defaultCall: () => 1, xhjCall: () => 2); + type = F.sw(skyCall: () => 1, xhjCall: () => 2); } switch (type) { case 0: @@ -152,7 +152,7 @@ class _StarLockMainPageState extends State with BaseWidget { // 有多条数据 Storage.setBool(ifIsDemoModeOrNot, false); returnWidget = F.sw( - defaultCall: () => LockListPage( + skyCall: () => LockListPage( lockListInfoGroupEntity: state.lockListInfoGroupEntity.value), xhjCall: () => LockListXHJPage( lockListInfoGroupEntity: state.lockListInfoGroupEntity.value)); diff --git a/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart b/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart index 4cf3cd43..c616b2f9 100755 --- a/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart +++ b/lib/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart @@ -12,6 +12,7 @@ import 'package:star_lock/mine/mall/lockMall_page.dart'; import 'package:star_lock/mine/message/messageList/messageList_page.dart'; import 'package:star_lock/mine/message/messageList/messageList_xhj_page.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart'; +import 'package:star_lock/mine/mineSet/mineSet/mineSet_page.dart'; import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/submitBtn.dart'; import 'package:star_lock/translations/trans_lib.dart'; @@ -76,7 +77,7 @@ class _StarLockMainXHJPageState extends State pageView( widget: SafeArea( bottom: false, - child: MinePersonInfoPage( + child: MineSetPage( showAppBar: false, showAbout: true, ), diff --git a/lib/mine/about/about_page.dart b/lib/mine/about/about_page.dart index 221a6c09..b688ccd4 100755 --- a/lib/mine/about/about_page.dart +++ b/lib/mine/about/about_page.dart @@ -50,7 +50,7 @@ class _AboutPageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: TranslationLoader.lanKeys!.about!.tr, haveBack: true, backgroundColor: AppColors.mainColor, @@ -67,11 +67,11 @@ class _AboutPageState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ F.sw( - defaultCall: () => logoView(), + skyCall: () => logoView(), xhjCall: () => const SizedBox()), listView(), F.sw( - defaultCall: () => const SizedBox(), + skyCall: () => const SizedBox(), xhjCall: () => logoView()), ], ), @@ -185,7 +185,7 @@ class _AboutPageState extends State { ], ); view = F.sw( - defaultCall: () => view, + skyCall: () => view, xhjCall: () => Container( margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w), decoration: BoxDecoration( @@ -221,7 +221,7 @@ class _AboutPageState extends State { borderRadius: BorderRadius.circular(20.r), child: Image.asset( F.sw( - defaultCall: () => "images/icon_main_1024.png", + skyCall: () => "images/icon_main_1024.png", xhjCall: () => "images/icon_main_xhj_1024.png"), width: 160.w, height: 160.w), diff --git a/lib/mine/about/webviewShow_page.dart b/lib/mine/about/webviewShow_page.dart index 425bd675..474ec986 100755 --- a/lib/mine/about/webviewShow_page.dart +++ b/lib/mine/about/webviewShow_page.dart @@ -26,7 +26,7 @@ class _WebviewShowPageState extends State { @override Widget build(BuildContext context) { state.webViewController.loadRequest(Uri.parse(state.webURL)); - return F.sw(defaultCall: () => defaultView(), xhjCall: () => xhjView()); + return F.sw(skyCall: () => defaultView(), xhjCall: () => xhjView()); } Widget defaultView() { diff --git a/lib/mine/addLock/addLock/addLock_page.dart b/lib/mine/addLock/addLock/addLock_page.dart index 55dd9fc4..7c9e2660 100755 --- a/lib/mine/addLock/addLock/addLock_page.dart +++ b/lib/mine/addLock/addLock/addLock_page.dart @@ -32,7 +32,7 @@ class _AddLockPageState extends State with BaseWidget { return Scaffold( backgroundColor: Colors.white, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: TranslationLoader.lanKeys!.addLock!.tr, haveBack: true, backgroundColor: AppColors.mainColor, diff --git a/lib/mine/addLock/nearbyLock/nearbyLock_page.dart b/lib/mine/addLock/nearbyLock/nearbyLock_page.dart index cdf99f97..08000e35 100755 --- a/lib/mine/addLock/nearbyLock/nearbyLock_page.dart +++ b/lib/mine/addLock/nearbyLock/nearbyLock_page.dart @@ -28,7 +28,7 @@ class _NearbyLockPageState extends State with RouteAware { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: TranslationLoader.lanKeys!.nearbyLock!.tr, haveBack: true, backgroundColor: AppColors.mainColor, diff --git a/lib/mine/addLock/selectLockType/selectLockType_page.dart b/lib/mine/addLock/selectLockType/selectLockType_page.dart index 56e8b862..4b50c400 100755 --- a/lib/mine/addLock/selectLockType/selectLockType_page.dart +++ b/lib/mine/addLock/selectLockType/selectLockType_page.dart @@ -27,7 +27,7 @@ class _SelectLockTypePageState extends State return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: TranslationLoader.lanKeys!.selectLockType!.tr, haveBack: true, backgroundColor: AppColors.mainColor, @@ -52,7 +52,7 @@ class _SelectLockTypePageState extends State //锁列表控件 Widget lockTypeList() { Widget view = F.sw( - defaultCall: () => GridView.count( + skyCall: () => GridView.count( crossAxisCount: 2, childAspectRatio: 2.83, crossAxisSpacing: 10, @@ -162,7 +162,7 @@ class _SelectLockTypePageState extends State //风格区分 view = F.sw( - defaultCall: () => Container( + skyCall: () => Container( height: 150.h, color: Colors.white, margin: const EdgeInsets.all(10), @@ -195,7 +195,7 @@ class _SelectLockTypePageState extends State child: Container( height: 120.h, decoration: F.sw( - defaultCall: () => const BoxDecoration( + skyCall: () => const BoxDecoration( color: Colors.white, ), xhjCall: () => BoxDecoration( diff --git a/lib/mine/mall/lockMall_page.dart b/lib/mine/mall/lockMall_page.dart index 0a123dbb..ef7614c6 100755 --- a/lib/mine/mall/lockMall_page.dart +++ b/lib/mine/mall/lockMall_page.dart @@ -39,13 +39,13 @@ class _LockMallPageState extends State { barTitle: getWebTitle(logic), haveBack: logic.state.canGoBack || logic.state.allowReturn, backgroundColor: F.sw( - defaultCall: () => AppColors.mainColor, + skyCall: () => AppColors.mainColor, xhjCall: () => Colors.white), titleColor: F.sw( - defaultCall: () => null, + skyCall: () => null, xhjCall: () => AppColors.blackColor), iconColor: F.sw( - defaultCall: () => null, + skyCall: () => null, xhjCall: () => AppColors.blackColor), backAction: () => logic.canGoBack(false), ) diff --git a/lib/mine/message/messageDetail/messageDetail_page.dart b/lib/mine/message/messageDetail/messageDetail_page.dart index 07fd571a..24d6b720 100755 --- a/lib/mine/message/messageDetail/messageDetail_page.dart +++ b/lib/mine/message/messageDetail/messageDetail_page.dart @@ -24,7 +24,7 @@ class _MessageDetailPageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: "消息详情".tr, haveBack: true, backgroundColor: AppColors.mainColor, @@ -60,7 +60,7 @@ class _MessageDetailPageState extends State { style: TextStyle(fontSize: 22.sp, color: AppColors.placeholderTextColor), ); return F.sw( - defaultCall: () => view, + skyCall: () => view, xhjCall: () => Container( padding: EdgeInsets.only( top: 20.h, bottom: 20.h, left: 20.w, right: 20.w), diff --git a/lib/mine/message/messageList/messageList_xhj_page.dart b/lib/mine/message/messageList/messageList_xhj_page.dart index abde4798..3ac5fe73 100755 --- a/lib/mine/message/messageList/messageList_xhj_page.dart +++ b/lib/mine/message/messageList/messageList_xhj_page.dart @@ -100,7 +100,7 @@ class _MessageListXHJPageState extends State mainAxisAlignment: MainAxisAlignment.center, children: [ Text( - '智能分析', + '智能分析'.tr, style: TextStyle( color: AppColors.blackColor, fontSize: 28.sp, @@ -108,7 +108,7 @@ class _MessageListXHJPageState extends State ), ), Text( - '精准识别设备事件,过滤无效信息', + '精准识别设备事件,过滤无效信息'.tr, style: TextStyle( color: AppColors.blackColor.withOpacity(0.6), fontSize: 20.sp, diff --git a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_page.dart b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_page.dart index 25bbe8ae..1b6dcd70 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_page.dart @@ -28,7 +28,7 @@ class _MineUnbindPhoneOrEmailState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: TranslationLoader.lanKeys!.modifyAccount!.tr, haveBack: true, backgroundColor: AppColors.mainColor, diff --git a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart index b3362b9a..ff8bb9d7 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccountNext/minePersonInfoEditAccountNext_page.dart @@ -27,7 +27,7 @@ class _MinePersonInfoEditAccountNextPageState return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: TranslationLoader.lanKeys!.modifyAccount!.tr, haveBack: true, backgroundColor: AppColors.mainColor, diff --git a/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart b/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart index f60d3493..ab1f17c7 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.dart @@ -28,7 +28,7 @@ class _MinePersonInfoEditNamePageState return Scaffold( backgroundColor: AppColors.greyBackgroundColor, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: TranslationLoader.lanKeys!.changeNickName!.tr, haveBack: true, backgroundColor: AppColors.mainColor, @@ -97,7 +97,7 @@ class _MinePersonInfoEditNamePageState ], ); view = F.sw( - defaultCall: () => view, + skyCall: () => view, xhjCall: () => Container( margin: EdgeInsets.only(top: 20.h, left: 16.w, right: 16.w), padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 16.w), diff --git a/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart b/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart index b1b89894..7da0e4cf 100755 --- a/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart @@ -30,7 +30,7 @@ class _MineBindPhoneOrEmailPageState extends State { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: state.channel.value == "1" ? TranslationLoader.lanKeys!.mobileNumber!.tr : TranslationLoader.lanKeys!.email!.tr, diff --git a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart index 31fa127c..d1f59d01 100755 --- a/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart @@ -4,7 +4,9 @@ import 'package:get/get.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/flavors.dart'; +import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart'; +import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart'; import 'package:star_lock/tools/custom_bottom_sheet.dart'; import '../../../appRouters.dart'; @@ -14,9 +16,8 @@ import '../../../tools/titleAppBar.dart'; import '../../../translations/trans_lib.dart'; class MinePersonInfoPage extends StatefulWidget { - MinePersonInfoPage({Key? key, this.showAppBar = true, this.showAbout = false}) + MinePersonInfoPage({Key? key, this.showAbout = false}) : super(key: key); - bool showAppBar; bool showAbout; @override @@ -24,69 +25,21 @@ class MinePersonInfoPage extends StatefulWidget { } class _MinePersonInfoPageState extends State { - final logic = Get.put(MinePersonInfoLogic()); - final state = Get.find().state; + final MinePersonInfoLogic logic = Get.put(MinePersonInfoLogic()); + final MinePersonInfoState state = Get.find().state; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: F.sw( - defaultCall: () => AppColors.mainBackgroundColor, + skyCall: () => AppColors.mainBackgroundColor, xhjCall: () => AppColors.mainBackgroundColor), - appBar: widget.showAppBar - ? TitleAppBar( + appBar: TitleAppBar( barTitle: TranslationLoader.lanKeys!.personalInformation!.tr, haveBack: true, - backgroundColor: AppColors.mainColor) - : null, + backgroundColor: AppColors.mainColor), body: Column( - children: [ - F.sw( - defaultCall: () => SizedBox(), - xhjCall: () => Container( - width: 1.sw, - height: 0.2.sw, - margin: - EdgeInsets.only(top: 15.h, left: 20.w, right: 20.w), - padding: EdgeInsets.symmetric(horizontal: 25.w), - decoration: BoxDecoration( - image: const DecorationImage( - image: AssetImage('images/xhj_main_bg.jpg'), - fit: BoxFit.cover, - ), - borderRadius: BorderRadius.circular(20.r), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.15), - offset: const Offset(0, 0), - blurRadius: 10.r, - spreadRadius: 0, - ), - ], - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '系统设置', - style: TextStyle( - color: AppColors.blackColor, - fontSize: 28.sp, - fontWeight: FontWeight.w600, - ), - ), - Text( - '系统的全局配置在此项内进行设置', - style: TextStyle( - color: AppColors.blackColor.withOpacity(0.6), - fontSize: 20.sp, - fontWeight: FontWeight.w600, - ), - ), - ], - ), - )), + children: [ SizedBox( height: 20.h, ), @@ -95,10 +48,10 @@ class _MinePersonInfoPageState extends State { child: ClipRRect( borderRadius: BorderRadius.circular(20.r), child: Column( - children: [ + children: [ Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.avatar!.tr, - rightTitle: "", + rightTitle: '', allHeight: 100.h, isHaveLine: true, isHaveDirection: true, @@ -119,15 +72,15 @@ class _MinePersonInfoPageState extends State { leftTitel: TranslationLoader.lanKeys!.nickName!.tr, rightTitle: state.mineInfoData.value.nickname != null ? state.mineInfoData.value.nickname! - : "", + : '', isHaveLine: true, isHaveDirection: true, action: () { Navigator.pushNamed( context, Routers.minePersonInfoEditNamePage, - arguments: { + arguments: { 'mineInfoData': state.mineInfoData.value - }).then((value) => logic.getUserInfoRequest()); + }).then((Object? value) => logic.getUserInfoRequest()); })), Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr, @@ -141,17 +94,17 @@ class _MinePersonInfoPageState extends State { if (state.mineInfoData.value.mobile!.isNotEmpty) { Navigator.pushNamed( context, Routers.mineUnbindPhoneOrEmailPage, - arguments: { + arguments: { 'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1' - }).then((value) => logic.getUserInfoRequest()); + }).then((Object? value) => logic.getUserInfoRequest()); } else { Navigator.pushNamed( context, Routers.mineBindPhoneOrEmailPage, - arguments: { + arguments: { 'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1' - }).then((value) => logic.getUserInfoRequest()); + }).then((Object? value) => logic.getUserInfoRequest()); } })), Obx(() => CommonItem( @@ -166,23 +119,23 @@ class _MinePersonInfoPageState extends State { if (state.mineInfoData.value.email!.isNotEmpty) { Navigator.pushNamed( context, Routers.mineUnbindPhoneOrEmailPage, - arguments: { + arguments: { 'isFrom': '2', 'email': state.mineInfoData.value.email! - }).then((value) => logic.getUserInfoRequest()); + }).then((Object? value) => logic.getUserInfoRequest()); } else { Navigator.pushNamed( context, Routers.mineBindPhoneOrEmailPage, - arguments: { + arguments: { 'isFrom': '2', 'email': state.mineInfoData.value.email! - }).then((value) => logic.getUserInfoRequest()); + }).then((Object? value) => logic.getUserInfoRequest()); } })), CommonItem( leftTitel: TranslationLoader.lanKeys!.resetPasswords!.tr, - rightTitle: "", + rightTitle: '', isHaveLine: true, isHaveDirection: true, action: () { @@ -192,15 +145,15 @@ class _MinePersonInfoPageState extends State { Obx(() => CommonItem( leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr, rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 - ? "去设置".tr - : "", + ? '去设置'.tr + : '', isHaveLine: true, isHaveDirection: true, action: () { if (state.mineInfoData.value.haveSafeAnswer == 0) { Navigator.pushNamed(context, Routers.minePersonInfoSetSafetyProblemPage) - .then((value) => logic.getUserInfoRequest()); + .then((Object? value) => logic.getUserInfoRequest()); } else { Navigator.pushNamed(context, Routers.minePersonInfoViewSafetyProblemPage); @@ -211,40 +164,11 @@ class _MinePersonInfoPageState extends State { TranslationLoader.lanKeys!.countryAndRegion!.tr, rightTitle: state.mineInfoData.value.countryName != null ? state.mineInfoData.value.countryName! - : "", + : '', isHaveLine: true, isHaveDirection: false)), - if (F.isLite == false && widget.showAbout) - CommonItem( - leftTitel: - TranslationLoader.lanKeys!.valueAddedServices!.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.back(); - Get.toNamed(Routers.valueAddedServicesPage); - }, - ), - if (widget.showAbout) - CommonItem( - leftTitel: TranslationLoader.lanKeys!.set!.tr, - isHaveLine: true, - isHaveDirection: true, - action: () { - Get.back(); - Get.toNamed(Routers.mineSetPage); - }, - ), - if (widget.showAbout) - CommonItem( - leftTitel: TranslationLoader.lanKeys!.about!.tr, - isHaveLine: false, - isHaveDirection: true, - action: () { - Get.back(); - Get.toNamed(Routers.aboutPage); - }, - ), + + ], ), ), @@ -261,7 +185,7 @@ class _MinePersonInfoPageState extends State { builder: (BuildContext context) { return AlertBottomWidget( topTitle: '', - items: const ['拍照', '从相册选择'], + items: const ['拍照', '从相册选择'], chooseCallback: logic.chooseCallback, ); }); diff --git a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart index 15fe701b..feb5d399 100755 --- a/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart @@ -30,7 +30,7 @@ class _MinePersonInfoResetPasswordPageState return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: TranslationLoader.lanKeys!.resetPasswords!.tr, haveBack: true, backgroundColor: AppColors.mainColor, @@ -140,7 +140,7 @@ class _MinePersonInfoResetPasswordPageState ], ); view = F.sw( - defaultCall: () => view, + skyCall: () => view, xhjCall: () => Container( margin: EdgeInsets.only( top: 20.h, diff --git a/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_page.dart b/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_page.dart index 6ff6bdb0..eaae73e9 100755 --- a/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_page.dart +++ b/lib/mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_page.dart @@ -37,7 +37,7 @@ class _MinePersonInfoSetSafetyProblemPageState return Scaffold( backgroundColor: AppColors.mainBackgroundColor, appBar: F.sw( - defaultCall: () => TitleAppBar( + skyCall: () => TitleAppBar( barTitle: TranslationLoader.lanKeys!.safetyProblem!.tr, haveBack: true, backgroundColor: AppColors.mainColor, @@ -137,7 +137,7 @@ class _MinePersonInfoSetSafetyProblemPageState ], ); view = F.sw( - defaultCall: () => view, + skyCall: () => view, xhjCall: () => Container( margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w), decoration: BoxDecoration( diff --git a/lib/mine/mineSet/mineSet/mineSet_logic.dart b/lib/mine/mineSet/mineSet/mineSet_logic.dart index 85ba2433..18bb111b 100755 --- a/lib/mine/mineSet/mineSet/mineSet_logic.dart +++ b/lib/mine/mineSet/mineSet/mineSet_logic.dart @@ -102,7 +102,7 @@ class MineSetLogic extends BaseGetXController { UdpHelp().closeUDP(); logOut(); BlueManage().disconnect(); - XSJPushProvider().initLocalNotification(true); + XSJPushProvider().initLocalNotification(isCancelLocalPush: true); Get.offNamedUntil(Routers.starLockLoginPage, (route) => false); } } diff --git a/lib/mine/mineSet/mineSet/mineSet_page.dart b/lib/mine/mineSet/mineSet/mineSet_page.dart index 01181525..e742ebeb 100755 --- a/lib/mine/mineSet/mineSet/mineSet_page.dart +++ b/lib/mine/mineSet/mineSet/mineSet_page.dart @@ -8,6 +8,7 @@ import 'package:get/get.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:star_lock/flavors.dart'; import 'package:star_lock/mine/mineSet/mineSet/mineSet_logic.dart'; +import 'package:star_lock/mine/mineSet/mineSet/mineSet_state.dart'; import 'package:star_lock/tools/appFirstEnterHandle.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; @@ -18,15 +19,18 @@ import '../../../tools/titleAppBar.dart'; import '../../../translations/trans_lib.dart'; class MineSetPage extends StatefulWidget { - const MineSetPage({Key? key}) : super(key: key); + MineSetPage({Key? key, this.showAppBar = true, this.showAbout = false}) + : super(key: key); + bool showAppBar; + bool showAbout; @override State createState() => _MineSetPageState(); } class _MineSetPageState extends State with WidgetsBindingObserver { - final logic = Get.put(MineSetLogic()); - final state = Get.find().state; + final MineSetLogic logic = Get.put(MineSetLogic()); + final MineSetState state = Get.find().state; @override void initState() { @@ -53,19 +57,21 @@ class _MineSetPageState extends State with WidgetsBindingObserver { return Scaffold( backgroundColor: AppColors.mainBackgroundColor, - appBar: F.sw( - defaultCall: () => TitleAppBar( - barTitle: TranslationLoader.lanKeys!.moreSet!.tr, - haveBack: true, - backgroundColor: AppColors.mainColor, - ), - xhjCall: () => TitleAppBar( - barTitle: TranslationLoader.lanKeys!.moreSet!.tr, - haveBack: true, - backgroundColor: Colors.white, - iconColor: AppColors.blackColor, - titleColor: AppColors.blackColor, - )), + appBar: widget.showAppBar + ? F.sw( + skyCall: () => TitleAppBar( + barTitle: TranslationLoader.lanKeys!.moreSet!.tr, + haveBack: true, + backgroundColor: AppColors.mainColor, + ), + xhjCall: () => TitleAppBar( + barTitle: TranslationLoader.lanKeys!.moreSet!.tr, + haveBack: true, + backgroundColor: Colors.white, + iconColor: AppColors.blackColor, + titleColor: AppColors.blackColor, + )) + : null, body: SingleChildScrollView( child: styleHierarchy(), ), @@ -76,24 +82,73 @@ class _MineSetPageState extends State with WidgetsBindingObserver { Widget styleHierarchy() { Widget view = getListDataView(); view = F.sw( - defaultCall: () => view, - xhjCall: () => Container( - margin: EdgeInsets.only( - top: 20.h, left: 20.w, right: 20.w, bottom: 40.h), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(20.r))), - child: ClipRRect( - borderRadius: BorderRadius.circular(20.r), - child: view, - ), + skyCall: () => view, + xhjCall: () => Column( + children: [ + 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( + 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( + '系统设置'.tr, + style: TextStyle( + color: AppColors.blackColor, + fontSize: 28.sp, + fontWeight: FontWeight.w600, + ), + ), + Text( + '系统的全局配置在此项内进行设置'.tr, + style: TextStyle( + color: AppColors.blackColor.withOpacity(0.6), + fontSize: 20.sp, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + Container( + margin: EdgeInsets.only( + top: 20.h, left: 20.w, right: 20.w, bottom: 40.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(20.r))), + child: ClipRRect( + borderRadius: BorderRadius.circular(20.r), + child: view, + ), + ), + F.sw(skyCall: () => const SizedBox(), xhjCall: keyBottomWidget), + ], )); return view; } Widget getListDataView() { return Column( - children: [ + children: [ /* 2024-01-12 会议确定去掉“提示音、触摸开锁” by DaisyWu CommonItem( leftTitel: TranslationLoader.lanKeys!.prompTone!.tr, @@ -114,29 +169,42 @@ class _MineSetPageState extends State with WidgetsBindingObserver { height: 50.h, child: Obx(() => _isTouchUnlockSwitch()))), */ + F.sw( + skyCall: () => const SizedBox(), + xhjCall: () => CommonItem( + leftTitel: TranslationLoader.lanKeys!.personalInformation!.tr, + rightTitle: '', + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.toNamed(Routers.minePersonInfoPage); + })), CommonItem( leftTitel: TranslationLoader.lanKeys!.pushNotification!.tr, - rightTitle: "", + rightTitle: '', isHaveRightWidget: true, - isHaveLine: F.appFlavor == Flavor.sky ? true : false, + isHaveLine: F.sw( + skyCall: () => F.appFlavor == Flavor.sky, xhjCall: () => true), rightWidget: SizedBox( width: 60.w, height: 50.h, - child: Obx(() => _isPushNotificationSwitch()))), - F.appFlavor == Flavor.sky - ? CommonItem( - leftTitel: "微信公众号推送".tr, - rightTitle: "", - isHaveRightWidget: true, - rightWidget: SizedBox( - width: 60.w, - height: 50.h, - child: Obx(() => _isWechatPublicAccountPushSwitch()))) - : Container(), + child: Obx(_isPushNotificationSwitch))), + if (F.appFlavor == Flavor.sky) + CommonItem( + leftTitel: '微信公众号推送'.tr, + rightTitle: '', + isHaveLine: true, + isHaveRightWidget: true, + rightWidget: SizedBox( + width: 60.w, + height: 50.h, + child: Obx(_isWechatPublicAccountPushSwitch))) + else + Container(), SizedBox(height: 10.h), CommonItem( leftTitel: TranslationLoader.lanKeys!.lockUserManagement!.tr, - rightTitle: "", + rightTitle: '', isHaveLine: true, isHaveDirection: true, action: () { @@ -144,7 +212,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { }), CommonItem( leftTitel: TranslationLoader.lanKeys!.authorizedAdmin!.tr, - rightTitle: "", + rightTitle: '', isHaveLine: true, isHaveDirection: true, action: () { @@ -153,7 +221,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { //by DaisyWu 新增--批量授权 CommonItem( leftTitel: TranslationLoader.lanKeys!.authorityManagement!.tr, - rightTitle: "", + rightTitle: '', isHaveLine: true, isHaveDirection: true, action: () { @@ -162,7 +230,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { }), CommonItem( leftTitel: TranslationLoader.lanKeys!.lockGroup!.tr, - rightTitle: "", + rightTitle: '', isHaveLine: true, isHaveDirection: true, action: () { @@ -170,7 +238,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { }), CommonItem( leftTitel: TranslationLoader.lanKeys!.transferSmartLock!.tr, - rightTitle: "", + rightTitle: '', isHaveLine: true, isHaveDirection: true, action: () { @@ -178,7 +246,8 @@ class _MineSetPageState extends State with WidgetsBindingObserver { }), CommonItem( leftTitel: TranslationLoader.lanKeys!.transferGateway!.tr, - rightTitle: "", + rightTitle: '', + isHaveLine: true, isHaveDirection: true, action: () { Get.toNamed(Routers.selectGetewayListPage); @@ -224,16 +293,17 @@ class _MineSetPageState extends State with WidgetsBindingObserver { isHaveDirection: true, action: () { Navigator.pushNamed( - context, Routers.hideInvalidUnlockPermissionsPage, - arguments: {'isOn': state.hideExpiredAccessFlag.value}) - .then((value) { + context, Routers.hideInvalidUnlockPermissionsPage, + arguments: { + 'isOn': state.hideExpiredAccessFlag.value + }).then((Object? value) { logic.userSettingsInfoRequest(); }); })), CommonItem( leftTitel: TranslationLoader .lanKeys!.appUnlockRequiresMobilePhoneAccessToTheLock!.tr, - rightTitle: "", + rightTitle: '', // allHeight: 100.h, isHaveLine: true, isHaveDirection: true, @@ -245,41 +315,58 @@ class _MineSetPageState extends State with WidgetsBindingObserver { height: 10.h, ), //上架审核注释 - F.isLite - ? Container() - : CommonItem( - leftTitel: "Amazon Alexa", - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - logic.showToast("功能暂未开放".tr); - }), - F.isLite - ? Container() - : CommonItem( - leftTitel: "Google Home", - rightTitle: "", - isHaveLine: true, - isHaveDirection: true, - action: () { - logic.showToast("功能暂未开放".tr); - }), - F.isLite - ? Container() - : CommonItem( - leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr, - rightTitle: "", - isHaveLine: false, - isHaveDirection: true, - action: () { - logic.showToast("功能暂未开放".tr); - }), + if (!F.isLite) + CommonItem( + leftTitel: 'Amazon Alexa', + rightTitle: '', + isHaveLine: true, + isHaveDirection: true, + action: () { + logic.showToast('功能暂未开放'.tr); + }), + if (!F.isLite) + CommonItem( + leftTitel: 'Google Home', + rightTitle: '', + isHaveLine: true, + isHaveDirection: true, + action: () { + logic.showToast('功能暂未开放'.tr); + }), + if (!F.isLite) + CommonItem( + leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr, + rightTitle: '', + isHaveLine: widget.showAbout, + isHaveDirection: true, + action: () { + logic.showToast('功能暂未开放'.tr); + }), + if (!F.isLite && widget.showAbout) + CommonItem( + leftTitel: TranslationLoader.lanKeys!.valueAddedServices!.tr, + isHaveLine: true, + isHaveDirection: true, + action: () { + Get.back(); + Get.toNamed(Routers.valueAddedServicesPage); + }, + ), + if (widget.showAbout) + CommonItem( + leftTitel: TranslationLoader.lanKeys!.about!.tr, + isHaveLine: false, + isHaveDirection: true, + action: () { + Get.back(); + Get.toNamed(Routers.aboutPage); + }, + ), // CommonItem(leftTitel:TranslationLoader.lanKeys!.valueAddedServices!.tr, rightTitle:"", isHaveDirection: true, action: (){ // // }), SizedBox( - height: 50.h, + height: F.sw(skyCall: () => 50.h, xhjCall: () => 0.0), ), // CommonItem(leftTitel:TranslationLoader.lanKeys!.about!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){ // @@ -300,52 +387,56 @@ class _MineSetPageState extends State with WidgetsBindingObserver { // CommonItem(leftTitel:TranslationLoader.lanKeys!.thirdPartyInformationSharingList!.tr, rightTitle:"", isHaveLine: true, isHaveDirection: true, action: (){ // // }), - keyBottomWidget() + F.sw(skyCall: keyBottomWidget, xhjCall: () => const SizedBox()) ], ); } Widget keyBottomWidget() { - return Column( - children: [ - SubmitBtn( - btnName: TranslationLoader.lanKeys!.logout!.tr, - isDelete: true, - padding: EdgeInsets.symmetric(horizontal: 15.w), - onClick: () { - //退出登录 - ShowTipView().showIosTipWithContentDialog("确定要退出吗?".tr, () { - logic.userLogoutRequest(); - }); - // showLoginOutAlertTipDialog(); - }), - Container( - padding: EdgeInsets.only(right: 30.w, top: 30.h), - // color: Colors.red, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - TextButton( - child: Text( - TranslationLoader.lanKeys!.deleteAccount!.tr, - style: TextStyle( - color: AppColors.darkGrayTextColor, fontSize: 18.sp), + return Padding( + padding: F.sw( + skyCall: () => EdgeInsets.zero, + xhjCall: () => EdgeInsets.symmetric(horizontal: 15.w)), + child: Column( + children: [ + SubmitBtn( + btnName: TranslationLoader.lanKeys!.logout!.tr, + isDelete: true, + padding: EdgeInsets.symmetric(horizontal: 15.w), + onClick: () { + //退出登录 + ShowTipView().showIosTipWithContentDialog( + '确定要退出吗?'.tr, logic.userLogoutRequest); + // showLoginOutAlertTipDialog(); + }), + Container( + padding: EdgeInsets.only(right: 30.w, top: 30.h), + // color: Colors.red, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + TextButton( + child: Text( + TranslationLoader.lanKeys!.deleteAccount!.tr, + style: TextStyle( + color: AppColors.darkGrayTextColor, fontSize: 18.sp), + ), + onPressed: () { + ShowTipView().showIosTipWithContentDialog( + TranslationLoader.lanKeys!.deleteAccountTips!.tr, () { + //安全验证 + Get.toNamed(Routers.safeVerifyPage); + }); + }, ), - onPressed: () { - ShowTipView().showIosTipWithContentDialog( - TranslationLoader.lanKeys!.deleteAccountTips!.tr, () { - //安全验证 - Get.toNamed(Routers.safeVerifyPage); - }); - }, - ), - ], + ], + ), ), - ), - SizedBox( - height: 30.h, - ) - ], + SizedBox( + height: 30.h, + ) + ], + ), ); } @@ -411,7 +502,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, value: state.isPrompTone.value, - onChanged: (value) { + onChanged: (bool value) { state.isPrompTone.value = !state.isPrompTone.value; logic.updatePrompToneRequest(); }, @@ -424,7 +515,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, value: state.isTouchUnlock.value, - onChanged: (value) { + onChanged: (bool value) { state.isTouchUnlock.value = !state.isTouchUnlock.value; logic.updateTouchUnlockRequest(); }, @@ -438,7 +529,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, value: state.isWechatPublicAccountPush.value, - onChanged: (value) { + onChanged: (bool value) { state.isWechatPublicAccountPush.value = !state.isWechatPublicAccountPush.value; logic.setMpWechatPushSwitchRequest(context); @@ -452,7 +543,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { trackColor: CupertinoColors.systemGrey5, thumbColor: CupertinoColors.white, value: state.isPushNotification.value, - onChanged: (value) { + onChanged: (bool value) { // state.isPushNotification.value = !state.isPushNotification.value; openAppSettings(); }, @@ -474,7 +565,7 @@ class _MineSetPageState extends State with WidgetsBindingObserver { IOSFlutterLocalNotificationsPlugin>() ?.requestPermissions( alert: true, - badge: true, + badge: false, sound: true, ) ?? false; diff --git a/lib/network/api_provider_base.dart b/lib/network/api_provider_base.dart index 5698314a..00f2c2ae 100755 --- a/lib/network/api_provider_base.dart +++ b/lib/network/api_provider_base.dart @@ -26,7 +26,7 @@ class BaseProvider extends GetConnect with Api { Future> post( String? url, body, { - String? contentType = "application/json", + String? contentType = 'application/json', Map? headers, Map? query, Decoder? decoder, @@ -35,7 +35,7 @@ class BaseProvider extends GetConnect with Api { bool? isUnShowLoading = false, // 是否显示loading bool? isUserBaseUrl = true, // 文件上传不使用baseUrl }) async { - AppLog.log("post: url:$url body:$body"); + AppLog.log('post: url:$url body:$body'); if (isUnShowLoading == false){ EasyLoading.show(); } @@ -55,14 +55,14 @@ class BaseProvider extends GetConnect with Api { // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); if (res.statusCode == null) { - EasyLoading.showToast("网络访问失败,请检查网络是否正常".tr, duration: 2000.milliseconds); + EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); } var rs = { - "errorMsg": "Network Error!", - "errorCode": -1, - "data": null, - "description": "表示成功或是。" + 'errorMsg': 'Network Error!', + 'errorCode': -1, + 'data': null, + 'description': '表示成功或是。' }; return Response( request: res.request, @@ -78,24 +78,24 @@ class BaseProvider extends GetConnect with Api { } getDataResult(T) { - switch (T["errorCode"]) { + switch (T['errorCode']) { case 403: Get.offNamedUntil(Routers.starLockLoginPage, (route) => false); break; case 500: - EasyLoading.showToast("服务器错误", duration: 2000.milliseconds); + EasyLoading.showToast('服务器错误', duration: 2000.milliseconds); break; case 421: case 422: case 430: //与葛工约定弹出ErrorMsg - EasyLoading.showToast(T["errorMsg"], duration: 2000.milliseconds); + EasyLoading.showToast(T['errorMsg'], duration: 2000.milliseconds); break; //已单独处理,暂不做全局弹窗 // case 425: // Toast.show(msg: "用户不存在"); // break; case 10001: - EasyLoading.showToast("数据不存在", duration: 2000.milliseconds); + EasyLoading.showToast('数据不存在', duration: 2000.milliseconds); break; } } diff --git a/lib/starLockApplication/starLockApplication.dart b/lib/starLockApplication/starLockApplication.dart index 9892fc65..a1757e8a 100755 --- a/lib/starLockApplication/starLockApplication.dart +++ b/lib/starLockApplication/starLockApplication.dart @@ -42,20 +42,20 @@ class _StarLockApplicationState extends State { if (snapshot.data!) { // 如果用户已登录,返回主页面 return F.sw( - defaultCall: () => StarLockMainPage(), + skyCall: () => StarLockMainPage(), xhjCall: () => const StarLockMainXHJPage()); } else { // 如果用户未登录,返回登录页面 AppFirstEnterHandle().getAppFirstEnter(isAgreePrivacy); return F.sw( - defaultCall: () => const StarLockLoginPage(), + skyCall: () => const StarLockLoginPage(), xhjCall: () => const StarLockLoginXHJPage()); } } else { // 如果没有数据,返回一个空白的小部件 return F.sw( - defaultCall: () => const StarLockLoginPage(), + skyCall: () => const StarLockLoginPage(), xhjCall: () => const StarLockLoginXHJPage()); } }, diff --git a/lib/tools/appFirstEnterHandle.dart b/lib/tools/appFirstEnterHandle.dart index 7df8acf6..4e8d2ba8 100755 --- a/lib/tools/appFirstEnterHandle.dart +++ b/lib/tools/appFirstEnterHandle.dart @@ -51,7 +51,7 @@ class AppFirstEnterHandle { return PopScope( canPop: false, child: F.sw( - defaultCall: () => _defaultPrivacyAgreementAlert(context), + skyCall: () => _defaultPrivacyAgreementAlert(context), xhjCall: () => _xhjPrivacyAgreementAlert(context))); }, ); diff --git a/lib/tools/tf_loginInput.dart b/lib/tools/tf_loginInput.dart index d5df86e1..b98da00f 100755 --- a/lib/tools/tf_loginInput.dart +++ b/lib/tools/tf_loginInput.dart @@ -123,7 +123,7 @@ class _LoginInputState extends State { Padding( padding: EdgeInsets.only( top: - F.sw(defaultCall: () => 27.h, xhjCall: () => 39.h)), + F.sw(skyCall: () => 27.h, xhjCall: () => 39.h)), child: Text( pwd, style: TextStyle( diff --git a/lib/tools/xs_jPhush.dart b/lib/tools/xs_jPhush.dart index 40b1cad8..fb3f9eec 100755 --- a/lib/tools/xs_jPhush.dart +++ b/lib/tools/xs_jPhush.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:jpush_flutter/jpush_flutter.dart'; +import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_entity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/storage.dart'; @@ -12,63 +13,72 @@ import '../app_settings/app_settings.dart'; class XSJPushProvider { final JPush jpush = JPush(); +// appKey: 251fc8074820d122b6de58d2--鑫泓佳AppKey +// appKey: 7ff37d174c1a568a89e98dad--sky Future initJPushService() async { - final data = await Storage.getString(saveUserLoginData); - if (data != null && data.isNotEmpty) { - jpush.setup( - appKey: "7ff37d174c1a568a89e98dad", - channel: "flutter_channel", - production: false, - debug: false, - ); + final String? data = await Storage.getString(saveUserLoginData); + if (data == null || data.isEmpty) { + AppLog.log('No user data found.'); + return; + } - jpush.addEventHandler( - // 接收通知回调方法。 - onReceiveNotification: (Map message) async { - AppLog.log("flutter onReceiveNotification: $message"); - }, - // 点击通知回调方法。 - onOpenNotification: (Map message) async { - AppLog.log("flutter onOpenNotification: $message"); - }, - // 接收自定义消息回调方法。 - onReceiveMessage: (Map message) async { - AppLog.log("flutter onReceiveMessage: $message"); - }, - ); + jpush.setup( + appKey: '251fc8074820d122b6de58d2', + channel: 'flutter_channel', + production: false, + debug: true, + ); - jpush.applyPushAuthority( - const NotificationSettingsIOS(sound: true, alert: true, badge: true)); - // jpush.setChannelAndSound( - // channel: "flutter_channel", channelID: "115700", sound: "default"); + jpush.addEventHandler( + onReceiveNotification: (Map message) async { + AppLog.log('flutter onReceiveNotification: $message'); + }, + onOpenNotification: (Map message) async { + AppLog.log('flutter onOpenNotification: $message'); + }, + onReceiveMessage: (Map message) async { + AppLog.log('flutter onReceiveMessage: $message'); + }, + ); - // Platform messages may fail, so we use a try/catch PlatformException. - jpush.getRegistrationID().then((rid) { - AppLog.log("flutter get registration id : $rid"); - Storage.setString( - pushDeviceID, - rid, - ); - pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20); - }); + jpush.applyPushAuthority( + const NotificationSettingsIOS(sound: true, alert: true, badge: false), + ); + + try { + AppLog.log('Fetching registration ID...'); + final String rid = await jpush.getRegistrationID(); + AppLog.log('flutter get registration id : $rid'); + await Storage.setString(pushDeviceID, rid); + await pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20); + } catch (e) { + AppLog.log('Error getting registration ID: $e'); } } - void pushBindDeviceID(String deviceID, int deviceType) async { - var entity = await ApiRepository.to.pushBindAppId(deviceID, deviceType); - if (entity.errorCode!.codeIsSuccessful) { - AppLog.log("绑定成功"); + Future pushBindDeviceID(String deviceID, int deviceType) async { + try { + final MineUnbindPhoneOrEmailEntity entity = + await ApiRepository.to.pushBindAppId(deviceID, deviceType); + if (entity.errorCode!.codeIsSuccessful) { + AppLog.log('绑定成功'); + } else { + AppLog.log('绑定失败'); + } + } catch (e) { + AppLog.log('Error binding device ID: $e'); } } //本地通知初始化 isCancelLocalPush 是否取消所有本地通知 - initLocalNotification(bool isCancelLocalPush) async { + Future initLocalNotification({required bool isCancelLocalPush}) async { WidgetsFlutterBinding.ensureInitialized(); final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); - const AndroidInitializationSettings initializationSettingsAndroid = - AndroidInitializationSettings('app_icon'); + if (Platform.isAndroid) { + const AndroidInitializationSettings initializationSettingsAndroid = + AndroidInitializationSettings('app_icon'); const InitializationSettings initializationSettings = InitializationSettings(android: initializationSettingsAndroid); await flutterLocalNotificationsPlugin.initialize(initializationSettings); diff --git a/pubspec.yaml b/pubspec.yaml index dfc6975b..9ad06d59 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,8 +56,11 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.46+2024052004:打包给公司测试 # 1.0.47+2024052101:打包给欧阳回归测试 # 1.0.48+2024052201:打包给欧阳回归测试 +# 1.0.49+2024052401:xhj UI ,预发布环境 +# 1.0.50+2024052701:xhj UI ,预发布环境 +# 1.0.51+2024052801:xhj 线上环境,提审 -version: 1.0.48+2024052201 +version: 1.0.51+2024052801 environment: sdk: '>=2.12.0 <3.0.0' @@ -67,7 +70,7 @@ fluwx: debug_logging: true android: ios: - universal_link: https://lock.skychip.top/apple-app-site-association.json + universal_link: https://lock.skychip.top/apple-app-site-association.json # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -126,7 +129,7 @@ dependencies: url_launcher: ^6.1.10 #蓝牙 # flutter_reactive_ble: ^5.1.1 - flutter_blue_plus: 1.31.16 + flutter_blue_plus: 1.32.7 # event_bus: ^2.0.0 #菊花