Merge branch 'release' of gitee.com:starlock-cn/app-starlock into release

# Conflicts:
#	images/lan/lan_en.json
#	images/lan/lan_keys.json
#	images/lan/lan_zh.json
#	lib/network/api.dart
解决冲突
This commit is contained in:
Daisy 2024-06-04 14:47:05 +08:00
commit 088331a847
91 changed files with 1595 additions and 1044 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -679,7 +679,7 @@
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "After the password is generated, please use it once for activation before 23:59 on the same day, otherwise it will be invalid after 0 o'clock. After the password is activated, it can be used unlimited times within the validity period.", "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "After the password is generated, please use it once for activation before 23:59 on the same day, otherwise it will be invalid after 0 o'clock. After the password is activated, it can be used unlimited times within the validity period.",
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。": "After the password is generated, please use it before 23:59 on the same day, otherwise it will be invalid after 0 o'clock. The clear code is used to clear all the passwords generated before 0 o'clock today.", "密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。": "After the password is generated, please use it before 23:59 on the same day, otherwise it will be invalid after 0 o'clock. The clear code is used to clear all the passwords generated before 0 o'clock today.",
"密码生成后请在当日2359前使用否则过0点后失效。": "After the password is generated, please use it before 23:59 on the same day, otherwise it will be invalid after 0 o'clock.", "密码生成后请在当日2359前使用否则过0点后失效。": "After the password is generated, please use it before 23:59 on the same day, otherwise it will be invalid after 0 o'clock.",
"清空密码底部提示": "The password is valid until 24 o 'clock on the day of emptying\n Empty Content 1: All passwords generated before 0:00 of the day (Passwords generated after 0:00 of the day are not affected by clearing passwords and can continue to be used) \nEmpty content 2: Clear passwords Clear all custom passwords (used and unused) immediately after use \nTo completely clear all passwords, use the Reset All Passwords feature", "清空密码底部提示": "The password is valid until 23:59 on the day of emptying\n Empty Content 1: All passwords generated before 0:00 of the day (Passwords generated after 0:00 of the day are not affected by clearing passwords and can continue to be used) \nEmpty content 2: Clear passwords Clear all custom passwords (used and unused) immediately after use \nTo completely clear all passwords, use the Reset All Passwords feature",
"相机": "camera", "相机": "camera",
"相册": "photos", "相册": "photos",
"读写": "storage", "读写": "storage",
@ -865,5 +865,6 @@
"新建短信模版":"New SMS template", "新建短信模版":"New SMS template",
"自定义短信模版":"Custom SMS template", "自定义短信模版":"Custom SMS template",
"自定义邮件模版":"Custom email template", "自定义邮件模版":"Custom email template",
"名称":"Name" "名称":"Name",
"星星锁": "Star lock"
} }

View File

@ -897,5 +897,6 @@
"新建短信模版":"新建短信模版", "新建短信模版":"新建短信模版",
"自定义短信模版":"自定义短信模版", "自定义短信模版":"自定义短信模版",
"自定义邮件模版":"自定义邮件模版", "自定义邮件模版":"自定义邮件模版",
"名称":"名称" "名称":"名称",
"星星锁": "星星锁"
} }

View File

@ -681,7 +681,7 @@
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。", "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。": "密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。密码激活后有效期内不限次数使用。",
"密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。": "密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。", "密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。": "密码生成后请在当日2359前使用否则过0点后失效。清空码用于清空今天0点之前生成的所有密码。",
"密码生成后请在当日2359前使用否则过0点后失效。": "密码生成后请在当日2359前使用否则过0点后失效。", "密码生成后请在当日2359前使用否则过0点后失效。": "密码生成后请在当日2359前使用否则过0点后失效。",
"清空密码底部提示": "清空密码当日24点前有效\n清空内容1当日0点前生成的所有密码当日0点后生成的密码不受清空密码影响可继续使用\n清空内容2清空密码使用后立即清除所有自定义密码含使用过和未使用过的\n如需彻底清除所有密码请使用重置所有密码功能", "清空密码底部提示": "清空密码当日23:59前有效\n清空内容1当日0点前生成的所有密码当日0点后生成的密码不受清空密码影响可继续使用\n清空内容2清空密码使用后立即清除所有自定义密码含使用过和未使用过的\n如需彻底清除所有密码请使用重置所有密码功能",
"密码不一致哦": "密码不一致哦", "密码不一致哦": "密码不一致哦",
"相机": "相机", "相机": "相机",
"相册": "相册", "相册": "相册",
@ -865,5 +865,6 @@
"新建短信模版":"新建短信模版", "新建短信模版":"新建短信模版",
"自定义短信模版":"自定义短信模版", "自定义短信模版":"自定义短信模版",
"自定义邮件模版":"自定义邮件模版", "自定义邮件模版":"自定义邮件模版",
"名称":"名称" "名称":"名称",
"星星锁": "星星锁"
} }

View File

@ -153,6 +153,8 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
0420903B2C0EEAA50073E654 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
0420903C2C0EEAA60073E654 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
04BFC4482BCFE05100688FCA /* RunnerRelease-xhj.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "RunnerRelease-xhj.entitlements"; sourceTree = "<group>"; }; 04BFC4482BCFE05100688FCA /* RunnerRelease-xhj.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "RunnerRelease-xhj.entitlements"; sourceTree = "<group>"; };
0BEB3ADCCEC961E2916B9004 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; }; 0BEB3ADCCEC961E2916B9004 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
0D02C18E16914A687A4A1AC2 /* devDebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = devDebug.xcconfig; path = Flutter/devDebug.xcconfig; sourceTree = "<group>"; }; 0D02C18E16914A687A4A1AC2 /* devDebug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = devDebug.xcconfig; path = Flutter/devDebug.xcconfig; sourceTree = "<group>"; };
@ -619,11 +621,12 @@
}; };
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3"; compatibilityVersion = "Xcode 9.3";
developmentRegion = en; developmentRegion = "zh-Hans";
hasScannedForEncodings = 0; hasScannedForEncodings = 0;
knownRegions = ( knownRegions = (
en, en,
Base, Base,
"zh-Hans",
); );
mainGroup = 97C146E51CF9000F007C117D; mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */; productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
@ -830,6 +833,7 @@
isa = PBXVariantGroup; isa = PBXVariantGroup;
children = ( children = (
97C146FB1CF9000F007C117D /* Base */, 97C146FB1CF9000F007C117D /* Base */,
0420903B2C0EEAA50073E654 /* zh-Hans */,
); );
name = Main.storyboard; name = Main.storyboard;
sourceTree = "<group>"; sourceTree = "<group>";
@ -838,6 +842,7 @@
isa = PBXVariantGroup; isa = PBXVariantGroup;
children = ( children = (
97C147001CF9000F007C117D /* Base */, 97C147001CF9000F007C117D /* Base */,
0420903C2C0EEAA60073E654 /* zh-Hans */,
); );
name = LaunchScreen.storyboard; name = LaunchScreen.storyboard;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1034,6 +1039,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -1101,6 +1107,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -1298,6 +1305,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -1367,6 +1375,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -1436,6 +1445,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -1510,6 +1520,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -1579,6 +1590,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -1648,6 +1660,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -1720,6 +1733,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -1776,6 +1790,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -2118,6 +2133,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -2187,6 +2203,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -2261,6 +2278,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -2330,6 +2348,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
@ -2399,6 +2418,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon"; ASSETCATALOG_COMPILER_APPICON_NAME = "$(ASSET_PREFIX)AppIcon";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";

View File

@ -28,14 +28,14 @@
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>None</string> <string>None</string>
<key>CFBundleURLIconFile</key> <key>CFBundleURLIconFile</key>
<string/> <string></string>
<key>CFBundleURLName</key> <key>CFBundleURLName</key>
<string>com.sky.skysmartlock</string> <string>com.sky.skysmartlock</string>
<key>CFBundleURLSchemes</key> <key>CFBundleURLSchemes</key>
<array> <array>
<string>skysmartlock</string> <string>skysmartlock</string>
<string/> <string></string>
<string/> <string></string>
</array> </array>
</dict> </dict>
<dict> <dict>

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -26,7 +26,7 @@ class GetStarLockStatuInfoCommand extends SenderProtocol {
@override @override
String toString() { String toString() {
return 'GetStarLockStatuInfoCommand{lockID: $lockID, ' return 'GetStarLockStatuInfoCommand{lockID: $lockID, '
'utcTimeStamp:$utcTimeStamp utcTimeStamp: ${DateTool().dateIntToYMDHNString(utcTimeStamp)}, unixTimeStamp:unixTimeStamp unixTimeStamp: ${DateTool().dateIntToYMDHNString(unixTimeStamp)}, ' 'utcTimeStamp:$utcTimeStamp utcTimeStamp: ${DateTool().dateIntToYMDHNString(utcTimeStamp)}, unixTimeStamp:$unixTimeStamp unixTimeStamp: ${DateTool().dateIntToYMDHNString(unixTimeStamp)}, '
'userID: $userID, privateKey: $privateKey}'; 'userID: $userID, privateKey: $privateKey}';
} }

View File

@ -58,6 +58,8 @@ class StarLockLoginLogic extends BaseGetXController {
} }
} }
void changeAgreeState() { void changeAgreeState() {
_resetCanNext(); _resetCanNext();
} }

View File

@ -72,7 +72,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: leftTitel:
"${"你所在的".tr}${TranslationLoader.lanKeys!.countryAndRegion!.tr}", "${"你所在的".tr}${TranslationLoader.lanKeys!.countryAndRegion!.tr}",
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isPadding: false, isPadding: false,
isHaveRightWidget: true, isHaveRightWidget: true,
@ -179,8 +179,8 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
fontSize: 20.sp)), fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, arguments: { Get.toNamed(Routers.webviewShowPage, arguments: {
"url": XSConstantMacro.userAgreementURL, 'url': XSConstantMacro.userAgreementURL,
"title": '用户协议'.tr 'title': '用户协议'.tr
}); });
}, },
)), )),
@ -194,8 +194,8 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
fontSize: 20.sp)), fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, arguments: { Get.toNamed(Routers.webviewShowPage, arguments: {
"url": XSConstantMacro.privacyPolicyURL, 'url': XSConstantMacro.privacyPolicyURL,
"title": '隐私政策'.tr 'title': '隐私政策'.tr
}); });
}, },
)), )),

View File

@ -1,7 +1,9 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart'; import 'package:star_lock/login/register/entity/SendValidationCodeEntity.dart';
@ -32,6 +34,7 @@ class StarLockRegisterLogic extends BaseGetXController {
} }
Future<void> register() async { Future<void> register() async {
AppLog.log( AppLog.log(
'state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}'); 'state.pwd.value:${state.pwd.value} state.surePwd.value:${state.surePwd.value}');
if (state.pwd.value != state.surePwd.value) { if (state.pwd.value != state.surePwd.value) {
@ -47,6 +50,7 @@ class StarLockRegisterLogic extends BaseGetXController {
deviceInfo: state.deviceInfoMap.value); deviceInfo: state.deviceInfoMap.value);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('注册成功'.tr); showToast('注册成功'.tr);
Get.back(result: <String, String>{ Get.back(result: <String, String>{
'phoneOrEmailStr': state.phoneOrEmailStr.value, 'phoneOrEmailStr': state.phoneOrEmailStr.value,
'pwd': state.pwd.value 'pwd': state.pwd.value
@ -55,14 +59,13 @@ class StarLockRegisterLogic extends BaseGetXController {
} }
Future<void> sendValidationCode() async { Future<void> sendValidationCode() async {
final SendValidationCodeEntity entity = final SendValidationCodeEntity entity = await ApiRepository.to.sendValidationCodeUnLogin(
await ApiRepository.to.sendValidationCodeUnLogin( // state.countryCode.value,
// state.countryCode.value, countryCode: state.countryCode.value.toString(),
countryCode: state.countryCode.value.toString(), account: state.phoneOrEmailStr.value,
account: state.phoneOrEmailStr.value, channel: state.isIphoneType.value ? '1' : '2',
channel: state.isIphoneType.value ? '1' : '2', codeType: '1',
codeType: '1', xWidth: state.xWidth.value.toString());
xWidth: state.xWidth.value.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
_startTimer(); _startTimer();
} else {} } else {}

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -8,8 +9,8 @@ import 'package:star_lock/login/register/starLock_register_state.dart';
import '../../appRouters.dart'; import '../../appRouters.dart';
import '../../app_settings/app_colors.dart'; import '../../app_settings/app_colors.dart';
import '../../common/XSConstantMacro/XSConstantMacro.dart'; import '../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../tools/tf_loginInput.dart';
import '../../tools/submitBtn.dart'; import '../../tools/submitBtn.dart';
import '../../tools/tf_loginInput.dart';
import '../../tools/titleAppBar.dart'; import '../../tools/titleAppBar.dart';
import '../../translations/trans_lib.dart'; import '../../translations/trans_lib.dart';
import 'starLock_register_logic.dart'; import 'starLock_register_logic.dart';
@ -237,7 +238,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
), ),
), ),
hintText: hintText:
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}', '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}',
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
@ -264,7 +265,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
), ),
), ),
hintText: hintText:
'${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}', '${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}',
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
@ -285,7 +286,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
), ),
), ),
hintText: hintText:
'${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}', '${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}',
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(20), LengthLimitingTextInputFormatter(20),
]), ]),
@ -368,11 +369,10 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
style: TextStyle( style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)), color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
arguments: <String, String>{ 'url': XSConstantMacro.userAgreementURL,
'url': XSConstantMacro.userAgreementURL, 'title': '用户协议'.tr
'title': '用户协议'.tr });
});
}, },
)), )),
WidgetSpan( WidgetSpan(
@ -383,11 +383,10 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
style: TextStyle( style: TextStyle(
color: AppColors.mainColor, fontSize: 20.sp)), color: AppColors.mainColor, fontSize: 20.sp)),
onTap: () { onTap: () {
Get.toNamed(Routers.webviewShowPage, Get.toNamed(Routers.webviewShowPage, arguments: <String, String>{
arguments: <String, String>{ 'url': XSConstantMacro.privacyPolicyURL,
'url': XSConstantMacro.privacyPolicyURL, 'title': '隐私政策'.tr
'title': '隐私政策'.tr });
});
}, },
)), )),
], ],

View File

@ -5,39 +5,39 @@ import 'package:get/get.dart';
import '../../translations/trans_lib.dart'; import '../../translations/trans_lib.dart';
class StarLockRegisterState { class StarLockRegisterState {
StarLockRegisterState() {
resetResend();
}
final TextEditingController phoneOrEmailController = TextEditingController(); final TextEditingController phoneOrEmailController = TextEditingController();
final TextEditingController pwdController = TextEditingController(); final TextEditingController pwdController = TextEditingController();
final TextEditingController sureController = TextEditingController(); final TextEditingController sureController = TextEditingController();
final TextEditingController codeController = TextEditingController(); final TextEditingController codeController = TextEditingController();
var countryCode = "86".obs; RxString countryCode = '86'.obs;
var countryName = '中国'.tr.obs; RxString countryName = '中国'.tr.obs;
var phoneOrEmailStr = ''.obs; RxString phoneOrEmailStr = ''.obs;
var phoneOrEmailStrIsOK = false.obs; RxBool phoneOrEmailStrIsOK = false.obs;
var pwd = ''.obs; RxString pwd = ''.obs;
var surePwd = ''.obs; RxString surePwd = ''.obs;
var verificationCode = ''.obs; RxString verificationCode = ''.obs;
var xWidth = ''.obs; // RxString xWidth = ''.obs; //
var isIphoneType = true.obs; RxBool isIphoneType = true.obs;
var canSub = false.obs; RxBool canSub = false.obs;
var agree = false.obs; RxBool agree = false.obs;
bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value); bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value); bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty; bool get pwdIsOK => pwd.value.isNotEmpty && surePwd.value.isNotEmpty;
bool get codeIsOK => verificationCode.value.isNotEmpty; bool get codeIsOK => verificationCode.value.isNotEmpty;
var canResend = false.obs; RxBool canResend = false.obs;
var btnText = ''.obs; RxString btnText = ''.obs;
var totalSeconds = 120; int totalSeconds = 120;
var currentSecond = 120; int currentSecond = 120;
RxMap<String, dynamic> deviceInfoMap = <String, dynamic>{}.obs; RxMap<String, dynamic> deviceInfoMap = <String, dynamic>{}.obs;
StarLockRegisterState() {
resetResend();
}
void resetResend() { void resetResend() {
canResend.value = totalSeconds == currentSecond; canResend.value = totalSeconds == currentSecond;
btnText.value = !canResend.value btnText.value = !canResend.value

View File

@ -3,10 +3,6 @@ import 'dart:convert';
import 'package:azlistview/azlistview.dart'; import 'package:azlistview/azlistview.dart';
class CountryRegionEntity { class CountryRegionEntity {
int? errorCode;
String? description;
String? errorMsg;
List<CountryRegionModel>? dataList;
CountryRegionEntity( CountryRegionEntity(
{this.errorCode, this.description, this.errorMsg, this.dataList}); {this.errorCode, this.description, this.errorMsg, this.dataList});
@ -22,6 +18,10 @@ class CountryRegionEntity {
}); });
} }
} }
int? errorCode;
String? description;
String? errorMsg;
List<CountryRegionModel>? dataList;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -36,13 +36,6 @@ class CountryRegionEntity {
} }
class CountryRegionModel extends ISuspensionBean { class CountryRegionModel extends ISuspensionBean {
int? countryId;
String? name;
String? code;
String? flag;
String? abbreviation;
String? group;
String? tagIndex;
CountryRegionModel( CountryRegionModel(
{this.countryId, {this.countryId,
@ -61,6 +54,13 @@ class CountryRegionModel extends ISuspensionBean {
abbreviation = json['abbreviation']; abbreviation = json['abbreviation'];
group = json['group']; group = json['group'];
} }
int? countryId;
String? name;
String? code;
String? flag;
String? abbreviation;
String? group;
String? tagIndex;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};

View File

@ -1,7 +1,6 @@
export 'utils.dart';
export 'dart:convert'; export 'dart:convert';
export 'package:common_utils/common_utils.dart'; export 'package:common_utils/common_utils.dart';
export 'package:lpinyin/lpinyin.dart'; export 'package:lpinyin/lpinyin.dart';
export 'utils.dart';

View File

@ -48,7 +48,7 @@ class Utils {
height: 80.h, height: 80.h,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
SizedBox( SizedBox(
width: 20.w, width: 20.w,
), ),

View File

@ -21,8 +21,8 @@ class SelectCountryRegionPage extends StatefulWidget {
} }
class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> { class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
List<CountryRegionModel> countriesList = []; List<CountryRegionModel> countriesList = <CountryRegionModel>[];
List<CountryRegionModel> topCountriesList = []; List<CountryRegionModel> topCountriesList = <CountryRegionModel>[];
TextEditingController searchController = TextEditingController(); TextEditingController searchController = TextEditingController();
@override @override
@ -30,19 +30,17 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
super.initState(); super.initState();
SuspensionUtil.setShowSuspensionStatus(countriesList.cast<ISuspensionBean>()); SuspensionUtil.setShowSuspensionStatus(countriesList.cast<ISuspensionBean>());
Future.delayed(const Duration(milliseconds: 20), () { Future.delayed(const Duration(milliseconds: 20), getCountriesListRequest);
getCountriesListRequest();
});
} }
///json文件 ///json文件
Future<void> getCountriesListRequest() async { Future<void> getCountriesListRequest() async {
CountryRegionEntity entity = await ApiRepository.to.getCountryRegion('1'); final CountryRegionEntity entity = await ApiRepository.to.getCountryRegion('1');
countriesList.clear(); countriesList.clear();
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
countriesList.addAll(entity.dataList!); countriesList.addAll(entity.dataList!);
for(CountryRegionModel model in countriesList){ for(final CountryRegionModel model in countriesList){
if(model.name! == "中国"){ if(model.name! == '中国'){
topCountriesList.add(model); topCountriesList.add(model);
break; break;
} }
@ -56,10 +54,12 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
} }
void _handleList(List<CountryRegionModel> list) { void _handleList(List<CountryRegionModel> list) {
if (list.isEmpty) return; if (list.isEmpty) {
return;
}
for (int i = 0, length = list.length; i < length; i++) { for (int i = 0, length = list.length; i < length; i++) {
CountryRegionModel countryModel = list[i]; final CountryRegionModel countryModel = list[i];
String tag = countryModel.group!; final String tag = countryModel.group!;
if (RegExp('[A-Z]').hasMatch(tag)) { if (RegExp('[A-Z]').hasMatch(tag)) {
list[i].tagIndex = tag; list[i].tagIndex = tag;
} else { } else {
@ -85,12 +85,12 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
backgroundColor: const Color(0xFFFFFFFF), backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: barTitle:
"${TranslationLoader.lanKeys!.select!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}", '${TranslationLoader.lanKeys!.select!.tr} ${TranslationLoader.lanKeys!.countryAndRegion!.tr}',
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
), ),
body: Column( body: Column(
children: [ children: <Widget>[
KeySearchWidget( KeySearchWidget(
editingController: searchController, editingController: searchController,
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
@ -98,9 +98,9 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
if(searchController.text.isEmpty){ if(searchController.text.isEmpty){
getCountriesListRequest(); getCountriesListRequest();
}else{ }else{
var searchList = <CountryRegionModel>[]; final List<CountryRegionModel> searchList = <CountryRegionModel>[];
for (int i = 0, length = countriesList.length; i < length; i++) { for (int i = 0, length = countriesList.length; i < length; i++) {
CountryRegionModel countryModel = countriesList[i]; final CountryRegionModel countryModel = countriesList[i];
if(countryModel.name!.contains(searchController.text) || countryModel.code!.contains(searchController.text)){ if(countryModel.name!.contains(searchController.text) || countryModel.code!.contains(searchController.text)){
searchList.add(countryModel); searchList.add(countryModel);
} }
@ -116,25 +116,25 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
visible: searchController.text.isEmpty, visible: searchController.text.isEmpty,
child: Utils.getSusItem(context, '') child: Utils.getSusItem(context, '')
), ),
countriesList.isNotEmpty ? Visibility( if (countriesList.isNotEmpty) Visibility(
visible: searchController.text.isEmpty, visible: searchController.text.isEmpty,
child: Utils.getListItem(context, topCountriesList[0], () { child: Utils.getListItem(context, topCountriesList[0], () {
CountryRegionModel model = topCountriesList[0]; final CountryRegionModel model = topCountriesList[0];
Map<String, dynamic> resultMap = {}; final Map<String, dynamic> resultMap = {};
resultMap['code'] = model.code ?? ''; resultMap['code'] = model.code ?? '';
resultMap['countryId'] = model.countryId.toString() ?? ''; resultMap['countryId'] = model.countryId.toString() ?? '';
resultMap['countryName'] = model.name ?? '' ; resultMap['countryName'] = model.name ?? '' ;
Navigator.pop(context, resultMap); Navigator.pop(context, resultMap);
}) })
): Container(), ) else Container(),
Expanded( Expanded(
child: AzListView( child: AzListView(
data: countriesList, data: countriesList,
itemCount: countriesList.length, itemCount: countriesList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
CountryRegionModel model = countriesList[index]; final CountryRegionModel model = countriesList[index];
return Utils.getListItem(context, model, () { return Utils.getListItem(context, model, () {
Map<String, dynamic> resultMap = {}; final Map<String, dynamic> resultMap = {};
resultMap['code'] = model.code; resultMap['code'] = model.code;
resultMap['countryId'] = model.countryId.toString(); resultMap['countryId'] = model.countryId.toString();
resultMap['countryName'] = model.name; resultMap['countryName'] = model.name;
@ -144,11 +144,11 @@ class _SelectCountryRegionPageState extends State<SelectCountryRegionPage> {
}, },
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
susItemBuilder: (BuildContext context, int index) { susItemBuilder: (BuildContext context, int index) {
CountryRegionModel model = countriesList[index]; final CountryRegionModel model = countriesList[index];
String tag = model.getSuspensionTag(); final String tag = model.getSuspensionTag();
return Utils.getSusItem(context, tag); return Utils.getSusItem(context, tag);
}, },
indexBarData: const ['', ...kIndexBarData], indexBarData: const <String>['', ...kIndexBarData],
), ),
), ),
], ],

View File

@ -396,7 +396,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage>
maxLines: 1, maxLines: 1,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'), FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30), LengthLimitingTextInputFormatter(50),
], ],
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor), fontSize: 22.sp, color: AppColors.darkGrayTextColor),

View File

@ -1,6 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart'; import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdminList/authorizedAdminList_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
@ -13,7 +15,7 @@ class AuthorizedAdminListLogic extends BaseGetXController {
// //
Future<ElectronicKeyListEntity> mockNetworkDataRequest() async { Future<ElectronicKeyListEntity> mockNetworkDataRequest() async {
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList( final ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList(
endDate: '0', endDate: '0',
keyId: CommonDataManage().currentKeyInfo.keyId.toString(), keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
keyStatus: '', keyStatus: '',
@ -39,10 +41,10 @@ class AuthorizedAdminListLogic extends BaseGetXController {
// //
Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async { Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async {
ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey( final ElectronicKeyListEntity entity = await ApiRepository.to.deleteElectronicKey(
keyId: keyId, includeUnderlings: includeUnderlings); keyId: keyId, includeUnderlings: includeUnderlings);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功"); showToast('删除成功');
pageNo = 1; pageNo = 1;
mockNetworkDataRequest(); mockNetworkDataRequest();
} }
@ -59,22 +61,28 @@ class AuthorizedAdminListLogic extends BaseGetXController {
}); });
} }
//
Future<void> refreshIndividualKeys(
{required int lockId, required int keyId}) async {
final ElectronicKeyEntity entity =
await ApiRepository.to.electronicKey(lockId: lockId, keyId: keyId);
if (entity.errorCode!.codeIsSuccessful) {
final int index = state.itemDataList
.indexWhere((ElectronicKeyListItem item) => item.keyId == keyId);
state.itemDataList.removeAt(index);
state.itemDataList.insert(index, entity.data!);
}
}
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_getAuthorizedAdminPageRefreshUIAction(); _getAuthorizedAdminPageRefreshUIAction();
} }
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_getAuthorizedAdminPageRefreshUIEvent?.cancel(); _getAuthorizedAdminPageRefreshUIEvent?.cancel();
} }

View File

@ -1,3 +1,4 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
@ -12,6 +13,7 @@ import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/EasyRefreshTool.dart'; import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/customNetworkImage.dart';
import '../../../../tools/showTipView.dart'; import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
import '../../../../tools/titleAppBar.dart'; import '../../../../tools/titleAppBar.dart';
@ -139,7 +141,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
], ],
), ),
child: _electronicKeyItem( child: _electronicKeyItem(
'images/controls_user.png', indexEntity.headUrl!,
indexEntity.keyName!, indexEntity.keyName!,
useDateStr, useDateStr,
keyStatus, keyStatus,
@ -150,8 +152,11 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
'itemData': indexEntity, 'itemData': indexEntity,
}).then((Object? val) { }).then((Object? val) {
if (val != null) { if (val != null) {
logic.mockNetworkDataRequest(); logic
setState(() {}); .refreshIndividualKeys(
lockId: indexEntity.lockId!,
keyId: indexEntity.keyId!)
.then((dynamic value) => setState(() {}));
} }
}); });
}), }),
@ -191,14 +196,22 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
onTap: action, onTap: action,
child: Container( child: Container(
color: Colors.white, color: Colors.white,
height: 100.h, padding: EdgeInsets.only(top: 20.h, bottom: 20.h),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SizedBox(width: 30.w), SizedBox(width: 30.w),
Image.asset( SizedBox(
avatarURL,
width: 60.w, width: 60.w,
height: 60.w, height: 60.w,
child: ClipRRect(
borderRadius: BorderRadius.circular(30.w),
child: CustomNetworkImage(
url: avatarURL,
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
),
),
), ),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Expanded( Expanded(
@ -213,7 +226,7 @@ class _AuthorizedAdminListPageState extends State<AuthorizedAdminListPage> {
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: Text(receiveUser, child: Text(receiveUser,
maxLines: 1, maxLines: 3,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,

View File

@ -7,8 +7,8 @@ class AuthorizedAdminListState {
// final keyInfo = LockListInfoItemEntity().obs; // final keyInfo = LockListInfoItemEntity().obs;
// final lockMainEntity = LockMainEntity().obs; // final lockMainEntity = LockMainEntity().obs;
final itemDataList = <ElectronicKeyListItem>[].obs; final RxList<ElectronicKeyListItem> itemDataList = <ElectronicKeyListItem>[].obs;
final searchStr = ''.obs; final RxString searchStr = ''.obs;
// AuthorizedAdminListState() { // AuthorizedAdminListState() {
// Map map = Get.arguments; // Map map = Get.arguments;

View File

@ -1,12 +1,9 @@
import 'dart:ffi';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart';
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart'; import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import 'volumeAuthorizationLock_state.dart'; import 'volumeAuthorizationLock_state.dart';
@ -15,6 +12,16 @@ class VolumeAuthorizationLockLogic extends BaseGetXController {
// //
Future<void> addAuthorizedAdminRequest() async { Future<void> addAuthorizedAdminRequest() async {
if (state.keyNameController.text.isEmpty) {
showToast('请输入接收者姓名');
return;
}
if (state.lockIdList.isEmpty) {
showToast('请选择锁'.tr);
return;
}
String getFailureDateTime = '0'; String getFailureDateTime = '0';
String getEffectiveDateTime = '0'; String getEffectiveDateTime = '0';
if (state.selectWidgetType.value == '1') { if (state.selectWidgetType.value == '1') {
@ -23,11 +30,6 @@ class VolumeAuthorizationLockLogic extends BaseGetXController {
getEffectiveDateTime = getEffectiveDateTime =
state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
} }
if (state.lockIdList.isEmpty) {
showToast('请选择锁'.tr);
return;
}
final KeyDetailEntity entity = await ApiRepository.to.addAuthorizedAdmin( final KeyDetailEntity entity = await ApiRepository.to.addAuthorizedAdmin(
createUser: state.isCreateUser.value ? '1' : '0', createUser: state.isCreateUser.value ? '1' : '0',
endDate: getFailureDateTime, endDate: getFailureDateTime,

View File

@ -4,10 +4,8 @@ import 'package:get/get.dart';
class VolumeAuthorizationLockState { class VolumeAuthorizationLockState {
final FlutterContactPicker contactPicker = FlutterContactPicker(); final FlutterContactPicker contactPicker = FlutterContactPicker();
final TextEditingController emailOrPhoneController = final TextEditingController emailOrPhoneController = TextEditingController(); ///
TextEditingController(); /// final TextEditingController keyNameController = TextEditingController(); //
final TextEditingController keyNameController =
TextEditingController(); //
late Contact contact; late Contact contact;
RxList<int> lockIdList = <int>[].obs; RxList<int> lockIdList = <int>[].obs;
RxBool isSendSuccess = false.obs; RxBool isSendSuccess = false.obs;

View File

@ -323,7 +323,7 @@ class _AddCardPageState extends State<AddCardPage>
maxLines: 1, maxLines: 1,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'), FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18), LengthLimitingTextInputFormatter(50),
], ],
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor), fontSize: 22.sp, color: AppColors.darkGrayTextColor),

View File

@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -62,7 +63,10 @@ class _CardDetailPageState extends State<CardDetailPage> with RouteAware {
Get.back(); Get.back();
state.typeName.value = state.changeNameController.text; state.typeName.value = state.changeNameController.text;
logic.editICCardData(); logic.editICCardData();
}); }, inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
]);
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.keyType.value == 4 || visible: state.keyType.value == 4 ||

View File

@ -44,7 +44,8 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
isHaveRightWidget: true, isHaveRightWidget: true,
setHeight: false, setHeight: false,
rightWidget: getTFWidget( rightWidget: getTFWidget(
'(${TranslationLoader.lanKeys!.mustFillIn!.tr})')), '(${TranslationLoader.lanKeys!.mustFillIn!.tr})',
maxSize: 50)),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.startDate!.tr, leftTitel: TranslationLoader.lanKeys!.startDate!.tr,
rightTitle: state.beginDate.value.isEmpty rightTitle: state.beginDate.value.isEmpty
@ -123,7 +124,7 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
); );
} }
Widget getTFWidget(String tfStr) { Widget getTFWidget(String tfStr, {int maxSize = 30}) {
return Expanded( return Expanded(
child: TextField( child: TextField(
// //
@ -143,7 +144,7 @@ class _CheckingInAddHolidaysPageState extends State<CheckingInAddHolidaysPage> {
isCollapsed: true, isCollapsed: true,
), ),
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
LengthLimitingTextInputFormatter(30), LengthLimitingTextInputFormatter(maxSize),
], ],
), ),
); );

View File

@ -433,6 +433,8 @@ class _CheckingInListPageState extends State<CheckingInListPage> {
Expanded( Expanded(
child: Text( child: Text(
name!, name!,
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 24.sp), style: TextStyle(fontSize: 24.sp),
), ),
), ),

View File

@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_logic.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/electronicKeyDetail/electronicKeyDetail_state.dart';
import '../../../../../appRouters.dart'; import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
@ -27,8 +28,8 @@ class ElectronicKeyDetailPage extends StatefulWidget {
} }
class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> { class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
final logic = Get.put(ElectronicKeyDetailLogic()); final ElectronicKeyDetailLogic logic = Get.put(ElectronicKeyDetailLogic());
final state = Get.find<ElectronicKeyDetailLogic>().state; final ElectronicKeyDetailState state = Get.find<ElectronicKeyDetailLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -39,7 +40,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
barTitle: '钥匙详情'.tr, barTitle: '钥匙详情'.tr,
haveBack: true, haveBack: true,
actionsList: (state.keyType.value != 3) actionsList: (state.keyType.value != 3)
? [ ? <Widget>[
IconButton( IconButton(
icon: Image.asset( icon: Image.asset(
'images/icon_bar_more.png', 'images/icon_bar_more.png',
@ -54,7 +55,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
: null, : null,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: ListView( body: ListView(
children: [ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '姓名'.tr, leftTitel: '姓名'.tr,
rightTitle: state.keyName.value, rightTitle: state.keyName.value,
@ -62,7 +63,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveLine: true, isHaveLine: true,
action: () { action: () {
showCupertinoAlertDialog( showCupertinoAlertDialog(
tipsTitle: "修改姓名".tr, alertEnum: ShowAlertEnum.name); tipsTitle: '修改姓名'.tr, alertEnum: ShowAlertEnum.name);
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.isRealNameAuth.value, visible: state.isRealNameAuth.value,
@ -73,7 +74,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveLine: true, isHaveLine: true,
action: () { action: () {
showCupertinoAlertDialog( showCupertinoAlertDialog(
tipsTitle: "修改真实姓名".tr, tipsTitle: '修改真实姓名'.tr,
alertEnum: ShowAlertEnum.realName); alertEnum: ShowAlertEnum.realName);
}))), }))),
Obx(() => Visibility( Obx(() => Visibility(
@ -85,7 +86,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveLine: true, isHaveLine: true,
action: () { action: () {
showCupertinoAlertDialog( showCupertinoAlertDialog(
tipsTitle: "修改身份证号".tr, tipsTitle: '修改身份证号'.tr,
alertEnum: ShowAlertEnum.idCardNumber); alertEnum: ShowAlertEnum.idCardNumber);
}))), }))),
Obx(() => CommonItem( Obx(() => CommonItem(
@ -96,16 +97,14 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveDirection: state.itemData.value.keyStatus! == isHaveDirection: state.itemData.value.keyStatus! ==
XSConstantMacro.keyStatusExpired XSConstantMacro.keyStatusExpired
? false ? false
: state.keyType.value == 3 : state.keyType.value != 3,
? false
: true,
isHaveLine: true, isHaveLine: true,
action: state.itemData.value.keyStatus! == action: state.itemData.value.keyStatus! ==
XSConstantMacro.keyStatusExpired XSConstantMacro.keyStatusExpired
? null ? null
: () async { : () async {
if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){ if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){
logic.showToast("冻结状态下不允许修改钥匙权限".tr); logic.showToast('冻结状态下不允许修改钥匙权限'.tr);
return; return;
} }
@ -113,14 +112,14 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
// / // /
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.electronicKeyDetailChangeDate, Routers.electronicKeyDetailChangeDate,
arguments: { arguments: <String, Object>{
"pushType": 0, 'pushType': 0,
"itemData": state.itemData.value, 'itemData': state.itemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.starDate.value = data["beginTimeTimestamp"].toString(); state.starDate.value = data['beginTimeTimestamp'].toString();
state.endDate.value = data["endTimeTimestamp"].toString(); state.endDate.value = data['endTimeTimestamp'].toString();
state.keyType.value = 2; state.keyType.value = 2;
}); });
} }
@ -128,23 +127,23 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
// //
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.electronicKeyPeriodValidityPage, Routers.electronicKeyPeriodValidityPage,
arguments: { arguments: <String, Object>{
"pushType": 0, 'pushType': 0,
"itemData": state.itemData.value, 'itemData': state.itemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.starDate.value = data["starDate"]; state.starDate.value = data['starDate'];
state.endDate.value = data["endDate"]; state.endDate.value = data['endDate'];
state.starTime.value = data["starTime"]; state.starTime.value = data['starTime'];
state.endTime.value = data["endTime"]; state.endTime.value = data['endTime'];
state.weekDay.value = data["validityValue"]; state.weekDay.value = data['validityValue'];
}); });
} }
} }
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false, visible: state.keyType.value == 4 ,
child: Obx(() => CommonItem( child: Obx(() => CommonItem(
leftTitel: '有效日'.tr, leftTitel: '有效日'.tr,
rightTitle: logic.weekDayStr.join(','), rightTitle: logic.weekDayStr.join(','),
@ -152,63 +151,63 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
isHaveLine: true, isHaveLine: true,
action: () async { action: () async {
if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){ if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){
logic.showToast("冻结状态下不允许修改钥匙权限".tr); logic.showToast('冻结状态下不允许修改钥匙权限'.tr);
return; return;
} }
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.electronicKeyPeriodValidityPage, Routers.electronicKeyPeriodValidityPage,
arguments: { arguments: <String, Object>{
"pushType": 0, 'pushType': 0,
"itemData": state.itemData.value, 'itemData': state.itemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.starDate.value = data["starDate"]; state.starDate.value = data['starDate'];
state.endDate.value = data["endDate"]; state.endDate.value = data['endDate'];
state.starTime.value = data["starTime"]; state.starTime.value = data['starTime'];
state.endTime.value = data["endTime"]; state.endTime.value = data['endTime'];
state.weekDay.value = data["validityValue"]; state.weekDay.value = data['validityValue'];
}); });
} }
})))), })))),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false, visible: state.keyType.value == 4 ? true : false,
child: Obx(() => CommonItem( child: Obx(() => CommonItem(
leftTitel: "有效时间".tr, leftTitel: '有效时间'.tr,
rightTitle: rightTitle:
"${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}", '${DateTool().dateToHNString(state.starTime.value)}-${DateTool().dateToHNString(state.endTime.value)}',
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){ if(state.itemData.value.keyStatus == XSConstantMacro.keyStatusFrozen){
logic.showToast("冻结状态下不允许修改钥匙权限".tr); logic.showToast('冻结状态下不允许修改钥匙权限'.tr);
return; return;
} }
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.electronicKeyPeriodValidityPage, Routers.electronicKeyPeriodValidityPage,
arguments: { arguments: <String, Object>{
"pushType": 0, 'pushType': 0,
"itemData": state.itemData.value, 'itemData': state.itemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.starDate.value = data["starDate"]; state.starDate.value = data['starDate'];
state.endDate.value = data["endDate"]; state.endDate.value = data['endDate'];
state.starTime.value = data["starTime"]; state.starTime.value = data['starTime'];
state.endTime.value = data["endTime"]; state.endTime.value = data['endTime'];
state.weekDay.value = data["validityValue"]; state.weekDay.value = data['validityValue'];
}); });
} }
})))), })))),
Container(height: 10.h), Container(height: 10.h),
CommonItem( CommonItem(
leftTitel: "接收者".tr, leftTitel: '接收者'.tr,
rightTitle: state.itemData.value.username ?? ""), rightTitle: state.itemData.value.username ?? ''),
const SizedBox(height: 1), const SizedBox(height: 1),
CommonItem( CommonItem(
leftTitel: "发送人".tr, leftTitel: '发送人'.tr,
rightTitle: state.itemData.value.senderUsername ?? ""), rightTitle: state.itemData.value.senderUsername ?? ''),
const SizedBox(height: 1), const SizedBox(height: 1),
CommonItem( CommonItem(
leftTitel: '发送时间'.tr, leftTitel: '发送时间'.tr,
@ -218,8 +217,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
Visibility( Visibility(
visible: state.itemData.value.keyRight == 1 ? true : false, visible: state.itemData.value.keyRight == 1 ? true : false,
child: CommonItem( child: CommonItem(
leftTitel: "仅管理自己创建的用户".tr, leftTitel: '仅管理自己创建的用户'.tr,
rightTitle: "", rightTitle: '',
isHaveRightWidget: true, isHaveRightWidget: true,
isHaveLine: true, isHaveLine: true,
rightWidget: SizedBox( rightWidget: SizedBox(
@ -239,8 +238,8 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
? true ? true
: false, : false,
child: CommonItem( child: CommonItem(
leftTitel: "远程开锁".tr, leftTitel: '远程开锁'.tr,
rightTitle: "", rightTitle: '',
isHaveRightWidget: true, isHaveRightWidget: true,
isHaveLine: true, isHaveLine: true,
rightWidget: SizedBox( rightWidget: SizedBox(
@ -248,17 +247,17 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
), ),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '实名认证'.tr, leftTitel: '实名认证'.tr,
rightTitle: "", rightTitle: '',
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: rightWidget:
SizedBox(width: 60.w, child: _realNameAuthSwitch()))), SizedBox(width: 60.w, child: _realNameAuthSwitch()))),
Container(height: 10.h), Container(height: 10.h),
CommonItem( CommonItem(
leftTitel: '操作记录'.tr, leftTitel: '操作记录'.tr,
rightTitle: "", rightTitle: '',
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: { Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
'type': 5, 'type': 5,
'id': state.itemData.value.keyId.toString(), 'id': state.itemData.value.keyId.toString(),
'recordName': state.itemData.value.keyName 'recordName': state.itemData.value.keyName
@ -289,7 +288,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isRealNameAuth.value, value: state.isRealNameAuth.value,
onChanged: (value) { onChanged: (bool value) {
if (!state.isRealNameAuth.value) { if (!state.isRealNameAuth.value) {
logic.checkRealNameStatus(1); logic.checkRealNameStatus(1);
} else { } else {
@ -305,7 +304,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isRemoteUnlock.value, value: state.isRemoteUnlock.value,
onChanged: (value) { onChanged: (bool value) {
state.isRemoteUnlock.value = !state.isRemoteUnlock.value; state.isRemoteUnlock.value = !state.isRemoteUnlock.value;
logic.updateKeyDateRequest(2); logic.updateKeyDateRequest(2);
}, },
@ -318,7 +317,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.onlyManageYouCreatesUser.value, value: state.onlyManageYouCreatesUser.value,
onChanged: (value) { onChanged: (bool value) {
setState(() { setState(() {
state.onlyManageYouCreatesUser.value = state.onlyManageYouCreatesUser.value =
!state.onlyManageYouCreatesUser.value; !state.onlyManageYouCreatesUser.value;
@ -335,7 +334,7 @@ class _ElectronicKeyDetailPageState extends State<ElectronicKeyDetailPage> {
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: tipsTitle, title: tipsTitle,
tipTitle: "请输入".tr, tipTitle: '请输入'.tr,
controller: logic.getCurrentController(alertEnum), controller: logic.getCurrentController(alertEnum),
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'), FilteringTextInputFormatter.deny('\n'),

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/electronicKeyList_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
@ -15,23 +16,24 @@ class ElectronicKeyListLogic extends BaseGetXController {
// //
Future<ElectronicKeyListEntity> mockNetworkDataRequest() async { Future<ElectronicKeyListEntity> mockNetworkDataRequest() async {
ElectronicKeyListEntity entity = await ApiRepository.to.electronicKeyList( final ElectronicKeyListEntity entity = await ApiRepository.to
endDate: '0', .electronicKeyList(
keyId: CommonDataManage().currentKeyInfo.keyId.toString(), endDate: '0',
keyStatus: '', keyId: CommonDataManage().currentKeyInfo.keyId.toString(),
keyRight: '0', keyStatus: '',
lockId: CommonDataManage().currentKeyInfo.lockId.toString(), keyRight: '0',
pageNo: pageNo.toString(), lockId: CommonDataManage().currentKeyInfo.lockId.toString(),
pageSize: pageSize.toString(), pageNo: pageNo.toString(),
startDate: '0', pageSize: pageSize.toString(),
searchStr: state.searchController.text); startDate: '0',
searchStr: state.searchController.text);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if (pageNo == 1) { if (pageNo == 1) {
state.itemDataList.value = entity.data!.itemList!; state.itemDataList.value = entity.data!.itemList;
pageNo++; pageNo++;
} else { } else {
if (entity.data!.itemList!.isNotEmpty) { if (entity.data!.itemList.isNotEmpty) {
state.itemDataList.value.addAll(entity.data!.itemList!); state.itemDataList.value.addAll(entity.data!.itemList);
pageNo++; pageNo++;
} }
} }
@ -39,12 +41,25 @@ class ElectronicKeyListLogic extends BaseGetXController {
return entity; return entity;
} }
//
Future<void> refreshIndividualKeys(
{required int lockId, required int keyId}) async {
final ElectronicKeyEntity entity =
await ApiRepository.to.electronicKey(lockId: lockId, keyId: keyId);
if (entity.errorCode!.codeIsSuccessful) {
final int index = state.itemDataList
.indexWhere((ElectronicKeyListItem item) => item.keyId == keyId);
state.itemDataList.removeAt(index);
state.itemDataList.insert(index, entity.data!);
}
}
// //
Future<void> resetElectronicKeyListRequest() async { Future<void> resetElectronicKeyListRequest() async {
ElectronicKeyListEntity entity = await ApiRepository.to final ElectronicKeyListEntity entity = await ApiRepository.to
.resetElectronicKey(CommonDataManage().currentKeyInfo.lockId.toString(), '0'); .resetElectronicKey(CommonDataManage().currentKeyInfo.lockId.toString(), '0');
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("重置成功".tr, something: (){ showToast('重置成功'.tr, something: (){
pageNo = 1; pageNo = 1;
mockNetworkDataRequest(); mockNetworkDataRequest();
}); });
@ -53,28 +68,30 @@ class ElectronicKeyListLogic extends BaseGetXController {
// //
Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async { Future<void> deleteKeyRequest(String keyId, int includeUnderlings) async {
ElectronicKeyListEntity entity = final ElectronicKeyListEntity entity =
await ApiRepository.to.deleteElectronicKey( await ApiRepository.to.deleteElectronicKey(
keyId:keyId, keyId:keyId,
includeUnderlings:includeUnderlings includeUnderlings:includeUnderlings
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功".tr,something: (){ showToast('删除成功'.tr,something: (){
pageNo = 1; pageNo = 1;
mockNetworkDataRequest(); mockNetworkDataRequest();
}); });
} }
} }
deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){ void deletKeyLogic(ElectronicKeyListItem electronicKeyListItem){
if(electronicKeyListItem.keyRight == 1){ if(electronicKeyListItem.keyRight == 1){
// //
ShowTipView().showDeleteAdministratorIsHaveAllDataDialog('同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (isAllData) { ShowTipView().showDeleteAdministratorIsHaveAllDataDialog(
deleteKeyRequest(electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0); '同时删除其发送的所有钥匙,钥匙删除后不能恢复'.tr, (bool isAllData) {
deleteKeyRequest(
electronicKeyListItem.keyId.toString(), isAllData ? 1 : 0);
}); });
}else{ } else {
// //
ShowTipView().showIosTipWithContentDialog("删除钥匙会在用户APP连网后生效".tr,(){ ShowTipView().showIosTipWithContentDialog('删除钥匙会在用户APP连网后生效'.tr,(){
deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0); deleteKeyRequest(electronicKeyListItem.keyId.toString(), 0);
}); });
} }
@ -82,9 +99,12 @@ class ElectronicKeyListLogic extends BaseGetXController {
/// ///
StreamSubscription? _getElectronicKeyListRefreshUIEvent; StreamSubscription? _getElectronicKeyListRefreshUIEvent;
void _getElectronicKeyListRefreshUIAction() { void _getElectronicKeyListRefreshUIAction() {
// eventBus // eventBus
_getElectronicKeyListRefreshUIEvent = eventBus.on<ElectronicKeyListRefreshUI>().listen((event) { _getElectronicKeyListRefreshUIEvent = eventBus
.on<ElectronicKeyListRefreshUI>()
.listen((ElectronicKeyListRefreshUI event) {
pageNo = 1; pageNo = 1;
mockNetworkDataRequest(); mockNetworkDataRequest();
}); });
@ -92,21 +112,13 @@ class ElectronicKeyListLogic extends BaseGetXController {
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_getElectronicKeyListRefreshUIAction(); _getElectronicKeyListRefreshUIAction();
} }
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_getElectronicKeyListRefreshUIEvent?.cancel(); _getElectronicKeyListRefreshUIEvent?.cancel();

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
@ -13,6 +12,7 @@ import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../tools/EasyRefreshTool.dart'; import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/customNetworkImage.dart';
import '../../../../tools/keySearchWidget.dart'; import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/showTipView.dart'; import '../../../../tools/showTipView.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
@ -39,7 +39,7 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
Future<void> mockRequest() async { Future<void> mockRequest() async {
// //
bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value) { logic.mockNetworkDataRequest().then((ElectronicKeyListEntity value) {
setState(() {}); setState(() {});
@ -63,9 +63,11 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
), ),
onPressed: () async { onPressed: () async {
// //
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode =
await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
ShowTipView().showIosTipWithContentDialog('该锁的电子钥匙都将被删除'.tr, logic.resetElectronicKeyListRequest); ShowTipView().showIosTipWithContentDialog(
'该锁的电子钥匙都将被删除'.tr, logic.resetElectronicKeyListRequest);
} else { } else {
logic.showToast('演示模式'.tr); logic.showToast('演示模式'.tr);
} }
@ -101,7 +103,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
AddBottomWhiteBtn( AddBottomWhiteBtn(
btnName: TranslationLoader.lanKeys!.sendKey!.tr, btnName: TranslationLoader.lanKeys!.sendKey!.tr,
onClick: () { onClick: () {
Navigator.pushNamed(context, Routers.sendElectronicKeyPage).then((Object? val) { Navigator.pushNamed(context, Routers.sendElectronicKeyPage)
.then((Object? val) {
if (val != null) { if (val != null) {
logic.pageNo = 1; logic.pageNo = 1;
mockRequest(); mockRequest();
@ -130,7 +133,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
shrinkWrap: true, shrinkWrap: true,
itemCount: state.itemDataList.value.length, itemCount: state.itemDataList.value.length,
itemBuilder: (BuildContext c, int index) { itemBuilder: (BuildContext c, int index) {
ElectronicKeyListItem indexEntity = state.itemDataList.value[index]; final ElectronicKeyListItem indexEntity =
state.itemDataList.value[index];
String useDateStr = ''; //使 String useDateStr = ''; //使
String keyStatus = ''; // String keyStatus = ''; //
@ -138,7 +142,8 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
useDateStr = getUseDateStr(indexEntity); useDateStr = getUseDateStr(indexEntity);
// //
keyStatus = XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!); keyStatus =
XSConstantMacro.getKeyStatusStr(indexEntity.keyStatus!);
// //
bool isAdminKey = false; bool isAdminKey = false;
@ -166,20 +171,23 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
], ],
), ),
child: _electronicKeyItem( child: _electronicKeyItem(
'images/controls_user.png', indexEntity.headUrl!,
indexEntity.keyName!, indexEntity.keyName!,
useDateStr, useDateStr,
keyStatus, keyStatus,
isAdminKey, isAdminKey,
indexEntity.remoteEnable == 1 ? true : false, () { indexEntity.remoteEnable == 1, () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.electronicKeyDetailPage, context, Routers.electronicKeyDetailPage,
arguments: <String, ElectronicKeyListItem>{ arguments: <String, ElectronicKeyListItem>{
'itemData': indexEntity, 'itemData': indexEntity,
}).then((Object? val) { }).then((Object? val) {
if (val != null) { if (val != null) {
logic.mockNetworkDataRequest(); logic
setState(() {}); .refreshIndividualKeys(
lockId: indexEntity.lockId!,
keyId: indexEntity.keyId!)
.then((dynamic value) => setState(() {}));
} }
}); });
}), }),
@ -198,23 +206,25 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
//使 //使
String getUseDateStr(ElectronicKeyListItem indexEntity) { String getUseDateStr(ElectronicKeyListItem indexEntity) {
String useDateStr = ''; String useDateStr = '';
DateTime sendDateStr = final DateTime sendDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!); DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
if (indexEntity.keyType == XSConstantMacro.keyTypeTime) { if (indexEntity.keyType == XSConstantMacro.keyTypeTime) {
// //
DateTime startDateStr = final DateTime startDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!); DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
DateTime endDateStr = final DateTime endDateStr =
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!); DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
useDateStr = useDateStr =
'${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}'; '${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeLong) {
// //
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr}'; useDateStr =
'${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeOnce) {
// //
useDateStr = '单次'.tr; useDateStr = '单次'.tr;
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}'; useDateStr =
'${sendDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
} else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) { } else if (indexEntity.keyType == XSConstantMacro.keyTypeLoop) {
// //
useDateStr = '循环'.tr; useDateStr = '循环'.tr;
@ -223,20 +233,34 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
return useDateStr; return useDateStr;
} }
Widget _electronicKeyItem(String avatarURL, String receiveUser, Widget _electronicKeyItem(
String useDate, String keyStatus, bool isAdminKey, bool isRemteUnlocking, Function() action) { String avatarURL,
String receiveUser,
String useDate,
String keyStatus,
bool isAdminKey,
bool isRemteUnlocking,
Function() action) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
color: Colors.white, color: Colors.white,
height: 90.h, padding: EdgeInsets.only(top: 20.h, bottom: 20.h),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SizedBox(width: 30.w), SizedBox(width: 30.w),
Image.asset( SizedBox(
avatarURL,
width: 60.w, width: 60.w,
height: 60.w, height: 60.w,
child: ClipRRect(
borderRadius: BorderRadius.circular(30.w),
child: CustomNetworkImage(
url: avatarURL,
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
),
),
), ),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Expanded( Expanded(
@ -252,32 +276,33 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
children: <Widget>[ children: <Widget>[
Flexible( Flexible(
child: Text(receiveUser, child: Text(receiveUser,
maxLines: 1, maxLines: 3,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
color: AppColors.blackColor)), color: AppColors.blackColor)),
), ),
SizedBox(width: 5.w), SizedBox(width: 5.w),
isRemteUnlocking if (isRemteUnlocking)
? Image.asset( Image.asset(
'images/icon_electronicKey_remteUnlocking.png', 'images/icon_electronicKey_remteUnlocking.png',
width: 24.w, width: 24.w,
height: 20.w, height: 20.w,
) )
: Container(), else
Container(),
SizedBox(width: 5.w), SizedBox(width: 5.w),
isAdminKey if (isAdminKey)
? Image.asset( Image.asset(
'images/icon_electronicKey_admin.png', 'images/icon_electronicKey_admin.png',
width: 24.w, width: 24.w,
height: 20.w, height: 20.w,
) )
: Container(), else
Container(),
], ],
), ),
), ),
// Expanded(child: SizedBox(width: 20.w,)), // Expanded(child: SizedBox(width: 20.w,)),
SizedBox(width: 10.w), SizedBox(width: 10.w),
Text( Text(
@ -308,5 +333,4 @@ class _ElectronicKeyListPageState extends State<ElectronicKeyListPage> {
), ),
); );
} }
} }

View File

@ -8,9 +8,9 @@ class ElectronicKeyListState {
TextEditingController searchController = TextEditingController(); /// TextEditingController searchController = TextEditingController(); ///
// final keyInfo = LockListInfoItemEntity().obs; // final keyInfo = LockListInfoItemEntity().obs;
// final lockMainEntity = LockMainEntity().obs; // final lockMainEntity = LockMainEntity().obs;
var pageNum = 1.obs; // RxInt pageNum = 1.obs; //
final pageSize = 20.obs; // final RxInt pageSize = 20.obs; //
final itemDataList = <ElectronicKeyListItem>[].obs; final RxList<ElectronicKeyListItem> itemDataList = <ElectronicKeyListItem>[].obs;
// ElectronicKeyListState() { // ElectronicKeyListState() {
// Map map = Get.arguments; // Map map = Get.arguments;

View File

@ -0,0 +1,31 @@
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
class ElectronicKeyEntity {
int? errorCode;
String? description;
String? errorMsg;
ElectronicKeyListItem? data;
ElectronicKeyEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
ElectronicKeyEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null
? ElectronicKeyListItem.fromJson(json['data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}

View File

@ -1,8 +1,4 @@
class ElectronicKeyListEntity { class ElectronicKeyListEntity {
int? errorCode;
String? description;
String? errorMsg;
ElectronicKeyListData? data;
ElectronicKeyListEntity( ElectronicKeyListEntity(
{this.errorCode, this.description, this.errorMsg, this.data}); {this.errorCode, this.description, this.errorMsg, this.data});
@ -15,6 +11,10 @@ class ElectronicKeyListEntity {
? ElectronicKeyListData.fromJson(json['data']) ? ElectronicKeyListData.fromJson(json['data'])
: null; : null;
} }
int? errorCode;
String? description;
String? errorMsg;
ElectronicKeyListData? data;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -29,11 +29,6 @@ class ElectronicKeyListEntity {
} }
class ElectronicKeyListData { class ElectronicKeyListData {
late List<ElectronicKeyListItem> itemList;
int? pageNo;
int? pageSize;
int? pages;
int? total;
ElectronicKeyListData( ElectronicKeyListData(
{required this.itemList, {required this.itemList,
@ -54,6 +49,11 @@ class ElectronicKeyListData {
pages = json['pages']; pages = json['pages'];
total = json['total']; total = json['total'];
} }
late List<ElectronicKeyListItem> itemList;
int? pageNo;
int? pageSize;
int? pages;
int? total;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -67,29 +67,6 @@ class ElectronicKeyListData {
} }
class ElectronicKeyListItem { class ElectronicKeyListItem {
int? keyId;
int? lockId;
String? username;
String? lockName;
String? lockAlias;
int? userType;
String? keyName;
int? keyStatus;
int? startDate;
int? endDate;
int? keyRight;
int? keyType;
String? senderUsername;
String? remarks;
int? isCameraEnable;
int? faceAuthentication;
int? sendDate;
int? remoteEnable;
int? appUnlockMustOnline;
List? weekDays;
int? isOnlyManageSelf;
UserIdCard? userIdCard;
int? uid;
ElectronicKeyListItem({ ElectronicKeyListItem({
this.keyId, this.keyId,
@ -115,13 +92,14 @@ class ElectronicKeyListItem {
this.isOnlyManageSelf, this.isOnlyManageSelf,
this.userIdCard, this.userIdCard,
this.uid, this.uid,
this.headUrl
}); });
ElectronicKeyListItem.fromJson(Map<String, dynamic> json) { ElectronicKeyListItem.fromJson(Map<String, dynamic> json) {
keyId = json['keyId']; keyId = json['keyId'];
lockId = json['lockId']; lockId = json['lockId'];
json['username'] != null ? username = json['username'] : ""; json['username'] != null ? username = json['username'] : '';
json['lockName'] != null ? lockName = json['lockName'] : ""; json['lockName'] != null ? lockName = json['lockName'] : '';
lockAlias = json['lockAlias']; lockAlias = json['lockAlias'];
userType = json['userType']; userType = json['userType'];
keyName = json['keyName']; keyName = json['keyName'];
@ -131,7 +109,7 @@ class ElectronicKeyListItem {
keyRight = json['keyRight']; keyRight = json['keyRight'];
keyType = json['keyType']; keyType = json['keyType'];
senderUsername = json['senderUsername']; senderUsername = json['senderUsername'];
json['remarks'] != null ? remarks = json['remarks'] : ""; json['remarks'] != null ? remarks = json['remarks'] : '';
json['isCameraEnable'] != null json['isCameraEnable'] != null
? isCameraEnable = json['isCameraEnable'] ? isCameraEnable = json['isCameraEnable']
: 0; : 0;
@ -147,7 +125,32 @@ class ElectronicKeyListItem {
? userIdCard = UserIdCard.fromJson(json['userIdCard']) ? userIdCard = UserIdCard.fromJson(json['userIdCard'])
: null; : null;
uid = json['uid']; uid = json['uid'];
headUrl = json['headUrl'];
} }
int? keyId;
int? lockId;
String? username;
String? lockName;
String? lockAlias;
int? userType;
String? keyName;
int? keyStatus;
int? startDate;
int? endDate;
int? keyRight;
int? keyType;
String? senderUsername;
String? remarks;
int? isCameraEnable;
int? faceAuthentication;
int? sendDate;
int? remoteEnable;
int? appUnlockMustOnline;
List? weekDays;
int? isOnlyManageSelf;
UserIdCard? userIdCard;
int? uid;
String? headUrl;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};
@ -176,13 +179,12 @@ class ElectronicKeyListItem {
data['userIdCard'] = userIdCard!.toJson(); data['userIdCard'] = userIdCard!.toJson();
} }
data['uid'] = uid; data['uid'] = uid;
data['headUrl'] = headUrl;
return data; return data;
} }
} }
class UserIdCard { class UserIdCard {
String? realName;
String? idCardNumber;
UserIdCard({this.realName, this.idCardNumber}); UserIdCard({this.realName, this.idCardNumber});
@ -190,6 +192,8 @@ class UserIdCard {
realName = json['realName']; realName = json['realName'];
idCardNumber = json['idCardNumber']; idCardNumber = json['idCardNumber'];
} }
String? realName;
String? idCardNumber;
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{}; final Map<String, dynamic> data = <String, dynamic>{};

View File

@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart'; import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_logic.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart'; import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_page.dart';
import '../../../../../tools/CustomUnderlineTabIndicator.dart'; import '../../../../../tools/CustomUnderlineTabIndicator.dart';
@ -18,8 +19,8 @@ class SendElectronicKeyPage extends StatefulWidget {
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> class _SendElectronicKeyPageState extends State<SendElectronicKeyPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
final logic = Get.put(SendElectronicKeyLogic()); final SendElectronicKeyLogic logic = Get.put(SendElectronicKeyLogic());
final state = Get.find<SendElectronicKeyLogic>().state; final SendElectronicKeyState state = Get.find<SendElectronicKeyLogic>().state;
@override @override
void initState() { void initState() {
@ -37,7 +38,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage>
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Column( body: Column(
children: [ children: <Widget>[
_tabBar(), _tabBar(),
_pageWidget(), _pageWidget(),
], ],
@ -48,10 +49,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage>
TabBar _tabBar() { TabBar _tabBar() {
return TabBar( return TabBar(
controller: state.tabController, controller: state.tabController,
onTap: (index) { onTap: (int index) {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
}, },
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), tabs: _itemTabs.map(_tab).toList(),
isScrollable: true, isScrollable: true,
indicatorColor: Colors.red, indicatorColor: Colors.red,
unselectedLabelColor: Colors.black, unselectedLabelColor: Colors.black,
@ -97,10 +98,10 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage>
} }
final List<ItemView> _itemTabs = <ItemView>[ final List<ItemView> _itemTabs = <ItemView>[
ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: "0"), ItemView(title: TranslationLoader.lanKeys!.timeLimit!.tr, type: '0'),
ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: "1"), ItemView(title: TranslationLoader.lanKeys!.permanent!.tr, type: '1'),
ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: "2"), ItemView(title: TranslationLoader.lanKeys!.once!.tr, type: '2'),
ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: "3"), ItemView(title: TranslationLoader.lanKeys!.circulation!.tr, type: '3'),
]; ];
} }

View File

@ -3,9 +3,11 @@ import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart'; import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart'; import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/view/sendElectronicKeyView_state.dart';
import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart'; import 'package:star_lock/mine/valueAddedServices/advancedFunctionRecord/advancedFunctionRecord_entity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/NativeInteractionTool.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/commonDataManage.dart'; import 'package:star_lock/tools/commonDataManage.dart';
import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/dateTool.dart';
@ -20,6 +22,8 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
SendElectronicKeyViewLogic(this.type); SendElectronicKeyViewLogic(this.type);
String type; String type;
final SendElectronicKeyViewState state = SendElectronicKeyViewState(); final SendElectronicKeyViewState state = SendElectronicKeyViewState();
int? keyId;
List<dynamic> get weekDayStr { List<dynamic> get weekDayStr {
return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList(); return state.weekdaysList.map((e) => TimeUtils.translateWeekday(e)).toList();
@ -176,6 +180,7 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.createUser.value = 0; state.createUser.value = 0;
state.isSendSuccess = true; state.isSendSuccess = true;
keyId = entity.data!.keyId;
resetData(); resetData();
update(); update();
eventBus.fire(ElectronicKeyListRefreshUI()); eventBus.fire(ElectronicKeyListRefreshUI());
@ -237,6 +242,31 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
return currentController; return currentController;
} }
//
Future<void> sendMsg({required bool isPhone}) async {
if (keyId == null) {
return;
}
final NoticeTemplateEntity entity = await ApiRepository.to
.getNoticeTemplate(
lockId: CommonDataManage().currentKeyInfo.lockId!,
keyId: keyId!,
channelType: isPhone ? 1 : 2);
if (entity.errorCode!.codeIsSuccessful) {
final List<Item?> list =
entity.data!.list!.where((Item item) => item.isUse == 0).toList();
if (list.isNotEmpty) {
final Item item = list.first!;
final String template = item.template ?? '';
NativeInteractionTool().loadNativeShare(shareText: template);
} else {
showToast('获取模板失败 0x02');
}
} else {
showToast('获取模板失败 0x01');
}
}
void resetData() { void resetData() {
state.emailOrPhoneController.text = ''; state.emailOrPhoneController.text = '';
state.keyNameController.text = ''; state.keyNameController.text = '';

View File

@ -143,7 +143,8 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
rightTitle: '', rightTitle: '',
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: getTFWidget( rightWidget: getTFWidget(
false, TranslationLoader.lanKeys!.enterYourName!.tr, 2, logic)), false, TranslationLoader.lanKeys!.enterYourName!.tr, 2, logic,
maxSize: 50)),
Container(height: 10.h), Container(height: 10.h),
], ],
); );
@ -415,15 +416,33 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
SizedBox( SizedBox(
height: 10.h, height: 10.h,
), ),
// OutLineBtn(
// btnName: '分享'.tr,
// onClick: () {
// _openModalBottomSheet();
// },
// ),
OutLineBtn( OutLineBtn(
btnName: '分享'.tr, btnName:
logic.state.emailOrPhoneController.text.contains('@') ? '邮件通知' : '短信通知',
onClick: () { onClick: () {
_openModalBottomSheet(); if (logic.state.emailOrPhoneController.text.contains('@')) {
Get.toNamed(Routers.sendEmailNotificationPage);
} else {
logic.sendMsg(isPhone: true);
}
}, },
), ),
SizedBox( SizedBox(
height: 10.h, height: 10.h,
), ),
OutLineBtn(
btnName: '微信通知',
onClick: () {
logic.sendMsg(
isPhone: logic.state.emailOrPhoneController.text.contains('@'));
},
),
], ],
); );
} }
@ -441,7 +460,8 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
// //
Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex, Widget getTFWidget(bool isHaveBtn, String tfStr, int lineIndex,
SendElectronicKeyViewLogic logic) { SendElectronicKeyViewLogic logic,
{int maxSize = 30}) {
return SizedBox( return SizedBox(
height: 65.h, height: 65.h,
width: 320.w, width: 320.w,
@ -454,7 +474,7 @@ class _SendElectronicKeyViewState extends State<SendElectronicKeyView>
maxLines: 1, maxLines: 1,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'), FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(30), LengthLimitingTextInputFormatter(maxSize),
], ],
// controller: _controller, // controller: _controller,
autofocus: false, autofocus: false,

View File

@ -306,7 +306,7 @@ class _AddFaceTypePageState extends State<AddFaceTypePage> with SingleTickerProv
maxLines: 1, maxLines: 1,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'), FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18), LengthLimitingTextInputFormatter(50),
], ],
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor), fontSize: 22.sp, color: AppColors.darkGrayTextColor),

View File

@ -1,12 +1,16 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/blue/io_protocol/io_addFace.dart'; import 'package:star_lock/blue/io_protocol/io_addFace.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_state.dart'; import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_state.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/dateTool.dart'; import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/time_picker/time_utils.dart'; import 'package:star_lock/tools/pickers/time_picker/time_utils.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_reply.dart'; import '../../../../blue/io_reply.dart';
import '../../../../blue/io_tool/io_tool.dart'; import '../../../../blue/io_tool/io_tool.dart';
@ -26,7 +30,7 @@ class FaceDetailLogic extends BaseGetXController {
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) { EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
// () // ()
if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) { if ((reply is SenderAddFaceReply) && (state.ifCurrentScreen.value == true)) {
_replyAddFaceBegin(reply); _replyAddFaceBegin(reply);
@ -36,7 +40,7 @@ class FaceDetailLogic extends BaseGetXController {
// //
Future<void> _replyAddFaceBegin(Reply reply) async { Future<void> _replyAddFaceBegin(Reply reply) async {
int status = reply.data[2]; final int status = reply.data[2];
switch (status) { switch (status) {
case 0x00: case 0x00:
@ -52,14 +56,14 @@ class FaceDetailLogic extends BaseGetXController {
break; break;
case 0x06: case 0x06:
// //
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!); final List<int> signKeyDataList = changeStringListToIntList(signKey!);
var token = reply.data.sublist(5, 9); final List<int> token = reply.data.sublist(5, 9);
var saveStrList = changeIntListToStringList(token); final List<String> saveStrList = changeIntListToStringList(token);
Storage.setStringList(saveBlueToken, saveStrList); Storage.setStringList(saveBlueToken, saveStrList);
IoSenderManage.senderAddFaceCommand( IoSenderManage.senderAddFaceCommand(
@ -104,14 +108,14 @@ class FaceDetailLogic extends BaseGetXController {
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState deviceConnectionState) async { (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
var signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
List<int> signKeyDataList = changeStringListToIntList(signKey!); final List<int> signKeyDataList = changeStringListToIntList(signKey!);
IoSenderManage.senderAddFaceCommand( IoSenderManage.senderAddFaceCommand(
keyID:state.keyId.value.toString(), keyID:state.keyId.value.toString(),
@ -146,36 +150,36 @@ class FaceDetailLogic extends BaseGetXController {
} }
// //
void deletFaceData() async { Future<void> deletFaceData() async {
var entity = await ApiRepository.to.deleteFaceData( final LoginEntity entity = await ApiRepository.to.deleteFaceData(
faceId: state.faceItemData.value.faceId!, faceId: state.faceItemData.value.faceId!,
lockId: state.faceItemData.value.lockId!, lockId: state.faceItemData.value.lockId!,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("删除成功", something: () { showToast('删除成功', something: () {
Get.back(result: "addScuess"); Get.back(result: 'addScuess');
}); });
} }
} }
// //
void updateFaceNameData() async { Future<void> updateFaceNameData() async {
var entity = await ApiRepository.to.updateFaceName( final LoginEntity entity = await ApiRepository.to.updateFaceName(
lockId: state.faceItemData.value.lockId!, lockId: state.faceItemData.value.lockId!,
faceId: state.faceItemData.value.faceId!, faceId: state.faceItemData.value.faceId!,
faceName: state.changeNameController.text, faceName: state.changeNameController.text,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.typeName.value = state.changeNameController.text; state.typeName.value = state.changeNameController.text;
showToast("修改成功", something: () { showToast('修改成功', something: () {
Get.back(result: "addScuess"); Get.back(result: 'addScuess');
}); });
} }
} }
// //
void editFaceData() async { Future<void> editFaceData() async {
var entity = await ApiRepository.to.updateFaceValidity( final LoginEntity entity = await ApiRepository.to.updateFaceValidity(
lockId: state.faceItemData.value.lockId!, lockId: state.faceItemData.value.lockId!,
faceId: state.faceItemData.value.faceId!, faceId: state.faceItemData.value.faceId!,
startDate: int.parse(state.startDate.value), startDate: int.parse(state.startDate.value),
@ -185,13 +189,13 @@ class FaceDetailLogic extends BaseGetXController {
faceType: state.keyType.value, faceType: state.keyType.value,
weekDay: state.weekDay.value, weekDay: state.weekDay.value,
faceName: state.changeNameController.text, faceName: state.changeNameController.text,
addType: "1", addType: '1',
isCoerced: state.isStressFace.value ? 2 : 1, isCoerced: state.isStressFace.value ? 2 : 1,
faceRight: state.isAdministrator.value ? 1 : 0, faceRight: state.isAdministrator.value ? 1 : 0,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("修改成功", something: () { showToast('修改成功', something: () {
Get.back(result: "addScuess"); Get.back(result: 'addScuess');
}); });
} }
} }
@ -199,33 +203,25 @@ class FaceDetailLogic extends BaseGetXController {
String getKeyTypeShowDateTime() { String getKeyTypeShowDateTime() {
String useDateStr = ''; String useDateStr = '';
if (state.keyType.value == 1) { if (state.keyType.value == 1) {
useDateStr = "永久"; useDateStr = '永久';
} else if (state.keyType.value == 2) { } else if (state.keyType.value == 2) {
useDateStr = useDateStr =
"${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}"; '${DateTool().dateToYMDHNString(state.startDate.value)}\n${DateTool().dateToYMDHNString(state.endDate.value)}';
} else if (state.keyType.value == 4) { } else if (state.keyType.value == 4) {
useDateStr = useDateStr =
"${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}"; '${DateTool().dateToYMDString(state.startDate.value)}\n${DateTool().dateToYMDString(state.endDate.value)}';
} }
return useDateStr; return useDateStr;
} }
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
} }
@override
void onInit() {
// TODO: implement onInit
super.onInit();
}
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();

View File

@ -1,9 +1,11 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_logic.dart'; import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_logic.dart';
import 'package:star_lock/main/lockDetail/face/faceDetail/faceDetail_state.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
@ -23,22 +25,22 @@ class FaceDetailPage extends StatefulWidget {
} }
class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware { class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
final logic = Get.put(FaceDetailLogic()); final FaceDetailLogic logic = Get.put(FaceDetailLogic());
final state = Get.find<FaceDetailLogic>().state; final FaceDetailState state = Get.find<FaceDetailLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: "人脸详情", barTitle: '人脸详情',
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
), ),
body: ListView( body: ListView(
children: [ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: "人脸号", leftTitel: '人脸号',
rightTitle: state.typeNumber.value, rightTitle: state.typeNumber.value,
isHaveDirection: false, isHaveDirection: false,
isHaveLine: true)), isHaveLine: true)),
@ -51,23 +53,24 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
// showCupertinoAlertDialog(context); // showCupertinoAlertDialog(context);
ShowTipView().showTFViewAlertDialog( ShowTipView().showTFViewAlertDialog(
state.changeNameController, state.changeNameController,
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
"", () { '', () {
if (state.changeNameController.text.isEmpty) { if (state.changeNameController.text.isEmpty) {
logic.showToast("请输入姓名".tr); logic.showToast('请输入姓名'.tr);
return; return;
} }
Get.back(); Get.back();
state.typeName.value = state.changeNameController.text; state.typeName.value = state.changeNameController.text;
logic.updateFaceNameData(); logic.updateFaceNameData();
}); }, inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
]);
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: (state.keyType.value == 4 || visible: state.keyType.value == 4 ||
state.keyType.value == 2 || state.keyType.value == 2 ||
state.keyType.value == 1) state.keyType.value == 1,
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
allHeight: 70.h, allHeight: 70.h,
@ -80,14 +83,14 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
// //
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.otherTypeKeyChangeDatePage, Routers.otherTypeKeyChangeDatePage,
arguments: { arguments: <String, Object>{
"pushType": 3, 'pushType': 3,
"fingerprintItemData": state.faceItemData.value, 'fingerprintItemData': state.faceItemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.startDate.value = data["beginTimeTimestamp"]; state.startDate.value = data['beginTimeTimestamp'];
state.endDate.value = data["endTimeTimestamp"]; state.endDate.value = data['endTimeTimestamp'];
state.keyType.value = 2; state.keyType.value = 2;
}); });
} }
@ -95,17 +98,17 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
// //
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage, Routers.otherTypeKeyChangeValidityDatePage,
arguments: { arguments: <String, Object>{
"pushType": 3, 'pushType': 3,
"fingerprintItemData": state.faceItemData.value, 'fingerprintItemData': state.faceItemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.startDate.value = data["starDate"]; state.startDate.value = data['starDate'];
state.endDate.value = data["endDate"]; state.endDate.value = data['endDate'];
state.startTime.value = data["starTime"]; state.startTime.value = data['starTime'];
state.endTime.value = data["endTime"]; state.endTime.value = data['endTime'];
state.weekDay.value = data["validityValue"]; state.weekDay.value = data['validityValue'];
}); });
} }
} }
@ -120,41 +123,41 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
action: () async { action: () async {
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage, Routers.otherTypeKeyChangeValidityDatePage,
arguments: { arguments: <String, Object>{
"pushType": 3, 'pushType': 3,
"fingerprintItemData": state.faceItemData.value, 'fingerprintItemData': state.faceItemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.startDate.value = data["starDate"]; state.startDate.value = data['starDate'];
state.endDate.value = data["endDate"]; state.endDate.value = data['endDate'];
state.startTime.value = data["starTime"]; state.startTime.value = data['starTime'];
state.endTime.value = data["endTime"]; state.endTime.value = data['endTime'];
state.weekDay.value = data["validityValue"]; state.weekDay.value = data['validityValue'];
}); });
} }
})))), })))),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false, visible: state.keyType.value == 4,
child: Obx(() => CommonItem( child: Obx(() => CommonItem(
leftTitel: "有效时间", leftTitel: '有效时间',
rightTitle: rightTitle:
"${DateTool().dateToHNString(state.startTime.value)}-${DateTool().dateToHNString(state.endTime.value)}", '${DateTool().dateToHNString(state.startTime.value)}-${DateTool().dateToHNString(state.endTime.value)}',
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
var data = await Get.toNamed( var data = await Get.toNamed(
Routers.otherTypeKeyChangeValidityDatePage, Routers.otherTypeKeyChangeValidityDatePage,
arguments: { arguments: <String, Object>{
"pushType": 3, 'pushType': 3,
"fingerprintItemData": state.faceItemData.value, 'fingerprintItemData': state.faceItemData.value,
}); });
if (data != null) { if (data != null) {
setState(() { setState(() {
state.startDate.value = data["starDate"]; state.startDate.value = data['starDate'];
state.endDate.value = data["endDate"]; state.endDate.value = data['endDate'];
state.startTime.value = data["starTime"]; state.startTime.value = data['starTime'];
state.endTime.value = data["endTime"]; state.endTime.value = data['endTime'];
state.weekDay.value = data["validityValue"]; state.weekDay.value = data['validityValue'];
}); });
} }
})))), })))),
@ -177,8 +180,8 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
// isHaveLine: true, // isHaveLine: true,
// rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isStressFace()))), // rightWidget: SizedBox(width: 60.w, height: 50.h, child: _isStressFace()))),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: "是否为管理员".tr, leftTitel: '是否为管理员'.tr,
rightTitle: "", rightTitle: '',
isTipsImg: false, isTipsImg: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: rightWidget:
@ -186,10 +189,10 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
Container(height: 10.h), Container(height: 10.h),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr, leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
rightTitle: "", rightTitle: '',
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: { Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
'type': 4, 'type': 4,
'id': state.faceItemData.value.faceId.toString(), 'id': state.faceItemData.value.faceId.toString(),
'recordName': state.faceItemData.value.faceName 'recordName': state.faceItemData.value.faceName
@ -206,7 +209,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () { onClick: () {
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr,
() async { () async {
state.isDeletFace.value = true; state.isDeletFace.value = true;
logic.senderAddFace(); logic.senderAddFace();
@ -223,7 +226,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isStressFace.value, value: state.isStressFace.value,
onChanged: (value) { onChanged: (bool value) {
setState(() { setState(() {
state.isStressFace.value = value; state.isStressFace.value = value;
state.isDeletFace.value = false; state.isDeletFace.value = false;
@ -240,7 +243,7 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isAdministrator.value, value: state.isAdministrator.value,
onChanged: (value) { onChanged: (bool value) {
// state.isAdministrator.value = value; // state.isAdministrator.value = value;
// state.isDeletFace.value = false; // state.isDeletFace.value = false;
// logic.senderAddFace(); // logic.senderAddFace();
@ -250,7 +253,6 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
@ -259,7 +261,6 @@ class _FaceDetailPageState extends State<FaceDetailPage> with RouteAware {
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();

View File

@ -383,7 +383,7 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> with Si
maxLines: 1, maxLines: 1,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'), FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18), LengthLimitingTextInputFormatter(50),
], ],
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor), style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
controller: state.nameController, controller: state.nameController,

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -41,7 +42,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
children: <Widget>[ children: <Widget>[
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: leftTitel:
"${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}", '${TranslationLoader.lanKeys!.fingerprint!.tr}${TranslationLoader.lanKeys!.number!.tr}',
rightTitle: state.typeNumber.value, rightTitle: state.typeNumber.value,
isHaveDirection: false, isHaveDirection: false,
isHaveLine: true)), isHaveLine: true)),
@ -53,7 +54,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
action: () { action: () {
ShowTipView().showTFViewAlertDialog( ShowTipView().showTFViewAlertDialog(
state.changeNameController, state.changeNameController,
"${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}", '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}',
'', () { '', () {
if (state.changeNameController.text.isEmpty) { if (state.changeNameController.text.isEmpty) {
logic.showToast('请输入姓名'.tr); logic.showToast('请输入姓名'.tr);
@ -62,14 +63,15 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
Get.back(); Get.back();
state.typeName.value = state.changeNameController.text; state.typeName.value = state.changeNameController.text;
logic.editFingerprintsData(); logic.editFingerprintsData();
}); }, inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(50),
]);
})), })),
Obx(() => Visibility( Obx(() => Visibility(
visible: (state.keyType.value == 4 || visible: state.keyType.value == 4 ||
state.keyType.value == 2 || state.keyType.value == 2 ||
state.keyType.value == 1) state.keyType.value == 1,
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr, leftTitel: TranslationLoader.lanKeys!.periodValidity!.tr,
allHeight: 70.h, allHeight: 70.h,
@ -140,7 +142,7 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
} }
})))), })))),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.keyType.value == 4 ? true : false, visible: state.keyType.value == 4,
child: Obx(() => CommonItem( child: Obx(() => CommonItem(
leftTitel: '有效时间'.tr, leftTitel: '有效时间'.tr,
rightTitle: rightTitle:
@ -259,7 +261,6 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
@ -268,7 +269,6 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();
@ -286,7 +286,9 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
void didPop() { void didPop() {
super.didPop(); super.didPop();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
} }
@ -303,7 +305,9 @@ class _FingerprintDetailPageState extends State<FingerprintDetailPage>
void didPushNext() { void didPushNext() {
super.didPushNext(); super.didPushNext();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
} }

View File

@ -3,6 +3,8 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprint_entity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart'; import '../../../../blue/io_protocol/io_addFingerprintWithTimeCycleCoercion.dart';
@ -427,6 +429,19 @@ class FingerprintListLogic extends BaseGetXController {
return keyDateTypeStr; return keyDateTypeStr;
} }
//
Future<void> refreshIndividualKeys(
{required int fingerprintId}) async {
final FingerprintEntity entity =
await ApiRepository.to.getFingerprintsData(fingerprintId);
if (entity.errorCode!.codeIsSuccessful) {
final int index = state.fingerprintItemListData
.indexWhere((FingerprintItemData item) => item.fingerprintId == fingerprintId);
state.fingerprintItemListData.removeAt(index);
state.fingerprintItemListData.insert(index, entity.data!);
}
}
@override @override
Future<void> onReady() async { Future<void> onReady() async {
super.onReady(); super.onReady();

View File

@ -1,18 +1,17 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintList_state.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../blue/blue_manage.dart';
import '../../../../tools/EasyRefreshTool.dart'; import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/appRouteObserver.dart'; import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/keySearchWidget.dart'; import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/noData.dart'; import '../../../../tools/noData.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/showTipView.dart'; import '../../../../tools/showTipView.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import '../../../../tools/submitBtn.dart'; import '../../../../tools/submitBtn.dart';
@ -30,11 +29,11 @@ class FingerprintListPage extends StatefulWidget {
class _FingerprintListPageState extends State<FingerprintListPage> class _FingerprintListPageState extends State<FingerprintListPage>
with RouteAware { with RouteAware {
final logic = Get.put(FingerprintListLogic()); final FingerprintListLogic logic = Get.put(FingerprintListLogic());
final state = Get.find<FingerprintListLogic>().state; final FingerprintListState state = Get.find<FingerprintListLogic>().state;
Future<void> getHttpData({required bool isRefresh}) async { Future<void> getHttpData({required bool isRefresh}) async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
logic logic
.getFingerprintsListData(isRefresh: isRefresh) .getFingerprintsListData(isRefresh: isRefresh)
@ -61,24 +60,23 @@ class _FingerprintListPageState extends State<FingerprintListPage>
barTitle: TranslationLoader.lanKeys!.fingerprint!.tr, barTitle: TranslationLoader.lanKeys!.fingerprint!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: <Widget>[
TextButton( TextButton(
child: Text( child: Text(
TranslationLoader.lanKeys!.reset!.tr, TranslationLoader.lanKeys!.reset!.tr,
style: TextStyle(color: Colors.white, fontSize: 24.sp), style: TextStyle(color: Colors.white, fontSize: 24.sp),
), ),
onPressed: () async { onPressed: () async {
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot); final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) { if (isDemoMode == false) {
ShowTipView().showIosTipWithContentDialog( ShowTipView().showIosTipWithContentDialog('重置后,该锁的指纹都将被删除哦,确认要重置吗?'.tr, () async {
"重置后,该锁的指纹都将被删除哦,确认要重置吗?".tr, () async {
state.isDeletAll = true; state.isDeletAll = true;
state.deletKeyID = "1"; state.deletKeyID = '1';
state.deletFingerNo = 0; state.deletFingerNo = 0;
logic.senderAddFingerprint(); logic.senderAddFingerprint();
}); });
} else { } else {
logic.showToast("演示模式".tr); logic.showToast('演示模式'.tr);
} }
}, },
), ),
@ -92,7 +90,7 @@ class _FingerprintListPageState extends State<FingerprintListPage>
getHttpData(isRefresh: false); getHttpData(isRefresh: false);
}, },
child: Column( child: Column(
children: [ children: <Widget>[
KeySearchWidget( KeySearchWidget(
editingController: state.searchController, editingController: state.searchController,
onSubmittedAction: () { onSubmittedAction: () {
@ -107,10 +105,10 @@ class _FingerprintListPageState extends State<FingerprintListPage>
btnName: btnName:
'${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}', '${TranslationLoader.lanKeys!.add!.tr}${TranslationLoader.lanKeys!.fingerprint!.tr}',
onClick: () async { onClick: () async {
var data = await Get.toNamed(Routers.addFingerprintTypePage, final data = await Get.toNamed(Routers.addFingerprintTypePage,
arguments: { arguments: <String, int>{
"lockId": state.lockId.value, 'lockId': state.lockId.value,
"fromType": 1 // 1 2 'fromType': 1 // 1 2
}); });
if (data != null) { if (data != null) {
getHttpData(isRefresh: true); getHttpData(isRefresh: true);
@ -129,8 +127,8 @@ class _FingerprintListPageState extends State<FingerprintListPage>
? SlidableAutoCloseBehavior( ? SlidableAutoCloseBehavior(
child: ListView.separated( child: ListView.separated(
itemCount: state.fingerprintItemListData.value.length, itemCount: state.fingerprintItemListData.value.length,
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
FingerprintItemData fingerprintItemData = final FingerprintItemData fingerprintItemData =
state.fingerprintItemListData.value[index]; state.fingerprintItemListData.value[index];
// //
return Slidable( return Slidable(
@ -138,11 +136,11 @@ class _FingerprintListPageState extends State<FingerprintListPage>
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: <Widget>[
SlidableAction( SlidableAction(
onPressed: (BuildContext context) { onPressed: (BuildContext context) {
ShowTipView().showIosTipWithContentDialog( ShowTipView().showIosTipWithContentDialog(
"确定要删除吗?".tr, () async { '确定要删除吗?'.tr, () async {
state.isDeletAll = false; state.isDeletAll = false;
state.deletKeyID = state.deletKeyID =
fingerprintItemData.fingerprintId.toString(); fingerprintItemData.fingerprintId.toString();
@ -163,12 +161,15 @@ class _FingerprintListPageState extends State<FingerprintListPage>
fingerprintItemData.fingerprintName!, fingerprintItemData.fingerprintName!,
logic.getKeyType(fingerprintItemData), logic.getKeyType(fingerprintItemData),
logic.getKeyDateType(fingerprintItemData), () async { logic.getKeyDateType(fingerprintItemData), () async {
var data = await Get.toNamed(Routers.fingerprintDetailPage, final data = await Get.toNamed(Routers.fingerprintDetailPage,
arguments: { arguments: <String, FingerprintItemData>{
"fingerprintItemData": fingerprintItemData, 'fingerprintItemData': fingerprintItemData,
}); });
if (data != null) { if (data != null) {
getHttpData(isRefresh: true); logic
.refreshIndividualKeys(
fingerprintId: fingerprintItemData.fingerprintId!)
.then((dynamic value) => setState(() {}));
} }
}), }),
); );
@ -202,23 +203,23 @@ class _FingerprintListPageState extends State<FingerprintListPage>
// // borderRadius: BorderRadius.circular(10.w), // // borderRadius: BorderRadius.circular(10.w),
// ), // ),
child: Row( child: Row(
children: [ children: <Widget>[
SizedBox(width: 30.w), SizedBox(width: 30.w),
Image.asset(lockTypeIcon, width: 60.w, height: 60.w), Image.asset(lockTypeIcon, width: 60.w, height: 60.w),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Expanded( Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
Row( Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: <Widget>[
SizedBox( SizedBox(
width: ifInvalidation.isNotEmpty width: ifInvalidation.isNotEmpty
? 1.sw - 110.w - 100.w ? 1.sw - 110.w - 100.w
: 1.sw - 110.w - 50.w, : 1.sw - 110.w - 50.w,
child: Row( child: Row(
children: [ children: <Widget>[
Flexible( Flexible(
child: Text(lockTypeTitle, child: Text(lockTypeTitle,
maxLines: 1, maxLines: 1,
@ -238,7 +239,7 @@ class _FingerprintListPageState extends State<FingerprintListPage>
SizedBox(height: 5.h), SizedBox(height: 5.h),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Flexible( Flexible(
child: Text(showTime, child: Text(showTime,
maxLines: 1, maxLines: 1,
@ -262,7 +263,6 @@ class _FingerprintListPageState extends State<FingerprintListPage>
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
@ -271,7 +271,6 @@ class _FingerprintListPageState extends State<FingerprintListPage>
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();
@ -289,7 +288,9 @@ class _FingerprintListPageState extends State<FingerprintListPage>
void didPop() { void didPop() {
super.didPop(); super.didPop();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
} }
@ -305,7 +306,9 @@ class _FingerprintListPageState extends State<FingerprintListPage>
void didPushNext() { void didPushNext() {
super.didPushNext(); super.didPushNext();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
} }
} }

View File

@ -0,0 +1,29 @@
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
class FingerprintEntity {
FingerprintEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
FingerprintEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null ? FingerprintItemData.fromJson(json['data']) : null;
}
int? errorCode;
String? description;
String? errorMsg;
FingerprintItemData? data;
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@ -66,6 +67,7 @@ class LockDetailLogic extends BaseGetXController {
state.iSClosedUnlockSuccessfulPopup.value = true; state.iSClosedUnlockSuccessfulPopup.value = true;
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
state.closedUnlockSuccessfulTimer?.cancel(); state.closedUnlockSuccessfulTimer?.cancel();
EasyLoading.dismiss();
// 3 // 3
state.closedUnlockSuccessfulTimer = state.closedUnlockSuccessfulTimer =
Timer.periodic(3.seconds, (Timer timer) { Timer.periodic(3.seconds, (Timer timer) {

View File

@ -46,7 +46,8 @@ class _LockDetailMainPageState extends State<LockDetailMainPage> {
xhjCall: () => Scaffold( xhjCall: () => Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
appBar: TitleAppBar( appBar: TitleAppBar(
barTitle: keyInfos.lockAlias, barTitle: F.sw(
xhjCall: () => '星星锁', skyCall: () => keyInfos.lockAlias),
haveBack: true, haveBack: true,
backgroundColor: Colors.white, backgroundColor: Colors.white,
titleColor: AppColors.blackColor, titleColor: AppColors.blackColor,

View File

@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart' as intl;
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_list_page.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_list_page.dart';
@ -153,10 +153,22 @@ class _LockDetailPageState extends State<LockDetailPage>
return Scaffold( return Scaffold(
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: Obx(() { body: Obx(() {
final String lockAlias = state.keyInfos.value.lockAlias!;
return Stack( return Stack(
children: <Widget>[ children: <Widget>[
Column( Column(
children: <Widget>[ children: <Widget>[
SizedBox(
height: 15.h,
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 24.w),
child: Text(
lockAlias,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 24.sp, color: Colors.black),
),
),
SizedBox( SizedBox(
height: 35.h, height: 35.h,
), ),
@ -1280,6 +1292,19 @@ class _LockDetailPageState extends State<LockDetailPage>
} }
Widget _unlockSuccessWidget() { Widget _unlockSuccessWidget() {
String lockAlias = state.keyInfos.value.lockAlias!;
final TextStyle lockAliasTextStyle =
TextStyle(color: AppColors.placeholderTextColor, fontSize: 24.sp);
final TextPainter textPainter = TextPainter(
text: TextSpan(text: lockAlias, style: lockAliasTextStyle),
maxLines: 1,
textDirection: TextDirection.ltr)
..layout(minWidth: 0, maxWidth: double.infinity);
final double textSizeWidth = textPainter.size.width; //
if (textSizeWidth > 358.w * 2 - 20) {
lockAlias = '${lockAlias.substring(0, 25)}...';
}
return Center( return Center(
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
@ -1298,9 +1323,10 @@ class _LockDetailPageState extends State<LockDetailPage>
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Text( Text(
state.keyInfos.value.lockAlias!, lockAlias,
style: TextStyle( style: TextStyle(
color: AppColors.placeholderTextColor, fontSize: 24.sp), color: AppColors.placeholderTextColor, fontSize: 24.sp),
maxLines: 2,
), ),
SizedBox( SizedBox(
height: 10.h, height: 10.h,
@ -1337,7 +1363,7 @@ class _LockDetailPageState extends State<LockDetailPage>
// //
final DateTime now = DateTime.now(); final DateTime now = DateTime.now();
// //
final String formattedTime = DateFormat('MM/dd HH:mm').format(now); final String formattedTime = intl.DateFormat('MM/dd HH:mm').format(now);
return formattedTime; return formattedTime;
} }

View File

@ -121,7 +121,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
}))), }))),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr, leftTitel: TranslationLoader.lanKeys!.lockGrouping!.tr,
rightTitle: state.lockBasicInfo.value.groupName!.tr ?? '', rightTitle: state.lockBasicInfo.value.groupName ?? '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () async { action: () async {
@ -150,7 +150,7 @@ class _BasicInformationPageState extends State<BasicInformationPage> {
}), }),
)), )),
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockBasicInfo.value.lockName!.contains('T9A'), visible: (state.lockBasicInfo.value.lockName ?? '').contains('T9A'),
child: CommonItem( child: CommonItem(
leftTitel: '当前网络'.tr, leftTitel: '当前网络'.tr,
rightTitle: state.lockBasicInfo.value.network ?? '-', rightTitle: state.lockBasicInfo.value.network ?? '-',

View File

@ -2,7 +2,9 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
import '../../../../../app_settings/app_settings.dart';
import '../../../../../blue/blue_manage.dart'; import '../../../../../blue/blue_manage.dart';
import '../../../../../blue/io_protocol/io_getStarLockStatusInfo.dart'; import '../../../../../blue/io_protocol/io_getStarLockStatusInfo.dart';
import '../../../../../blue/io_reply.dart'; import '../../../../../blue/io_reply.dart';
@ -11,6 +13,7 @@ import '../../../../../blue/io_tool/manager_event_bus.dart';
import '../../../../../blue/sender_manage.dart'; import '../../../../../blue/sender_manage.dart';
import '../../../../../network/api_repository.dart'; import '../../../../../network/api_repository.dart';
import '../../../../../tools/baseGetXController.dart'; import '../../../../../tools/baseGetXController.dart';
import '../../../../../tools/dateTool.dart';
import '../../../../../tools/eventBusEventManage.dart'; import '../../../../../tools/eventBusEventManage.dart';
import '../../../../../tools/storage.dart'; import '../../../../../tools/storage.dart';
import '../../../lockOperatingRecord/keyOperationRecord_entity.dart'; import '../../../lockOperatingRecord/keyOperationRecord_entity.dart';
@ -21,18 +24,18 @@ class UploadElectricQuantityLogic extends BaseGetXController {
// //
Future<void> uploadElectricQuantityRequest(String electricQuantity, String electricQuantityStandby) async { Future<void> uploadElectricQuantityRequest(String electricQuantity, String electricQuantityStandby) async {
KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity( final KeyOperationRecordEntity entity = await ApiRepository.to.uploadElectricQuantity(
electricQuantity:electricQuantity, electricQuantity:electricQuantity,
electricQuantityStandby: electricQuantityStandby, electricQuantityStandby: electricQuantityStandby,
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
isUnShowLoading: false isUnShowLoading: false
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("锁电量更新成功".tr, something: () { showToast('锁电量更新成功'.tr, something: () {
eventBus eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value)); .fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus.fire( eventBus.fire(
LockSetChangeSetRefreshLockDetailWithType(0, electricQuantity)); LockSetChangeSetRefreshLockDetailWithType(4, electricQuantity));
eventBus.fire(RefreshLockListInfoDataEvent()); eventBus.fire(RefreshLockListInfoDataEvent());
}); });
} }
@ -54,13 +57,13 @@ class UploadElectricQuantityLogic extends BaseGetXController {
(BluetoothConnectionState deviceConnectionState) async { (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
dismissEasyLoading(); dismissEasyLoading();
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
utcTimeStamp: getUTCNetTime(), utcTimeStamp: getUTCTime(),
unixTimeStamp: getLocalNetTime(), unixTimeStamp: getLocalTime(),
isBeforeAddUser: false, isBeforeAddUser: false,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
@ -79,7 +82,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) { EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
// //
if (reply is GetStarLockStatuInfoReply) { if (reply is GetStarLockStatuInfoReply) {
_replyGetStarLockStatusInfo(reply); _replyGetStarLockStatusInfo(reply);
@ -89,7 +92,7 @@ class UploadElectricQuantityLogic extends BaseGetXController {
// //
Future<void> _replyGetStarLockStatusInfo(Reply reply) async { Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
int status = reply.data[2]; final int status = reply.data[2];
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
@ -98,11 +101,11 @@ class UploadElectricQuantityLogic extends BaseGetXController {
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
// //
var battRemCap = reply.data[132]; final int battRemCap = reply.data[132];
state.lockSetInfoData.value.lockBasicInfo!.electricQuantity = battRemCap; state.lockSetInfoData.value.lockBasicInfo!.electricQuantity = battRemCap;
// //
var battRemCapStandby = reply.data[133]; final int battRemCapStandby = reply.data[133];
state.lockSetInfoData.value.lockBasicInfo!.electricQuantityStandby = battRemCapStandby; state.lockSetInfoData.value.lockBasicInfo!.electricQuantityStandby = battRemCapStandby;
state.uploadElectricQuantityDate.value = DateTime.now().millisecondsSinceEpoch; state.uploadElectricQuantityDate.value = DateTime.now().millisecondsSinceEpoch;
@ -111,16 +114,18 @@ class UploadElectricQuantityLogic extends BaseGetXController {
break; break;
case 0x06: case 0x06:
// //
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
utcTimeStamp: getUTCNetTime(), utcTimeStamp: getUTCTime(),
unixTimeStamp: getLocalNetTime(), unixTimeStamp: getLocalTime(),
isBeforeAddUser: false, isBeforeAddUser: false,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
break; break;
default: default:
// //
@ -129,32 +134,29 @@ class UploadElectricQuantityLogic extends BaseGetXController {
} }
// //
void getServerDatetime() async{ Future<void> getServerDatetime() async{
var entity = await ApiRepository.to.getServerDatetimeData(); final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData();
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000; state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
getLocalNetTime();
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}"); // AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
} }
} }
int getUTCNetTime(){ int getLocalTime(){
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime; return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
} }
int getLocalNetTime(){ int getUTCTime(){
DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getUTCNetTime()*1000, isUtc: true); final DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000, isUtc: true);
DateTime localTime = utcTime.toLocal();
// AppLog.log('getUTCNetTime: ${getUTCNetTime()}'); final String appointmentDate = DateTool().getYMDHNDateStringWithDateTime(utcTime, 1);
// AppLog.log('UTC time: $utcTime'); final int utcTimeValue = DateTool().dateToTimestamp(appointmentDate, 1);
// AppLog.log('Local time: $localTime localTime.millisecondsSinceEpoch ~/ 1000:${localTime.millisecondsSinceEpoch ~/ 1000}'); AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue');
return localTime.millisecondsSinceEpoch ~/ 1000; return utcTimeValue ~/ 1000;
} }
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
@ -163,13 +165,11 @@ class UploadElectricQuantityLogic extends BaseGetXController {
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
} }
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();
} }

View File

@ -3,9 +3,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadElectricQuantity_state.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../blue/blue_manage.dart';
import '../../../../../tools/appRouteObserver.dart'; import '../../../../../tools/appRouteObserver.dart';
import '../../../../../tools/dateTool.dart'; import '../../../../../tools/dateTool.dart';
import '../../../../../tools/submitBtn.dart'; import '../../../../../tools/submitBtn.dart';
@ -22,8 +22,8 @@ class UploadElectricQuantityPage extends StatefulWidget {
} }
class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage> with RouteAware { class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage> with RouteAware {
final logic = Get.put(UploadElectricQuantityLogic()); final UploadElectricQuantityLogic logic = Get.put(UploadElectricQuantityLogic());
final state = Get.find<UploadElectricQuantityLogic>().state; final UploadElectricQuantityState state = Get.find<UploadElectricQuantityLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -36,10 +36,10 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
body: Container( body: Container(
padding: EdgeInsets.all(30.w), padding: EdgeInsets.all(30.w),
child: Column( child: Column(
children: [ children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Expanded( Expanded(
child: Text( child: Text(
TranslationLoader.lanKeys!.updateElectricQuantityTip!.tr, TranslationLoader.lanKeys!.updateElectricQuantityTip!.tr,
@ -52,7 +52,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
), ),
Obx(() => Row( Obx(() => Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Expanded( Expanded(
child: Text( child: Text(
"${"电池1".tr}:${TranslationLoader.lanKeys!.electricQuantity!.tr}:${state.lockBasicInfo.value.electricQuantity ?? ""}%", "${"电池1".tr}:${TranslationLoader.lanKeys!.electricQuantity!.tr}:${state.lockBasicInfo.value.electricQuantity ?? ""}%",
@ -64,7 +64,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
visible: state.lockSetInfoData.value.lockFeature!.isSupportBackupBattery == 1, visible: state.lockSetInfoData.value.lockFeature!.isSupportBackupBattery == 1,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Expanded( Expanded(
child: Text( child: Text(
"${"电池2".tr}:${TranslationLoader.lanKeys!.electricQuantity!.tr}:${state.lockBasicInfo.value.electricQuantityStandby ?? ""}%", "${"电池2".tr}:${TranslationLoader.lanKeys!.electricQuantity!.tr}:${state.lockBasicInfo.value.electricQuantityStandby ?? ""}%",
@ -76,7 +76,7 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
SizedBox(height: 10.h), SizedBox(height: 10.h),
Obx(() => Row( Obx(() => Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Expanded( Expanded(
child: Text( child: Text(
"${"电量更新时间".tr}:${DateTool().dateToYMDHNString(state.uploadElectricQuantityDate.value.toString())}", "${"电量更新时间".tr}:${DateTool().dateToYMDHNString(state.uploadElectricQuantityDate.value.toString())}",
@ -104,7 +104,6 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
@ -113,7 +112,6 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();
@ -148,7 +146,9 @@ class _UploadElectricQuantityPageState extends State<UploadElectricQuantityPage>
void didPushNext() { void didPushNext() {
super.didPushNext(); super.didPushNext();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
} }

View File

@ -3,24 +3,24 @@ import 'package:get/get.dart';
import '../../lockSet/lockSetInfo_entity.dart'; import '../../lockSet/lockSetInfo_entity.dart';
class UploadElectricQuantityState { class UploadElectricQuantityState {// 0 1
var lockSetInfoData = LockSetInfoData().obs;
var lockBasicInfo = LockBasicInfo().obs;
var uploadElectricQuantityDate = 0.obs;
int differentialTime = 0;
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0 1
UploadElectricQuantityState() { UploadElectricQuantityState() {
var map = Get.arguments; final map = Get.arguments;
if(map["lockSetInfoData"]!=null){ if(map['lockSetInfoData']!=null){
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
if(lockSetInfoData.value.lockBasicInfo!=null){ if(lockSetInfoData.value.lockBasicInfo!=null){
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!; lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
uploadElectricQuantityDate.value = lockSetInfoData.value.lockBasicInfo!.electricQuantityDate!; uploadElectricQuantityDate.value = lockSetInfoData.value.lockBasicInfo!.electricQuantityDate!;
} }
} }
} }
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
Rx<LockBasicInfo> lockBasicInfo = LockBasicInfo().obs;
RxInt uploadElectricQuantityDate = 0.obs;
int differentialTime = 0;
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;
} }

View File

@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSet_state.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
@ -25,8 +27,8 @@ class LockSetPage extends StatefulWidget {
} }
class _LockSetPageState extends State<LockSetPage> with RouteAware { class _LockSetPageState extends State<LockSetPage> with RouteAware {
final logic = Get.put(LockSetLogic()); final LockSetLogic logic = Get.put(LockSetLogic());
final state = Get.find<LockSetLogic>().state; final LockSetState state = Get.find<LockSetLogic>().state;
Future<void> getHttpData() async { Future<void> getHttpData() async {
logic.getLockSettingInfoData().then((LockSetInfoEntity value) { logic.getLockSettingInfoData().then((LockSetInfoEntity value) {
@ -36,7 +38,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
@override @override
void initState() { void initState() {
// TODO: implement initState
super.initState(); super.initState();
logic.initLoadDataAction(() { logic.initLoadDataAction(() {
@ -59,7 +60,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
getHttpData(); getHttpData();
}, },
child: Column( child: Column(
children: [ children: <Widget>[
Expanded( Expanded(
child: Obx(() => ListView( child: Obx(() => ListView(
children: getListWidget(), children: getListWidget(),
@ -83,25 +84,25 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// //
List<Widget> getNormalWidget() { List<Widget> getNormalWidget() {
var showWidgetArr = [ final List<Widget> showWidgetArr = <Widget>[
// //
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.basicInformation!.tr, leftTitel: TranslationLoader.lanKeys!.basicInformation!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.basicInformationPage, Get.toNamed(Routers.basicInformationPage,
arguments: {'lockSetInfoData': state.lockSetInfoData.value}); arguments: <String, LockSetInfoData>{'lockSetInfoData': state.lockSetInfoData.value});
}), }),
SizedBox(height: 10.h), SizedBox(height: 10.h),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1 ? true : false, visible: state.lockFeature.value.autoLock == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr, leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0 rightTitle: (state.lockSettingInfo.value.autoLock ?? 0) > 0
? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s" ? '${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond ?? 0}s'
: TranslationLoader.lanKeys!.closed!.tr, : TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
@ -110,14 +111,14 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s" // ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr), // : TranslationLoader.lanKeys!.closed!.tr),
action: () { action: () {
Get.toNamed(Routers.automaticBlockingPage, arguments: { Get.toNamed(Routers.automaticBlockingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value, 'lockSetInfoData': state.lockSetInfoData.value,
// 'lockBasicInfo': state.lockBasicInfo.value // 'lockBasicInfo': state.lockBasicInfo.value
}); });
}))), }))),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1 ? true : false, visible: state.lockFeature.value.passageMode == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr, leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1 rightTitle: (state.lockSettingInfo.value.passageMode ?? 0) == 1
@ -126,7 +127,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.normallyOpenModePage, arguments: { Get.toNamed(Routers.normallyOpenModePage, arguments: <String, Object>{
'lockSetInfoData': state.lockSetInfoData.value, 'lockSetInfoData': state.lockSetInfoData.value,
'lockBasicInfo': state.lockBasicInfo.value 'lockBasicInfo': state.lockBasicInfo.value
}); });
@ -135,11 +136,11 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
visible: true, visible: true,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockTime!.tr, leftTitel: TranslationLoader.lanKeys!.lockTime!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.lockTimePage, arguments: { Get.toNamed(Routers.lockTimePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
})), })),
@ -164,16 +165,16 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// //
List<Widget> getAllWidget() { List<Widget> getAllWidget() {
var showWidgetArr = [ final List<Widget> showWidgetArr = <Widget>[
// //
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.basicInformation!.tr, leftTitel: TranslationLoader.lanKeys!.basicInformation!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.basicInformationPage, Get.toNamed(Routers.basicInformationPage,
arguments: {'lockSetInfoData': state.lockSetInfoData.value}); arguments: <String, LockSetInfoData>{'lockSetInfoData': state.lockSetInfoData.value});
}), }),
SizedBox(height: 10.h), SizedBox(height: 10.h),
//by DaisyWu //by DaisyWu
@ -226,11 +227,11 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// SizedBox(height: 10.h), // SizedBox(height: 10.h),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockFeature.value.autoLock == 1 ? true : false, visible: state.lockFeature.value.autoLock == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr, leftTitel: TranslationLoader.lanKeys!.automaticBlocking!.tr,
rightTitle: state.lockSettingInfo.value.autoLock! > 0 rightTitle: state.lockSettingInfo.value.autoLock! > 0
? "${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond}s" ? '${state.lockSetInfoData.value.lockSettingInfo!.autoLockSecond}s'
: TranslationLoader.lanKeys!.closed!.tr, : TranslationLoader.lanKeys!.closed!.tr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
@ -239,13 +240,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s" // ? "${state.lockSetInfoData.value.lockSetting!.autoLockSecond ?? 0}s"
// : TranslationLoader.lanKeys!.closed!.tr), // : TranslationLoader.lanKeys!.closed!.tr),
action: () { action: () {
Get.toNamed(Routers.automaticBlockingPage, arguments: { Get.toNamed(Routers.automaticBlockingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
}))), }))),
// //
Obx(() { Obx(() {
var titleStr = ""; String titleStr = '';
if ((state.lockSettingInfo.value.lockSound ?? 0) == 1) { if ((state.lockSettingInfo.value.lockSound ?? 0) == 1) {
switch (state.lockSettingInfo.value.lockSoundVolume ?? 0) { switch (state.lockSettingInfo.value.lockSoundVolume ?? 0) {
case 1: case 1:
@ -268,21 +269,21 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
titleStr = TranslationLoader.lanKeys!.closed!.tr; titleStr = TranslationLoader.lanKeys!.closed!.tr;
} }
return Visibility( return Visibility(
visible: state.lockFeature.value.lockSound == 1 ? true : false, visible: state.lockFeature.value.lockSound == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockSound!.tr, leftTitel: TranslationLoader.lanKeys!.lockSound!.tr,
rightTitle: titleStr, rightTitle: titleStr,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.lockSoundSetPage, arguments: { Get.toNamed(Routers.lockSoundSetPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
})); }));
}), }),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockFeature.value.antiPrySwitch == 1 ? true : false, visible: state.lockFeature.value.antiPrySwitch == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr, leftTitel: TranslationLoader.lanKeys!.burglarAlarm!.tr,
rightTitle: (state.lockSettingInfo.value.antiPrySwitch ?? 0) == 1 rightTitle: (state.lockSettingInfo.value.antiPrySwitch ?? 0) == 1
@ -291,14 +292,14 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.burglarAlarmPage, arguments: { Get.toNamed(Routers.burglarAlarmPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
}))), }))),
SizedBox(height: 10.h), SizedBox(height: 10.h),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockFeature.value.passageMode == 1 ? true : false, visible: state.lockFeature.value.passageMode == 1,
// visible: true, // visible: true,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr, leftTitel: TranslationLoader.lanKeys!.normallyOpenMode!.tr,
@ -308,13 +309,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.normallyOpenModePage, arguments: { Get.toNamed(Routers.normallyOpenModePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
}))), }))),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockFeature.value.remoteUnlock == 1 ? true : false, visible: state.lockFeature.value.remoteUnlock == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr, leftTitel: TranslationLoader.lanKeys!.remoteUnlocking!.tr,
rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) == 1 rightTitle: (state.lockSettingInfo.value.remoteUnlock ?? 0) == 1
@ -323,16 +324,13 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.remoteUnlockingPage, arguments: { Get.toNamed(Routers.remoteUnlockingPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
}))), }))),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: (state.lockBasicInfo.value.isLockOwner == 1 && visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.resetSwitch == 1,
state.lockFeature.value.resetSwitch == 1)
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.resetButton!.tr, leftTitel: TranslationLoader.lanKeys!.resetButton!.tr,
rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1 rightTitle: (state.lockSettingInfo.value.resetSwitch ?? 0) == 1
@ -341,7 +339,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.resetButtonPage, arguments: { Get.toNamed(Routers.resetButtonPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
}))), }))),
@ -350,14 +348,14 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// Obx(() => // Obx(() =>
// //
Visibility( Visibility(
visible: state.lockFeature.value.d3Face == 1 ? true : false, visible: state.lockFeature.value.d3Face == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr, leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.faceUnlockPage, arguments: { Get.toNamed(Routers.faceUnlockPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
})), })),
@ -367,23 +365,23 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
visible: true, visible: true,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.messageReminding!.tr, leftTitel: TranslationLoader.lanKeys!.messageReminding!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.msgNotificationPage, Get.toNamed(Routers.msgNotificationPage,
arguments: {'lockId': state.lockSetInfoData.value.lockId}); arguments: <String, int?>{'lockId': state.lockSetInfoData.value.lockId});
})), })),
// //
Obx(() => Visibility( Obx(() => Visibility(
visible: state.lockFeature.value.isSupportCatEye == 1 ? true : false, visible: state.lockFeature.value.isSupportCatEye == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.catEyeSet!.tr, leftTitel: TranslationLoader.lanKeys!.catEyeSet!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.catEyeSetPage, arguments: { Get.toNamed(Routers.catEyeSetPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
}))), }))),
@ -415,23 +413,23 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// Obx(() => // Obx(() =>
// //
Visibility( Visibility(
visible: state.lockFeature.value.openDirection == 1 ? true : false, visible: state.lockFeature.value.openDirection == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.openingDirectionSet!.tr, leftTitel: TranslationLoader.lanKeys!.openingDirectionSet!.tr,
rightTitle: "", rightTitle: '',
isHaveDirection: true, isHaveDirection: true,
isHaveLine: true, isHaveLine: true,
action: () { action: () {
Get.toNamed(Routers.openDoorDirectionPage, arguments: { Get.toNamed(Routers.openDoorDirectionPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
})), })),
// //
Visibility( Visibility(
visible: state.lockFeature.value.motorTorsion == 1 ? true : false, visible: state.lockFeature.value.motorTorsion == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.motorPowerSetting!.tr, leftTitel: TranslationLoader.lanKeys!.motorPowerSetting!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -481,7 +479,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
: false, : false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr, leftTitel: TranslationLoader.lanKeys!.checkingIn!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: _openCheckInSwitch())), rightWidget: _openCheckInSwitch())),
@ -489,11 +487,10 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// //
Obx( Obx(
() => Visibility( () => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 && visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.unlockReminder == 1,
state.lockFeature.value.unlockReminder == 1,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr, leftTitel: TranslationLoader.lanKeys!.unlockReminder!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: _lockRemindSwitch())), rightWidget: _lockRemindSwitch())),
@ -501,14 +498,11 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// APP开锁时是否需联网 // APP开锁时是否需联网
Obx( Obx(
() => Visibility( () => Visibility(
visible: state.lockBasicInfo.value.isLockOwner == 1 && visible: state.lockBasicInfo.value.isLockOwner == 1 && state.lockFeature.value.appUnlockOnline == 1,
state.lockFeature.value.appUnlockOnline == 1
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader leftTitel: TranslationLoader
.lanKeys!.whetherInternetRequiredWhenUnlocking!.tr, .lanKeys!.whetherInternetRequiredWhenUnlocking!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: false, isHaveLine: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: _openLockNeedOnlineSwitch()), rightWidget: _openLockNeedOnlineSwitch()),
@ -518,15 +512,15 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
// wifi配网 // wifi配网
Obx( Obx(
() => Visibility( () => Visibility(
visible: state.lockFeature.value.wifi == 1 ? true : false, visible: state.lockFeature.value.wifi == 1,
child: CommonItem( child: CommonItem(
leftTitel: leftTitel:
TranslationLoader.lanKeys!.wifiDistributionNetwork!.tr, TranslationLoader.lanKeys!.wifiDistributionNetwork!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.wifiListPage, arguments: { Get.toNamed(Routers.wifiListPage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
// Get.toNamed(Routers.configuringWifiPage, arguments: { // Get.toNamed(Routers.configuringWifiPage, arguments: {
@ -540,11 +534,11 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
visible: true, visible: true,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockTime!.tr, leftTitel: TranslationLoader.lanKeys!.lockTime!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.lockTimePage, arguments: { Get.toNamed(Routers.lockTimePage, arguments: <String, LockSetInfoData>{
'lockSetInfoData': state.lockSetInfoData.value 'lockSetInfoData': state.lockSetInfoData.value
}); });
})), })),
@ -570,7 +564,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
visible: true, visible: true,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.uploadData!.tr, leftTitel: TranslationLoader.lanKeys!.uploadData!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -596,7 +590,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
visible: true, visible: true,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.lockEscalation!.tr, leftTitel: TranslationLoader.lanKeys!.lockEscalation!.tr,
rightTitle: "", rightTitle: '',
isHaveLine: false, isHaveLine: false,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
@ -624,7 +618,7 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
} }
Widget rightText(String rightTitle) { Widget rightText(String rightTitle) {
return Text(rightTitle ?? "", return Text(rightTitle ?? '',
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor)); style: TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor));
} }
@ -635,15 +629,15 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isAttendance.value == 1 ? true : false, value: state.isAttendance.value == 1,
onChanged: (value) { onChanged: (bool value) {
logic.openCheckingInData((checkingInInfoDataEntity) { logic.openCheckingInData((CheckingInInfoDataEntity checkingInInfoDataEntity) {
if (checkingInInfoDataEntity.data!.companyId == 0) { if (checkingInInfoDataEntity.data!.companyId == 0) {
// logic.showCupertinoAlertDialog(context); // logic.showCupertinoAlertDialog(context);
ShowTipView().showIosTipWithContentDialog("创建公司后,考勤功能才能使用".tr, () { ShowTipView().showIosTipWithContentDialog('创建公司后,考勤功能才能使用'.tr, () {
// //
Get.toNamed(Routers.checkInCreatCompanyPage, Get.toNamed(Routers.checkInCreatCompanyPage,
arguments: {'lockSetInfoData': state.lockSetInfoData.value}); arguments: <String, LockSetInfoData>{'lockSetInfoData': state.lockSetInfoData.value});
}); });
} else { } else {
logic.setLockSetGeneralSetting(); logic.setLockSetGeneralSetting();
@ -672,8 +666,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: (state.isOpenLockNeedOnline.value) == 1 ? true : false, value: state.isOpenLockNeedOnline.value == 1,
onChanged: (value) { onChanged: (bool value) {
setState(() { setState(() {
logic.sendBurglarAlarm(55); logic.sendBurglarAlarm(55);
}); });
@ -717,8 +711,8 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: (state.isOpenBlueBroadcast.value) == 1 ? true : false, value: state.isOpenBlueBroadcast.value == 1,
onChanged: (value) { onChanged: (bool value) {
setState(() { setState(() {
logic.sendBurglarAlarm(56); logic.sendBurglarAlarm(56);
}); });
@ -732,15 +726,14 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: false, value: false,
onChanged: (value) { onChanged: (bool value) {
logic.showToast("功能暂未开放"); logic.showToast('功能暂未开放');
}, },
); );
} }
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
@ -749,7 +742,6 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();
@ -769,7 +761,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
super.didPop(); super.didPop();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
// if (state.deletWaitScanTimer != null) { // if (state.deletWaitScanTimer != null) {
// state.deletWaitScanTimer!.cancel(); // state.deletWaitScanTimer!.cancel();
// } // }
@ -794,7 +788,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
super.didPushNext(); super.didPushNext();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
} }
} }

View File

@ -1,8 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'package:date_format/date_format.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_getStarLockStatusInfo.dart'; import '../../../../blue/io_protocol/io_getStarLockStatusInfo.dart';
@ -23,65 +26,69 @@ class LockTimeLogic extends BaseGetXController{
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) { _replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if(reply is TimingReply) { if(reply is TimingReply) {
_replyTiming(reply); _replyTiming(reply);
} }
// //
// if(reply is GetStarLockStatuInfoReply && state.ifCurrentScreen.value == true) { if(reply is GetStarLockStatuInfoReply && state.ifCurrentScreen.value == true) {
// _replyGetStarLockStatusInfo(reply); _replyGetStarLockStatusInfo(reply);
// } }
}); });
} }
// //
// Future<void> _replyGetStarLockStatusInfo(Reply reply) async { Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
// int status = reply.data[2]; final int status = reply.data[2];
// switch (status) { switch (status) {
// case 0x00: case 0x00:
// // //
// cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
// dismissEasyLoading(); dismissEasyLoading();
//
// // //
// var indate = reply.data.sublist(149, 153); final List<int> indate = reply.data.sublist(150, 154);
// int indateValue = ((0xff & indate[(0)]) << 24 | final int indateValue = (0xff & indate[0]) << 24 |
// (0xff & indate[1]) << 16 | (0xff & indate[1]) << 16 |
// (0xff & indate[2]) << 8 | (0xff & indate[2]) << 8 |
// (0xFF & indate[3])); (0xFF & indate[3]);
// state.dateTime.value = DateTool().dateToYMDHNString("$indateValue"); AppLog.log('indate:$indate indateValue:$indateValue');
// break; state.dateTime.value = DateTool().dateToYMDHNString('$indateValue');
// case 0x06: break;
// // case 0x06:
// var privateKey = await Storage.getStringList(saveBluePrivateKey); //
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
// IoSenderManage.senderGetStarLockStatuInfo( final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
// lockID: BlueManage().connectDeviceName,
// userID: await Storage.getUid(), IoSenderManage.senderGetStarLockStatuInfo(
// isBeforeAddUser: false, lockID: BlueManage().connectDeviceName,
// privateKey: getPrivateKeyList, userID: await Storage.getUid(),
// ); utcTimeStamp: 0,
// break; unixTimeStamp: 0,
// default: isBeforeAddUser: false,
// // privateKey: getPrivateKeyList,
// break; );
// } break;
// } default:
//
break;
}
}
// //
Future<void> _replyTiming(Reply reply) async { Future<void> _replyTiming(Reply reply) async {
int status = reply.data[2]; final int status = reply.data[2];
switch(status){ switch(status){
case 0x00: case 0x00:
// //
String dataEime = DateTool().dateToYMDHNString("${getUTCNetTime()}"); final String dataEime = DateTool().dateToYMDHNString('${getLocalTime()}');
state.dateTime.value = dataEime; state.dateTime.value = dataEime;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
cancelBlueConnetctToastTimer(); cancelBlueConnetctToastTimer();
dismissEasyLoading(); dismissEasyLoading();
showToast("锁时间更新成功".tr); showToast('锁时间更新成功'.tr);
break; break;
case 0x06: case 0x06:
// //
@ -105,20 +112,19 @@ class LockTimeLogic extends BaseGetXController{
}); });
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async { BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
var token = await Storage.getStringList(saveBlueToken); final List<String>? token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = changeStringListToIntList(token!); final List<int> getTokenList = changeStringListToIntList(token!);
var signKey = await Storage.getStringList(saveBlueSignKey); final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
List<int> getSignKeyList = changeStringListToIntList(signKey!); final List<int> getSignKeyList = changeStringListToIntList(signKey!);
IoSenderManage.senderTimingCommand( IoSenderManage.senderTimingCommand(
lockID:BlueManage().connectDeviceName, lockID:BlueManage().connectDeviceName,
userID:await Storage.getUid(), userID:await Storage.getUid(),
// nowTime:DateTime.now().millisecondsSinceEpoch~/1000, nowTime: getLocalTime(),
nowTime: getUTCNetTime(),
token:getTokenList, token:getTokenList,
needAuthor:1, needAuthor:1,
signKey:getSignKeyList, signKey:getSignKeyList,
@ -135,37 +141,39 @@ class LockTimeLogic extends BaseGetXController{
}); });
} }
// //
// Future<void> getStarLockStatus() async { Future<void> getStarLockStatus() async {
// showEasyLoading(); showEasyLoading();
// showBlueConnetctToastTimer(action: () { showBlueConnetctToastTimer(action: () {
// dismissEasyLoading(); dismissEasyLoading();
// }); });
// BlueManage().bludSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName,
// (BluetoothConnectionState deviceConnectionState) async { (BluetoothConnectionState deviceConnectionState) async {
// if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
// dismissEasyLoading(); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
// var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
// List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
// IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
// lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
// userID: await Storage.getUid(), userID: await Storage.getUid(),
// isBeforeAddUser: false, utcTimeStamp: 0,
// privateKey: getPrivateKeyList, unixTimeStamp: 0,
// ); isBeforeAddUser: false,
// } else if (deviceConnectionState == BluetoothConnectionState.disconnected) { privateKey: getPrivateKeyList,
// dismissEasyLoading(); );
// cancelBlueConnetctToastTimer(); } else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
// if (state.ifCurrentScreen.value == true) { dismissEasyLoading();
// showBlueConnetctToast(); cancelBlueConnetctToastTimer();
// } if (state.ifCurrentScreen.value == true) {
// } showBlueConnetctToast();
// }); }
// } }
});
}
// //
void getLockTimeFromGateway() async{ Future<void> getLockTimeFromGateway() async{
var entity = await ApiRepository.to.getLockTimeFromGateway( final GetServerDatetimeEntity entity = await ApiRepository.to.getLockTimeFromGateway(
lockId: state.lockSetInfoData.value.lockId.toString(), lockId: state.lockSetInfoData.value.lockId.toString(),
); );
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
@ -174,41 +182,45 @@ class LockTimeLogic extends BaseGetXController{
} }
// //
void getServerDatetime() async{ Future<void> getServerDatetime() async{
var entity = await ApiRepository.to.getServerDatetimeData(); final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData();
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000; state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}"); // AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
getStarLockStatus();
} }
} }
int getUTCNetTime(){ int getLocalTime(){
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime; return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
} }
int getUTCTime(){
final DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000, isUtc: true);
final String appointmentDate = DateTool().getYMDHNDateStringWithDateTime(utcTime, 1);
final int utcTimeValue = DateTool().dateToTimestamp(appointmentDate, 1);
AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue');
return utcTimeValue ~/ 1000;
}
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
// getStarLockStatus();
// getLockTimeFromGateway(); // getLockTimeFromGateway();
getServerDatetime(); getServerDatetime();
} }
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
// _getLockStatus();
} }
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
super.onClose(); super.onClose();
_replySubscription.cancel(); _replySubscription.cancel();
} }

View File

@ -77,7 +77,6 @@ class _LockTimePageState extends State<LockTimePage> with RouteAware{
@override @override
void didChangeDependencies() { void didChangeDependencies() {
// TODO: implement didChangeDependencies
super.didChangeDependencies(); super.didChangeDependencies();
/// ///
@ -86,7 +85,6 @@ class _LockTimePageState extends State<LockTimePage> with RouteAware{
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();
@ -104,7 +102,9 @@ class _LockTimePageState extends State<LockTimePage> with RouteAware{
void didPop() { void didPop() {
super.didPop(); super.didPop();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
} }
@ -121,7 +121,9 @@ class _LockTimePageState extends State<LockTimePage> with RouteAware{
void didPushNext() { void didPushNext() {
super.didPushNext(); super.didPushNext();
logic.cancelBlueConnetctToastTimer(); logic.cancelBlueConnetctToastTimer();
if (EasyLoading.isShow) EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) {
EasyLoading.dismiss(animation: true);
}
state.ifCurrentScreen.value = false; state.ifCurrentScreen.value = false;
state.sureBtnState.value = 0; state.sureBtnState.value = 0;
} }

View File

@ -2,16 +2,16 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../lockSet/lockSetInfo_entity.dart'; import '../lockSet/lockSetInfo_entity.dart';
class LockTimeState{ class LockTimeState{// 0() 1()
var lockSetInfoData = LockSetInfoData().obs;
var dateTime = "".obs;
int differentialTime = 0;
var ifCurrentScreen = true.obs; // ,
var sureBtnState = 0.obs;// 0() 1()
LockTimeState() { LockTimeState() {
var map = Get.arguments; final map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"]; lockSetInfoData.value = map['lockSetInfoData'];
} }
Rx<LockSetInfoData> lockSetInfoData = LockSetInfoData().obs;
RxString dateTime = ''.obs;
int differentialTime = 0;
RxBool ifCurrentScreen = true.obs; // ,
RxInt sureBtnState = 0.obs;
} }

View File

@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_state.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/tools/showTFView.dart'; import 'package:star_lock/tools/showTFView.dart';
import 'package:star_lock/tools/showTipView.dart'; import 'package:star_lock/tools/showTipView.dart';
@ -24,10 +25,9 @@ class PasswordKeyDetailPage extends StatefulWidget {
State<PasswordKeyDetailPage> createState() => _PasswordKeyDetailPageState(); State<PasswordKeyDetailPage> createState() => _PasswordKeyDetailPageState();
} }
class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> with RouteAware {
with RouteAware { final PasswordKeyDetailLogic logic = Get.put(PasswordKeyDetailLogic());
final logic = Get.put(PasswordKeyDetailLogic()); final PasswordKeyDetailState state = Get.find<PasswordKeyDetailLogic>().state;
final state = Get.find<PasswordKeyDetailLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -37,22 +37,20 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
barTitle: TranslationLoader.lanKeys!.passwordDetail!.tr, barTitle: TranslationLoader.lanKeys!.passwordDetail!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: <Widget>[
IconButton( IconButton(
icon: Image.asset( icon: Image.asset(
'images/icon_bar_share.png', 'images/icon_bar_share.png',
height: 30.h, height: 30.h,
width: 30.w, width: 30.w,
), ),
onPressed: () { onPressed: _openModalBottomSheet,
_openModalBottomSheet();
},
), ),
], ],
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
children: [ children: <Widget>[
Obx(() => Visibility( Obx(() => Visibility(
visible: state.itemData.value.isCustom! == 1, visible: state.itemData.value.isCustom! == 1,
child: CommonItem( child: CommonItem(
@ -64,8 +62,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.password!.tr, leftTitel: TranslationLoader.lanKeys!.password!.tr,
rightTitle: state.keyboardPwd.value, rightTitle: state.keyboardPwd.value,
isHaveDirection: isHaveDirection: state.itemData.value.isCustom! == 1,
state.itemData.value.isCustom! == 1 ? true : false,
isHaveLine: true, isHaveLine: true,
action: () { action: () {
if (state.itemData.value.isCustom! != 1) { if (state.itemData.value.isCustom! != 1) {
@ -85,11 +82,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
context, state.inputNameController); context, state.inputNameController);
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: "有效期", leftTitel: '有效期',
rightTitle: logic.getUseDateStr(), rightTitle: logic.getUseDateStr(),
isHaveLine: state.isCirculation.value, isHaveLine: state.isCirculation.value,
isHaveDirection: isHaveDirection: state.itemData.value.isCustom! == 1,
state.itemData.value.isCustom! == 1 ? true : false,
allHeight: allHeight:
state.itemData.value.keyboardPwdType == 3 ? 90.h : 65.h, state.itemData.value.keyboardPwdType == 3 ? 90.h : 65.h,
action: () async { action: () async {
@ -98,14 +94,14 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
} }
var backData = await Get.toNamed( var backData = await Get.toNamed(
Routers.passwordKeyDetailChangeDatePage, Routers.passwordKeyDetailChangeDatePage,
arguments: { arguments: <String, PasswordKeyListItem>{
'itemData': state.itemData.value, 'itemData': state.itemData.value,
}); });
if (backData != null) { if (backData != null) {
state.itemData.value.startDate = state.itemData.value.startDate =
int.parse(backData["beginTimeTimestamp"]); int.parse(backData['beginTimeTimestamp']);
state.itemData.value.endDate = state.itemData.value.endDate =
int.parse(backData["endTimeTimestamp"]); int.parse(backData['endTimeTimestamp']);
// //
state.itemData.value.keyboardPwdType = 3; state.itemData.value.keyboardPwdType = 3;
setState(() {}); setState(() {});
@ -132,10 +128,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
Obx(() => Visibility( Obx(() => Visibility(
visible: state.itemData.value.isCustom! == 1, visible: state.itemData.value.isCustom! == 1,
child: Column( child: Column(
children: [ children: <Widget>[
CommonItem( CommonItem(
leftTitel: "是否为管理员".tr, leftTitel: '是否为管理员'.tr,
rightTitle: "", rightTitle: '',
isTipsImg: false, isTipsImg: false,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: SizedBox( rightWidget: SizedBox(
@ -146,10 +142,10 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
)), )),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr, leftTitel: TranslationLoader.lanKeys!.operatingRecord!.tr,
rightTitle: "", rightTitle: '',
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.lockOperatingRecordPage, arguments: { Get.toNamed(Routers.lockOperatingRecordPage, arguments: <String, Object?>{
'type': 1, 'type': 1,
'id': state.itemData.value.keyboardPwdId.toString(), 'id': state.itemData.value.keyboardPwdId.toString(),
'recordName': state.itemData.value.keyboardPwdName 'recordName': state.itemData.value.keyboardPwdName
@ -169,8 +165,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
side: BorderSide(width: 1, color: AppColors.mainColor)), side: BorderSide(width: 1, color: AppColors.mainColor)),
onPressed: () { onPressed: () {
Navigator.pushNamed(context, Routers.cardListPage, Navigator.pushNamed(context, Routers.cardListPage,
arguments: { arguments: <String, int?>{
"lockId": state.itemData.value.lockId, 'lockId': state.itemData.value.lockId,
}); });
}, },
child: Text( child: Text(
@ -191,8 +187,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
side: BorderSide(width: 1, color: AppColors.mainColor)), side: BorderSide(width: 1, color: AppColors.mainColor)),
onPressed: () { onPressed: () {
Navigator.pushNamed(context, Routers.fingerprintListPage, Navigator.pushNamed(context, Routers.fingerprintListPage,
arguments: { arguments: <String, int?>{
"lockId": state.itemData.value.lockId, 'lockId': state.itemData.value.lockId,
}); });
}, },
child: Text( child: Text(
@ -214,8 +210,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
onPressed: () { onPressed: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.remoteControlListPage, context, Routers.remoteControlListPage,
arguments: { arguments: <String, int?>{
"lockId": state.itemData.value.lockId, 'lockId': state.itemData.value.lockId,
}); });
}, },
child: Text( child: Text(
@ -235,7 +231,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
left: 30.w, right: 30.w, top: 30.w, bottom: 30.w), left: 30.w, right: 30.w, top: 30.w, bottom: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w), padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () { onClick: () {
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () { ShowTipView().showIosTipWithContentDialog('确定要删除吗?'.tr, () {
state.isDeletPasswordKey.value = true; state.isDeletPasswordKey.value = true;
logic.senderCustomPasswords(); logic.senderCustomPasswords();
}); });
@ -247,15 +243,15 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
Widget bottomTip(){ Widget bottomTip(){
return Column( return Column(
children: [ children: <Widget>[
Container( Container(
padding: EdgeInsets.all(20.w), padding: EdgeInsets.all(20.w),
child: Row( child: Row(
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: <Widget>[
Expanded( Expanded(
child: Text( child: Text(
"密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。".tr, '密码生成后请在当日2359前使用一次进行激活否则过0点后未激活则失效。'.tr,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: TextStyle(fontSize: 20.sp), style: TextStyle(fontSize: 20.sp),
)), )),
@ -273,7 +269,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
thumbColor: CupertinoColors.white, thumbColor: CupertinoColors.white,
value: state.isAdministrator.value, value: state.isAdministrator.value,
onChanged: (value) { onChanged: (bool value) {
// state.isAdministrator.value = value; // state.isAdministrator.value = value;
// state.isDeletPasswordKey.value = false; // state.isDeletPasswordKey.value = false;
// logic.senderCustomPasswords(); // logic.senderCustomPasswords();
@ -297,11 +293,11 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
state.ifCurrentScreen.value = true; state.ifCurrentScreen.value = true;
return ShowTFView( return ShowTFView(
title: inputController == state.inputNameController title: inputController == state.inputNameController
? "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}" ? '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.name!.tr}'
: "${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}", : '${TranslationLoader.lanKeys!.amend!.tr}${TranslationLoader.lanKeys!.password!.tr}',
tipTitle: inputController.text.isNotEmpty tipTitle: inputController.text.isNotEmpty
? inputController.text ? inputController.text
: "请输入6-9位密码", : '请输入6-9位密码',
controller: inputController, controller: inputController,
keyboardType: inputController == state.inputNameController keyboardType: inputController == state.inputNameController
? TextInputType.text ? TextInputType.text
@ -317,7 +313,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
if (inputController.text.isEmpty || if (inputController.text.isEmpty ||
inputController.text.length < 6 || inputController.text.length < 6 ||
inputController.text.length > 9) { inputController.text.length > 9) {
logic.showToast("请输入6-9位密码"); logic.showToast('请输入6-9位密码');
return; return;
} }
} }
@ -346,7 +342,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
constraints: BoxConstraints(maxHeight: 270.h), constraints: BoxConstraints(maxHeight: 270.h),
builder: (BuildContext context) { builder: (BuildContext context) {
return Column( return Column(
children: [ children: <Widget>[
SizedBox( SizedBox(
width: ScreenUtil().screenWidth, width: ScreenUtil().screenWidth,
height: 180.h, height: 180.h,
@ -377,7 +373,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
} }
List<Widget> initBottomSheetList() { List<Widget> initBottomSheetList() {
List<Widget> widgetList = []; List<Widget> widgetList = <Widget>[];
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0)); widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1)); widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
@ -397,7 +393,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w), EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
Image.asset( Image.asset(
imageName, imageName,
width: 50.w, width: 50.w,

View File

@ -0,0 +1,31 @@
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
class PasswordKeyEntity {
int? errorCode;
String? description;
String? errorMsg;
PasswordKeyListItem? data;
PasswordKeyEntity(
{this.errorCode, this.description, this.errorMsg, this.data});
PasswordKeyEntity.fromJson(Map<String, dynamic> json) {
errorCode = json['errorCode'];
description = json['description'];
errorMsg = json['errorMsg'];
data = json['data'] != null
? PasswordKeyListItem.fromJson(json['data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['errorCode'] = errorCode;
data['description'] = description;
data['errorMsg'] = errorMsg;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_state.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
@ -391,6 +392,19 @@ class PasswordKeyListLogic extends BaseGetXController {
return useDateStr; return useDateStr;
} }
//
Future<void> refreshIndividualKeys(
{required int lockId, required int keyboardPwdId}) async {
final PasswordKeyEntity entity =
await ApiRepository.to.passwordKey(lockId, keyboardPwdId);
if (entity.errorCode!.codeIsSuccessful) {
final int index = state.itemDataList
.indexWhere((PasswordKeyListItem item) => item.keyboardPwdId == keyboardPwdId);
state.itemDataList.removeAt(index);
state.itemDataList.insert(index, entity.data!);
}
}
/// ///
StreamSubscription? _getPasswordListRefreshUIEvent; StreamSubscription? _getPasswordListRefreshUIEvent;
void _getPasswordListRefreshUIAction() { void _getPasswordListRefreshUIAction() {

View File

@ -165,7 +165,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage>
Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: <String, PasswordKeyListItem>{'itemData': passwordKeyListItem}) Navigator.pushNamed(context, Routers.passwordKeyDetailPage, arguments: <String, PasswordKeyListItem>{'itemData': passwordKeyListItem})
.then((Object? val) { .then((Object? val) {
if (val != null) { if (val != null) {
getHttpData(isRefresh: true); // getHttpData(isRefresh: true);
} }
}); });
}), }),

View File

@ -1,8 +1,10 @@
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
class PasswordKeyEntity { class PasswordKeyEntity {
int? errorCode; int? errorCode;
String? description; String? description;
String? errorMsg; String? errorMsg;
PasswordKeyData? data; PasswordKeyListItem? data;
PasswordKeyEntity( PasswordKeyEntity(
{this.errorCode, this.description, this.errorMsg, this.data}); {this.errorCode, this.description, this.errorMsg, this.data});
@ -11,7 +13,7 @@ class PasswordKeyEntity {
errorCode = json['errorCode']; errorCode = json['errorCode'];
description = json['description']; description = json['description'];
errorMsg = json['errorMsg']; errorMsg = json['errorMsg'];
data = json['data'] != null ? PasswordKeyData.fromJson(json['data']) : null; data = json['data'] != null ? PasswordKeyListItem.fromJson(json['data']) : null;
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -25,22 +27,3 @@ class PasswordKeyEntity {
return data; return data;
} }
} }
class PasswordKeyData {
String? keyboardPwd;
int? keyboardPwdId;
PasswordKeyData({this.keyboardPwd, this.keyboardPwdId});
PasswordKeyData.fromJson(Map<String, dynamic> json) {
keyboardPwd = json['keyboardPwd'];
keyboardPwdId = json['keyboardPwdId'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['keyboardPwd'] = keyboardPwd;
data['keyboardPwdId'] = keyboardPwdId;
return data;
}
}

View File

@ -215,8 +215,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
senderCustomPasswords(); senderCustomPasswords();
} else {
showToast('${entity.errorMsg}');
} }
} }
@ -438,7 +436,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
case 3: case 3:
// //
if (state.isPermanent.value == false) { if (state.isPermanent.value == false) {
'类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}'; useDateStr = '类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
} else { } else {
useDateStr = '类型:自定义-永久'; useDateStr = '类型:自定义-永久';
} }
@ -466,7 +464,6 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
_initReplySubscription(); _initReplySubscription();
@ -475,13 +472,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
} }
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
_replySubscription.cancel(); _replySubscription.cancel();
} }
} }

View File

@ -223,8 +223,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
return Column( return Column(
children: <Widget>[ children: <Widget>[
Visibility( Visibility(
visible: visible: CommonDataManage().currentKeyInfo.vendor == 'XHJ',
CommonDataManage().currentKeyInfo.vendor == 'XHJ' ? false : true,
child: CommonItem( child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr, leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.beginTime.value, rightTitle: state.beginTime.value,
@ -333,7 +332,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
Widget keyIfAdministratorWidget() { Widget keyIfAdministratorWidget() {
return Visibility( return Visibility(
visible: visible:
CommonDataManage().currentKeyInfo.isLockOwner == 1 ? true : false, CommonDataManage().currentKeyInfo.isLockOwner == 1,
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
// SizedBox(height: 10.h), // SizedBox(height: 10.h),
@ -375,14 +374,12 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
showPickerView(context, pickerDataList); showPickerView(context, pickerDataList);
}), }),
Visibility( Visibility(
visible: (CommonDataManage().currentKeyInfo.vendor == visible: CommonDataManage().currentKeyInfo.vendor ==
IoModelVendor.vendor_XL && IoModelVendor.vendor_XL &&
(CommonDataManage().currentKeyInfo.model == (CommonDataManage().currentKeyInfo.model ==
IoModelVendor.model_XL_BLE || IoModelVendor.model_XL_BLE ||
CommonDataManage().currentKeyInfo.model == CommonDataManage().currentKeyInfo.model ==
IoModelVendor.model_XL_WIFI)) IoModelVendor.model_XL_WIFI),
? true
: false,
child: CommonItem( child: CommonItem(
leftTitel: '结束日期', leftTitel: '结束日期',
rightTitle: state.endTime.value, rightTitle: state.endTime.value,
@ -411,7 +408,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
state.loopEffectiveDate.value = state.loopEffectiveDate.value =
DateTool().getYMDHNDateString(p, 5); DateTool().getYMDHNDateString(p, 5);
state.loopStartHours.value = p.hour!; state.loopStartHours.value = p.hour!;
}); }, hourShow24: true);
}), }),
CommonItem( CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr, leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
@ -425,7 +422,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
state.loopFailureDate.value = state.loopFailureDate.value =
DateTool().getYMDHNDateString(p, 5); DateTool().getYMDHNDateString(p, 5);
state.loopEndHours.value = p.hour!; state.loopEndHours.value = p.hour!;
}); }, hourShow24: true);
}), }),
], ],
); );
@ -620,7 +617,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
); );
} }
_switch() { CupertinoSwitch _switch() {
return CupertinoSwitch( return CupertinoSwitch(
activeColor: CupertinoColors.activeBlue, activeColor: CupertinoColors.activeBlue,
trackColor: CupertinoColors.systemGrey5, trackColor: CupertinoColors.systemGrey5,
@ -694,7 +691,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
onTap: (int index) { onTap: (int index) {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
}, },
tabs: _itemTabs.map((ItemView item) => _tab(item)).toList(), tabs: _itemTabs.map(_tab).toList(),
isScrollable: true, isScrollable: true,
indicatorColor: Colors.red, indicatorColor: Colors.red,
unselectedLabelColor: Colors.black, unselectedLabelColor: Colors.black,
@ -718,14 +715,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
Tab _tab(ItemView item) { Tab _tab(ItemView item) {
return Tab( return Tab(
// text: item.title, // text: item.title,
child: Container( child: Text(
// width: item.title.length > 2 ? 1.sw / 8 : 1.sw / 12, item.title,
// margin: EdgeInsets.all(10.w), textAlign: TextAlign.center,
// color: Colors.red,
child: Text(
item.title,
textAlign: TextAlign.center,
),
), ),
); );
} }
@ -735,7 +727,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
child: TabBarView( child: TabBarView(
controller: state.tabController, controller: state.tabController,
children: _itemTabs children: _itemTabs
.map((ItemView item) => Obx(() => indexChangeWidget())) .map((ItemView item) => Obx(indexChangeWidget))
.toList(), .toList(),
), ),
); );
@ -827,7 +819,6 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage>
@override @override
void dispose() { void dispose() {
// TODO: implement dispose
/// ///
AppRouteObserver().routeObserver.unsubscribe(this); AppRouteObserver().routeObserver.unsubscribe(this);
super.dispose(); super.dispose();

View File

@ -97,6 +97,14 @@ class GroupList {
} }
return data; return data;
} }
GroupList copy(){
return GroupList(
groupName: groupName,
groupId: groupId,
lockList: lockList?.map((e) => e.copy()).toList(),
);
}
} }
class LockListInfoItemEntity { class LockListInfoItemEntity {
@ -268,6 +276,10 @@ class LockListInfoItemEntity {
bool isLockOwnerBool() { bool isLockOwnerBool() {
return isLockOwner == 1; return isLockOwner == 1;
} }
LockListInfoItemEntity copy(){
return LockListInfoItemEntity.fromJson(toJson());
}
} }
class Bluetooth { class Bluetooth {

View File

@ -23,20 +23,30 @@ import '../entity/lockListInfo_entity.dart';
import 'lockList_state.dart'; import 'lockList_state.dart';
class LockListLogic extends BaseGetXController { class LockListLogic extends BaseGetXController {
LockListLogic(this.entity){ LockListLogic(this.entity) {}
}
LockListState state = LockListState(); LockListState state = LockListState();
List<GroupList> groupDataList = <GroupList>[]; List<GroupList> _groupDataList = <GroupList>[];
LockListInfoGroupEntity? entity; LockListInfoGroupEntity? entity;
List<GroupList> get groupDataList {
final List<GroupList> list = _groupDataList.map((e)=>e.copy()).toList();
if (state.searchStr.value != '' && state.showSearch.value) {
list.forEach((GroupList element) {
element.lockList?.removeWhere((LockListInfoItemEntity element) =>
!(element.lockAlias?.contains(state.searchStr.value) ?? true));
});
}
return list;
}
// //
void setLockListInfoGroupEntity(LockListInfoGroupEntity entity) { void setLockListInfoGroupEntity(LockListInfoGroupEntity entity) {
this.entity = entity; this.entity = entity;
if (entity.pageNo == 1) { if (entity.pageNo == 1) {
groupDataList = <GroupList>[]; _groupDataList = <GroupList>[];
} }
groupDataList.addAll(entity.groupList!); _groupDataList.addAll(entity.groupList!);
update(); update();
} }

View File

@ -6,10 +6,12 @@ import '../entity/lockListInfo_entity.dart';
class LockListState{ class LockListState{
var itemStatusIsEable = false.obs; // item是否能点击 RxBool itemStatusIsEable = false.obs; // item是否能点击
LockListInfoItemEntity lockListInfoItemEntity = LockListInfoItemEntity(); // item LockListInfoItemEntity lockListInfoItemEntity = LockListInfoItemEntity(); // item
var passwordTF = TextEditingController(); TextEditingController passwordTF = TextEditingController();
var deleteAdministratorIsHaveAllData = false.obs; // RxBool deleteAdministratorIsHaveAllData = false.obs; //
var ifCurrentScreen = true.obs; // , RxBool ifCurrentScreen = true.obs; // ,
RxBool showSearch = false.obs; // ,
RxString searchStr = ''.obs; // ,
} }

View File

@ -43,16 +43,75 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
children: <Widget>[ children: <Widget>[
Align( Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: IconButton( child: Row(
onPressed: () { mainAxisSize: MainAxisSize.min,
Get.toNamed(Routers.selectLockTypePage); children: <Widget>[
}, IconButton(
icon: Icon( onPressed: () {
Icons.add_circle, state.showSearch.value = !state.showSearch.value;
size: 48.w, },
color: AppColors.mainColor, icon: Icon(
)), Icons.search,
size: 32.w,
color: AppColors.blackColor,
)),
IconButton(
onPressed: () {
Get.toNamed(Routers.selectLockTypePage);
},
icon: Icon(
Icons.add_circle,
size: 48.w,
color: AppColors.mainColor,
)),
],
),
), ),
//
Obx(() {
return state.showSearch.value
? Container(
height: 50.w,
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.8),
borderRadius: BorderRadius.circular(40.w),
),
margin: EdgeInsets.only(
left: 25.w, right: 25.w, bottom: 20.h),
child: Stack(
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 14.h, left: 20.w),
child: Icon(
Icons.search,
size: 28.w,
color: AppColors.blackColor,
),
),
TextField(
decoration: InputDecoration(
hintText: '搜索'.tr,
hintStyle: TextStyle(
fontSize: 24.sp,
color: AppColors.blackColor,
),
border: InputBorder.none,
contentPadding: EdgeInsets.only(
top: 6.h,
left: 50.w,
),
isCollapsed: true,
),
onChanged: (String value) {
state.searchStr.value = value;
},
autofocus: true,
),
],
),
)
: const SizedBox.shrink();
}),
Padding( Padding(
padding: EdgeInsets.only(left: 45.w), padding: EdgeInsets.only(left: 45.w),
child: Text( child: Text(
@ -65,15 +124,17 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
), ),
Expanded( Expanded(
child: ListView.builder( child: Obx(() {
itemCount: logic.groupDataList.length, return ListView.builder(
itemBuilder: (BuildContext context, int index) { itemCount: logic.groupDataList.length,
final GroupList itemData = logic.groupDataList[index]; itemBuilder: (BuildContext context, int index) {
return _buildLockExpandedList(context, index, itemData); final GroupList itemData = logic.groupDataList[index];
}, return _buildLockExpandedList(context, index, itemData);
shrinkWrap: true, },
physics: const AlwaysScrollableScrollPhysics(), shrinkWrap: true,
), physics: const AlwaysScrollableScrollPhysics(),
);
}),
), ),
], ],
), ),
@ -169,6 +230,25 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
Widget _xhjLockInfoListItem( Widget _xhjLockInfoListItem(
LockListInfoItemEntity keyInfo, bool isLast, Function() action) { LockListInfoItemEntity keyInfo, bool isLast, Function() action) {
String lockAlias = keyInfo.lockAlias!;
final TextStyle lockAliasTextStyle = TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.w500,
color: keyInfo.passageMode == 1
? AppColors.openPassageModeColor
: AppColors.darkGrayTextColor,
overflow: TextOverflow.ellipsis,
);
final TextPainter textPainter = TextPainter(
text: TextSpan(text: lockAlias, style: lockAliasTextStyle),
maxLines: 1,
textDirection: TextDirection.ltr)
..layout(minWidth: 0, maxWidth: double.infinity);
final double textSizeWidth = textPainter.size.width; //
if (textSizeWidth > Get.width * .6) {
lockAlias = '${lockAlias.substring(0, 14)}...';
}
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
@ -204,16 +284,7 @@ class _LockListXHJPageState extends State<LockListXHJPage> with RouteAware {
), ),
FittedBox( FittedBox(
fit: BoxFit.scaleDown, fit: BoxFit.scaleDown,
child: Text(keyInfo.lockAlias!, child: Text(lockAlias, style: lockAliasTextStyle, maxLines: 1),
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.w500,
color: keyInfo.passageMode == 1
? AppColors.openPassageModeColor
: AppColors.darkGrayTextColor,
overflow: TextOverflow.ellipsis,
),
maxLines: 1),
), ),
Visibility( Visibility(
visible: keyInfo.passageMode == 1, visible: keyInfo.passageMode == 1,

View File

@ -94,7 +94,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
leftWidget: Builder( leftWidget: Builder(
builder: (context) => IconButton( builder: (context) => IconButton(
icon: Image.asset( icon: Image.asset(
"images/main/mainLeft_menu_icon.png", 'images/main/mainLeft_menu_icon.png',
color: Colors.white, color: Colors.white,
width: 44.w, width: 44.w,
height: 44.w, height: 44.w,
@ -124,6 +124,23 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
// decoration: BoxDecoration(
// //
// gradient: LinearGradient(
// //
// colors: [
// AppColors.mainColor.withOpacity(0.8), //
// AppColors.mainColor.withOpacity(0.4), //
// Colors.white, //
// Colors.white, //
// ],
// //
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// //
// stops: [0.0, 0.23, 0.47, 1],
// ),
// ),
child: child, child: child,
)); ));
return child; return child;
@ -215,14 +232,15 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
SizedBox( SizedBox(
height: 160.h, height: 160.h,
), ),
F.isLite if (F.isLite)
? Container() Container()
: SubmitBtn( else
btnName: '演示模式', SubmitBtn(
onClick: () { btnName: '演示模式',
Get.toNamed(Routers.demoModeLockDetailPage); onClick: () {
}, Get.toNamed(Routers.demoModeLockDetailPage);
) },
)
], ],
), ),
], ],

View File

@ -13,6 +13,7 @@ import 'package:star_lock/blue/io_protocol/io_getPrivateKey.dart';
import 'package:star_lock/blue/io_protocol/io_getPublicKey.dart'; import 'package:star_lock/blue/io_protocol/io_getPublicKey.dart';
import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart'; import 'package:star_lock/blue/io_protocol/io_otaUpgrade.dart';
import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart'; import 'package:star_lock/blue/io_protocol/io_processOtaUpgrade.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
import 'package:star_lock/mine/addLock/nearbyLock/nearbyLock_page.dart'; import 'package:star_lock/mine/addLock/nearbyLock/nearbyLock_page.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/widget/permission/permission_dialog.dart'; import 'package:star_lock/widget/permission/permission_dialog.dart';
@ -26,6 +27,7 @@ import '../../../blue/io_tool/io_tool.dart';
import '../../../blue/io_tool/manager_event_bus.dart'; import '../../../blue/io_tool/manager_event_bus.dart';
import '../../../blue/sender_manage.dart'; import '../../../blue/sender_manage.dart';
import '../../../network/api_repository.dart'; import '../../../network/api_repository.dart';
import '../../../tools/dateTool.dart';
import '../../../tools/storage.dart'; import '../../../tools/storage.dart';
import 'nearbyLock_state.dart'; import 'nearbyLock_state.dart';
@ -68,7 +70,7 @@ class NearbyLockLogic extends BaseGetXController {
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) { EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
if (reply is GetPublicKeyReply) { if (reply is GetPublicKeyReply) {
_replyGetPublicKey(reply); _replyGetPublicKey(reply);
} }
@ -110,8 +112,8 @@ class NearbyLockLogic extends BaseGetXController {
// //
AppLog.log('获取公钥成功'); AppLog.log('获取公钥成功');
// //
var publicKey = reply.data.sublist(3); final List<int> publicKey = reply.data.sublist(3);
var saveStrList = changeIntListToStringList(publicKey); final List<String> saveStrList = changeIntListToStringList(publicKey);
Storage.setStringList(saveBluePublicKey, saveStrList); Storage.setStringList(saveBluePublicKey, saveStrList);
// //
@ -140,22 +142,21 @@ class NearbyLockLogic extends BaseGetXController {
reply.data.removeAt(0); reply.data.removeAt(0);
// //
List<int> privateKey = reply.data.sublist(0, 16); final List<int> privateKey = reply.data.sublist(0, 16);
var savePrivateKeyList = changeIntListToStringList(privateKey); final List<String> savePrivateKeyList = changeIntListToStringList(privateKey);
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
// signKey // signKey
List<int> signKey = reply.data.sublist(16, 32); final List<int> signKey = reply.data.sublist(16, 32);
var saveSignKeyList = changeIntListToStringList(signKey); final List<String> saveSignKeyList = changeIntListToStringList(signKey);
Storage.setStringList(saveBlueSignKey, saveSignKeyList); Storage.setStringList(saveBlueSignKey, saveSignKeyList);
// //
List<int> timestamp = reply.data.sublist(32, 36); final List<int> timestamp = reply.data.sublist(32, 36);
state.timestampValue = ((0xff & timestamp[(0)]) << 24 | state.timestampValue = (0xff & timestamp[0]) << 24 |
(0xff & timestamp[1]) << 16 | (0xff & timestamp[1]) << 16 |
(0xff & timestamp[2]) << 8 | (0xff & timestamp[2]) << 8 |
(0xFF & timestamp[3])); (0xFF & timestamp[3]);
showTitleEasyLoading('获取锁信息 3/3'); showTitleEasyLoading('获取锁信息 3/3');
_getStarLockStatus(); _getStarLockStatus();
break; break;
@ -167,138 +168,138 @@ class NearbyLockLogic extends BaseGetXController {
// //
Future<void> _replyGetStarLockStatusInfo(Reply reply) async { Future<void> _replyGetStarLockStatusInfo(Reply reply) async {
int status = reply.data[2]; final int status = reply.data[2];
switch (status) { switch (status) {
case 0x00: case 0x00:
// //
AppLog.log('获取锁状态成功'); AppLog.log('获取锁状态成功');
// //
var index = 3; int index = 3;
var vendor = reply.data.sublist(index, index + 20); final List<int> vendor = reply.data.sublist(index, index + 20);
var vendorStr = utf8String(vendor); final String vendorStr = utf8String(vendor);
state.lockInfo['vendor'] = vendorStr; state.lockInfo['vendor'] = vendorStr;
// state.lockInfo["vendor"] = "XL"; // state.lockInfo["vendor"] = "XL";
index = index + 20; index = index + 20;
AppLog.log('厂商名称 vendorStr:$vendorStr'); AppLog.log('厂商名称 vendorStr:$vendorStr');
// //
var product = reply.data[index]; final int product = reply.data[index];
state.lockInfo['product'] = product; state.lockInfo['product'] = product;
index = index + 1; index = index + 1;
AppLog.log('锁设备类型 product:$product'); AppLog.log('锁设备类型 product:$product');
// //
var model = reply.data.sublist(index, index + 20); final List<int> model = reply.data.sublist(index, index + 20);
var modelStr = utf8String(model); final String modelStr = utf8String(model);
state.lockInfo['model'] = modelStr; state.lockInfo['model'] = modelStr;
// state.lockInfo["model"] = "JL-BLE-01"; // state.lockInfo["model"] = "JL-BLE-01";
index = index + 20; index = index + 20;
AppLog.log('产品名称 mmodelStr:$modelStr'); AppLog.log('产品名称 mmodelStr:$modelStr');
// //
var fwVersion = reply.data.sublist(index, index+20); final List<int> fwVersion = reply.data.sublist(index, index+20);
var fwVersionStr = utf8String(fwVersion); final String fwVersionStr = utf8String(fwVersion);
state.lockInfo['fwVersion'] = fwVersionStr; state.lockInfo['fwVersion'] = fwVersionStr;
index = index + 20; index = index + 20;
AppLog.log('软件版本 fwVersionStr:$fwVersionStr'); AppLog.log('软件版本 fwVersionStr:$fwVersionStr');
// //
var hwVersion = reply.data.sublist(index, index+20); final List<int> hwVersion = reply.data.sublist(index, index+20);
var hwVersionStr = utf8String(hwVersion); final String hwVersionStr = utf8String(hwVersion);
state.lockInfo['hwVersion'] = hwVersionStr; state.lockInfo['hwVersion'] = hwVersionStr;
index = index + 20; index = index + 20;
AppLog.log('硬件版本 hwVersionStr:$hwVersionStr'); AppLog.log('硬件版本 hwVersionStr:$hwVersionStr');
// //
var serialNum0 = reply.data.sublist(index, index + 16); final List<int> serialNum0 = reply.data.sublist(index, index + 16);
var serialNum0Str = utf8String(serialNum0); final String serialNum0Str = utf8String(serialNum0);
state.lockInfo['serialNum0'] = serialNum0Str; state.lockInfo['serialNum0'] = serialNum0Str;
// state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}"; // state.lockInfo["serialNum0"] = "${DateTime.now().millisecondsSinceEpoch ~/ 10}";
index = index + 16; index = index + 16;
AppLog.log('厂商序列号 serialNum0Str:${serialNum0Str.length}'); AppLog.log('厂商序列号 serialNum0Str:${serialNum0Str.length}');
// //
var serialNum1 = reply.data.sublist(index, index + 16); final List<int> serialNum1 = reply.data.sublist(index, index + 16);
var serialNum1Str = utf8String(serialNum1); final String serialNum1Str = utf8String(serialNum1);
state.lockInfo['serialNum1'] = serialNum1Str; state.lockInfo['serialNum1'] = serialNum1Str;
index = index + 16; index = index + 16;
AppLog.log('成品商序列号 serialNum1Str:$serialNum1Str'); AppLog.log('成品商序列号 serialNum1Str:$serialNum1Str');
// //
var btDeviceName = reply.data.sublist(index, index + 16); final List<int> btDeviceName = reply.data.sublist(index, index + 16);
var btDeviceNameStr = utf8String(btDeviceName); final String btDeviceNameStr = utf8String(btDeviceName);
state.lockInfo['btDeviceName'] = btDeviceNameStr; state.lockInfo['btDeviceName'] = btDeviceNameStr;
index = index + 16; index = index + 16;
AppLog.log('蓝牙名称 btDeviceNameStr:$btDeviceNameStr'); AppLog.log('蓝牙名称 btDeviceNameStr:$btDeviceNameStr');
// //
var battRemCap = reply.data[index]; final int battRemCap = reply.data[index];
state.lockInfo['electricQuantity'] = battRemCap; state.lockInfo['electricQuantity'] = battRemCap;
index = index + 1; index = index + 1;
AppLog.log('电池剩余电量 battRemCap:$battRemCap'); AppLog.log('电池剩余电量 battRemCap:$battRemCap');
// //
var battRemCapStandby = reply.data[index]; final int battRemCapStandby = reply.data[index];
state.lockInfo['electricQuantityStandby'] = battRemCapStandby; state.lockInfo['electricQuantityStandby'] = battRemCapStandby;
index = index + 1; index = index + 1;
AppLog.log('电池剩余电量 battRemCap:$battRemCap'); AppLog.log('电池剩余电量 battRemCap:$battRemCap');
// //
var restoreCounter = reply.data.sublist(index, index + 2); final List<int> restoreCounter = reply.data.sublist(index, index + 2);
state.lockInfo['restoreCount'] = restoreCounter[0] * 256 + restoreCounter[1]; state.lockInfo['restoreCount'] = restoreCounter[0] * 256 + restoreCounter[1];
index = index + 2; index = index + 2;
AppLog.log('重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}'); AppLog.log('重置次数 restoreCounter:${restoreCounter[0] * 256 + restoreCounter[1]}');
// //
var restoreDate = reply.data.sublist(index, index + 4); final List<int> restoreDate = reply.data.sublist(index, index + 4);
int restoreDateValue = ((0xff & restoreDate[(0)]) << 24 | final int restoreDateValue = (0xff & restoreDate[0]) << 24 |
(0xff & restoreDate[1]) << 16 | (0xff & restoreDate[1]) << 16 |
(0xff & restoreDate[2]) << 8 | (0xff & restoreDate[2]) << 8 |
(0xFF & restoreDate[3])); (0xFF & restoreDate[3]);
// String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString()); // String restoreDateStr = DateTool().dateToYMDHNSString(restoreDateValue.toString());
state.lockInfo['restoreDate'] = restoreDateValue * 1000; state.lockInfo['restoreDate'] = restoreDateValue * 1000;
index = index + 4; index = index + 4;
AppLog.log('重置时间 restoreDateValue:$restoreDateValue'); AppLog.log('重置时间 restoreDateValue:$restoreDateValue');
// //
var icPartNo = reply.data.sublist(index, index + 10); final List<int> icPartNo = reply.data.sublist(index, index + 10);
var icPartNoStr = utf8String(icPartNo); final String icPartNoStr = utf8String(icPartNo);
state.lockInfo['icPartNo'] = icPartNoStr; state.lockInfo['icPartNo'] = icPartNoStr;
index = index + 10; index = index + 10;
AppLog.log('主控芯片型号 icPartNoStr:$icPartNoStr'); AppLog.log('主控芯片型号 icPartNoStr:$icPartNoStr');
// //
var indate = reply.data.sublist(index, index + 4); final List<int> indate = reply.data.sublist(index, index + 4);
int indateValue = ((0xff & indate[(0)]) << 24 | final int indateValue = (0xff & indate[0]) << 24 |
(0xff & indate[1]) << 16 | (0xff & indate[1]) << 16 |
(0xff & indate[2]) << 8 | (0xff & indate[2]) << 8 |
(0xFF & indate[3])); (0xFF & indate[3]);
// String indateStr = DateTool().dateToYMDHNSString("$indateValue"); // String indateStr = DateTool().dateToYMDHNSString("$indateValue");
state.lockInfo['indate'] = indateValue * 1000; state.lockInfo['indate'] = indateValue * 1000;
index = index + 4; index = index + 4;
AppLog.log('有效时间 indateValue:$indateValue'); AppLog.log('有效时间 indateValue:$indateValue');
// mac地址 // mac地址
var macAddress = reply.data.sublist(index, index + 20); final List<int> macAddress = reply.data.sublist(index, index + 20);
var macAddressStr = utf8String(macAddress); final String macAddressStr = utf8String(macAddress);
state.lockInfo['mac'] = macAddressStr; state.lockInfo['mac'] = macAddressStr;
index = index + 20; index = index + 20;
AppLog.log('mac地址 macAddressStr:$macAddressStr'); AppLog.log('mac地址 macAddressStr:$macAddressStr');
// //
var featureValueLength = reply.data[index]; final int featureValueLength = reply.data[index];
index = index + 1; index = index + 1;
AppLog.log('锁特征值字符串长度 featureValueLength:$featureValueLength'); AppLog.log('锁特征值字符串长度 featureValueLength:$featureValueLength');
// () // ()
// //
var featureNetxLength = index + featureValueLength; final int featureNetxLength = index + featureValueLength;
if (reply.data.length < featureNetxLength) { if (reply.data.length < featureNetxLength) {
showToast('锁数据异常,请重试'); showToast('锁数据异常,请重试');
return; return;
} }
var featureValue = reply.data.sublist(index, index + featureValueLength); final List<int> featureValue = reply.data.sublist(index, index + featureValueLength);
String featureValueStr = asciiString(featureValue); final String featureValueStr = asciiString(featureValue);
state.featureValue = featureValueStr; state.featureValue = featureValueStr;
// List allFeatureValueTwoList = charListChangeIntList(featureValue); // List allFeatureValueTwoList = charListChangeIntList(featureValue);
// AppLog.log("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr"); // AppLog.log("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr");
@ -306,18 +307,18 @@ class NearbyLockLogic extends BaseGetXController {
AppLog.log('锁特征值字符串 featureValueStr:$featureValueStr'); AppLog.log('锁特征值字符串 featureValueStr:$featureValueStr');
// 使 // 使
var featureEnValLength = reply.data[index]; final int featureEnValLength = reply.data[index];
index = index + 1; index = index + 1;
AppLog.log('使能特征值字符串长度 featureEnValLength:$featureEnValLength'); AppLog.log('使能特征值字符串长度 featureEnValLength:$featureEnValLength');
// 使() // 使()
var featureEnNextLength = index + featureEnValLength; final int featureEnNextLength = index + featureEnValLength;
if (reply.data.length < featureEnNextLength) { if (reply.data.length < featureEnNextLength) {
showToast('锁数据异常,请重试'); showToast('锁数据异常,请重试');
return; return;
} }
var featureEnVal = reply.data.sublist(index, index + featureEnValLength); final List<int> featureEnVal = reply.data.sublist(index, index + featureEnValLength);
String featureEnValStr = asciiString(featureEnVal); final String featureEnValStr = asciiString(featureEnVal);
state.featureSettingValue = featureEnValStr; state.featureSettingValue = featureEnValStr;
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal); // List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
// AppLog.log("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr"); // AppLog.log("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr");
@ -327,11 +328,11 @@ class NearbyLockLogic extends BaseGetXController {
// //
// var featureParaTotal = reply.data[index]; // var featureParaTotal = reply.data[index];
var featureParaTotalList = reply.data.sublist(index); final List<int> featureParaTotalList = reply.data.sublist(index);
state.featureSettingParams = featureParaTotalList; state.featureSettingParams = featureParaTotalList;
AppLog.log('featureParaTotalList:$featureParaTotalList'); AppLog.log('featureParaTotalList:$featureParaTotalList');
Get.toNamed(Routers.lockAddressGaoDePage, arguments: { Get.toNamed(Routers.lockAddressGaoDePage, arguments: <String, Object>{
'pwdTimestamp': state.timestampValue * 1000, 'pwdTimestamp': state.timestampValue * 1000,
'lockInfo': state.lockInfo, 'lockInfo': state.lockInfo,
'featureValue': state.featureValue, 'featureValue': state.featureValue,
@ -342,8 +343,8 @@ class NearbyLockLogic extends BaseGetXController {
break; break;
case 0x06: case 0x06:
// //
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
// IoSenderManage.senderGetLockStatu( // IoSenderManage.senderGetLockStatu(
// lockID:BlueManage().connectDeviceName, // lockID:BlueManage().connectDeviceName,
// userID:await Storage.getUid(), // userID:await Storage.getUid(),
@ -352,8 +353,8 @@ class NearbyLockLogic extends BaseGetXController {
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
utcTimeStamp: getUTCNetTime(), utcTimeStamp: getUTCTime(),
unixTimeStamp: getLocalNetTime(), unixTimeStamp: getLocalTime(),
isBeforeAddUser: true, isBeforeAddUser: true,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
@ -373,14 +374,14 @@ class NearbyLockLogic extends BaseGetXController {
// dismissEasyLoading(); // dismissEasyLoading();
AppLog.log('开始获取锁状态'); AppLog.log('开始获取锁状态');
var privateKey = await Storage.getStringList(saveBluePrivateKey); final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
IoSenderManage.senderGetStarLockStatuInfo( IoSenderManage.senderGetStarLockStatuInfo(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
userID: await Storage.getUid(), userID: await Storage.getUid(),
utcTimeStamp: getUTCNetTime(), utcTimeStamp: getUTCTime(),
unixTimeStamp: getLocalNetTime(), unixTimeStamp: getLocalTime(),
isBeforeAddUser: true, isBeforeAddUser: true,
privateKey: getPrivateKeyList, privateKey: getPrivateKeyList,
); );
@ -394,12 +395,12 @@ class NearbyLockLogic extends BaseGetXController {
BlueManage().startScan(2000, (List<ScanResult> list) { BlueManage().startScan(2000, (List<ScanResult> list) {
state.devices.clear(); state.devices.clear();
for (int i = 0; i < list.length; i++) { for (int i = 0; i < list.length; i++) {
ScanResult device = list[i]; final ScanResult device = list[i];
if (((device.advertisementData.serviceUuids.isNotEmpty if ((device.advertisementData.serviceUuids.isNotEmpty
? device.advertisementData.serviceUuids[0] ? device.advertisementData.serviceUuids[0]
: '') : '')
.toString()[31] != .toString()[31] !=
'1')) { '1') {
state.devices.add(list[i]); state.devices.add(list[i]);
} }
} }
@ -431,16 +432,16 @@ class NearbyLockLogic extends BaseGetXController {
// //
Future<void> otaUpdate() async { Future<void> otaUpdate() async {
var status = await PermissionDialog.requestStorage(); final bool status = await PermissionDialog.requestStorage();
if (status != true) { if (status != true) {
return; return;
} }
FilePickerResult? result = await FilePicker.platform.pickFiles(); final FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result == null || result.files.single.path is! String) { if (result == null || result.files.single.path is! String) {
return; return;
} }
File file = File(result.files.single.path!); final File file = File(result.files.single.path!);
Uint8List data = await file.readAsBytes(); final Uint8List data = await file.readAsBytes();
headJson = await getHeadFile(data); headJson = await getHeadFile(data);
if (headJson is! Map) { if (headJson is! Map) {
return; return;
@ -449,9 +450,9 @@ class NearbyLockLogic extends BaseGetXController {
if (otaBin == null) { if (otaBin == null) {
return; return;
} }
String md5Str = md5.convert(otaBin!).toString(); final String md5Str = md5.convert(otaBin!).toString();
headJson!['fwMd5'] = md5Str; headJson!['fwMd5'] = md5Str;
blueOTAUpgrade(headJson!, [0, 0, 0, 0]); blueOTAUpgrade(headJson!, <int>[0, 0, 0, 0]);
} }
// ota // ota
@ -463,7 +464,7 @@ class NearbyLockLogic extends BaseGetXController {
BlueManage().blueSendData(deviceName!, BlueManage().blueSendData(deviceName!,
(BluetoothConnectionState deviceConnectionState) async { (BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
String uid = await Storage.getUid() ?? ''; final String uid = await Storage.getUid() ?? '';
BlueManage().writeCharacteristicWithResponse(OTAUpgradeCommand( BlueManage().writeCharacteristicWithResponse(OTAUpgradeCommand(
lockID: deviceName, lockID: deviceName,
userID: uid, userID: uid,
@ -488,29 +489,29 @@ class NearbyLockLogic extends BaseGetXController {
if (!state.otaUpdateIng.value) { if (!state.otaUpdateIng.value) {
return; return;
} }
int length = otaBin?.length ?? 0; final int length = otaBin?.length ?? 0;
if (otaCount == 0) { if (otaCount == 0) {
// //
int difference = length % 240; final int difference = length % 240;
otaCount = length ~/ 240 + (difference > 0 ? 1 : 0); otaCount = length ~/ 240 + (difference > 0 ? 1 : 0);
startSecond = DateTime.now().millisecondsSinceEpoch ~/ 1000; startSecond = DateTime.now().millisecondsSinceEpoch ~/ 1000;
} }
if (otaCount <= otaIndex) { if (otaCount <= otaIndex) {
int now = DateTime.now().millisecondsSinceEpoch ~/ 1000; final int now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
String msg = final String msg =
'传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex '; '传输完成 时间:${now - startSecond}秒 otaCount:$otaCount otaIndex:$otaIndex ';
closeOTADAta(); closeOTADAta();
AppLog.log(msg); AppLog.log(msg);
// showToast(msg); // showToast(msg);
return; return;
} }
int star = otaIndex * 240; final int star = otaIndex * 240;
int end = (otaIndex + 1) * 240; int end = (otaIndex + 1) * 240;
if (end > length) { if (end > length) {
end = length; end = length;
} }
int size = end - star; final int size = end - star;
List<int> data = otaBin!.sublist(star, end); final List<int> data = otaBin!.sublist(star, end);
state.otaProgress.value = otaIndex / otaCount; state.otaProgress.value = otaIndex / otaCount;
await BlueManage().writeCharacteristicWithResponse( await BlueManage().writeCharacteristicWithResponse(
ProcessOtaUpgradeCommand(index: otaIndex, size: size, data: data) ProcessOtaUpgradeCommand(index: otaIndex, size: size, data: data)
@ -594,7 +595,7 @@ class NearbyLockLogic extends BaseGetXController {
return null; return null;
} }
AppLog.log(metaStr); AppLog.log(metaStr);
var meta = jsonDecode(metaStr); final meta = jsonDecode(metaStr);
if (meta is! Map) { if (meta is! Map) {
showToast('解析元数据失败,请选择正确的文件'.tr); showToast('解析元数据失败,请选择正确的文件'.tr);
return null; return null;
@ -604,11 +605,11 @@ class NearbyLockLogic extends BaseGetXController {
// bin // bin
Future<Uint8List?> checkFile(Uint8List data, Map meta) async { Future<Uint8List?> checkFile(Uint8List data, Map meta) async {
num binOffset = 16 + (meta['metaLen'] ?? 0); final num binOffset = 16 + (meta['metaLen'] ?? 0);
// //
Uint8List bin = data.sublist(binOffset.toInt(), data.length); final Uint8List bin = data.sublist(binOffset.toInt(), data.length);
//md5 //md5
String md5Str = md5.convert(bin).toString().toUpperCase(); final String md5Str = md5.convert(bin).toString().toUpperCase();
// AppLog.log('---> $md5Str ${meta['fwMd5']}'); // AppLog.log('---> $md5Str ${meta['fwMd5']}');
if (md5Str != meta['fwMd5']) { if (md5Str != meta['fwMd5']) {
showToast('文件校验失败 0x02'.tr); showToast('文件校验失败 0x02'.tr);
@ -622,27 +623,25 @@ class NearbyLockLogic extends BaseGetXController {
} }
// //
void getServerDatetime() async{ Future<void> getServerDatetime() async{
var entity = await ApiRepository.to.getServerDatetimeData(); final GetServerDatetimeEntity entity = await ApiRepository.to.getServerDatetimeData();
if(entity.errorCode!.codeIsSuccessful){ if(entity.errorCode!.codeIsSuccessful){
state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000; state.differentialTime = entity.data!.date! ~/ 1000 - DateTime.now().millisecondsSinceEpoch ~/ 1000;
getLocalNetTime();
// AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}"); // AppLog.log("entity.data!.date! ~/ 1000:${entity.data!.date! ~/ 1000} DateTime.now().millisecondsSinceEpoch ~/ 1000:${DateTime.now().millisecondsSinceEpoch ~/ 1000} 服务器时间差:${state.differentialTime}");
} }
} }
int getUTCNetTime(){ int getLocalTime(){
return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime; return DateTime.now().millisecondsSinceEpoch ~/ 1000 + state.differentialTime;
} }
int getLocalNetTime(){ int getUTCTime(){
DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getUTCNetTime()*1000, isUtc: true); final DateTime utcTime = DateTime.fromMillisecondsSinceEpoch(getLocalTime()*1000, isUtc: true);
DateTime localTime = utcTime.toLocal();
// AppLog.log('getUTCNetTime: ${getUTCNetTime()}'); final String appointmentDate = DateTool().getYMDHNDateStringWithDateTime(utcTime, 1);
// AppLog.log('UTC time: $utcTime'); final int utcTimeValue = DateTool().dateToTimestamp(appointmentDate, 1);
// AppLog.log('Local time: $localTime localTime.millisecondsSinceEpoch ~/ 1000:${localTime.millisecondsSinceEpoch ~/ 1000}'); AppLog.log('appointmentDate: $appointmentDate utcTimeValue:$utcTimeValue');
return localTime.millisecondsSinceEpoch ~/ 1000; return utcTimeValue ~/ 1000;
} }
@override @override

View File

@ -192,10 +192,36 @@ class _MessageListXHJPageState extends State<MessageListXHJPage>
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Image.asset( if (isNotRead)
isNotRead ? 'images/news_not_read.png' : 'images/news_read.png', Stack(
width: 48.r, children: [
height: 48.r), Image.asset(
'images/news_not_read.png',
width: 48.r,
height: 48.r,
),
Positioned(
right: 1.5.r,
top: 7.r,
child: Container(
width: 12.r,
height: 12.r,
decoration: const BoxDecoration(
color: Colors.red, //
shape: BoxShape.circle, //
),
),
),
],
)
else
SizedBox(
width: 48.r,
height: 48.r,
child: Center(
child: Image.asset('images/news_read.png',
width: 32.r, height: 32.r),
)),
SizedBox(width: 15.w), SizedBox(width: 15.w),
Expanded( Expanded(
child: Column( child: Column(

View File

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/mine/mine/starLockMine_state.dart'; import 'package:star_lock/mine/mine/starLockMine_state.dart';
import 'package:star_lock/tools/commonDataManage.dart';
import '../../appRouters.dart'; import '../../appRouters.dart';
import '../../app_settings/app_colors.dart'; import '../../app_settings/app_colors.dart';
@ -80,7 +80,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(52.5.w), borderRadius: BorderRadius.circular(52.5.w),
child: CustomNetworkImage( child: CustomNetworkImage(
url: state.userHeadUrl.value ?? "", url: state.userHeadUrl.value,
defaultUrl: 'images/controls_user.png', defaultUrl: 'images/controls_user.png',
width: 105.w, width: 105.w,
height: 105.h, height: 105.h,
@ -99,7 +99,7 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
// logic.showToast('请先添加锁'); // logic.showToast('请先添加锁');
// } else { // } else {
Get.toNamed(Routers.advancedFeaturesWebPage, Get.toNamed(Routers.advancedFeaturesWebPage,
arguments: { arguments: <String, int>{
'webBuyType': XSConstantMacro.webBuyTypeVip, 'webBuyType': XSConstantMacro.webBuyTypeVip,
}); });
// } // }

View File

@ -1,14 +1,18 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'dart:typed_data';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/login/login/entity/LoginData.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyList/passwordKeyListEntity.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_state.dart';
import 'package:star_lock/widget/permission/permission_dialog.dart'; import 'package:star_lock/widget/permission/permission_dialog.dart';
import '../../../../network/api_repository.dart'; import '../../../../network/api_repository.dart';
import '../../../../tools/baseGetXController.dart'; import '../../../../tools/baseGetXController.dart';
import '../../../app_settings/app_settings.dart';
import '../../../tools/eventBusEventManage.dart'; import '../../../tools/eventBusEventManage.dart';
import '../../../tools/storage.dart'; import '../../../tools/storage.dart';
import 'minePersonGetUploadFileInfo_entity.dart'; import 'minePersonGetUploadFileInfo_entity.dart';
@ -18,7 +22,7 @@ class MinePersonInfoLogic extends BaseGetXController {
// //
Future<void> getUserInfoRequest() async { Future<void> getUserInfoRequest() async {
MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo(); final MinePersonInfoEntity entity = await ApiRepository.to.getUserInfo();
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.mineInfoData.value = entity.data!; state.mineInfoData.value = entity.data!;
state.headUrl.value = state.mineInfoData.value.headUrl!; state.headUrl.value = state.mineInfoData.value.headUrl!;
@ -27,7 +31,7 @@ class MinePersonInfoLogic extends BaseGetXController {
// upToken updateUserInfo // upToken updateUserInfo
Future<void> getUpTokenRequest(String filename, int size) async { Future<void> getUpTokenRequest(String filename, int size) async {
var entity = await ApiRepository.to.getUpToken( final MinePersonGetUploadFileInfoEntity entity = await ApiRepository.to.getUpToken(
userId: state.mineInfoData.value.uid!.toString(), userId: state.mineInfoData.value.uid!.toString(),
filename: filename, filename: filename,
size: size); size: size);
@ -41,18 +45,18 @@ class MinePersonInfoLogic extends BaseGetXController {
MinePersonGetUploadFileInfoEntity MinePersonGetUploadFileInfoEntity
minePersonGetUploadFileInfoEntity) async { minePersonGetUploadFileInfoEntity) async {
// Map<String, dynamic> user = minePersonGetUploadFileInfoEntity.data!.formData!; // Map<String, dynamic> user = minePersonGetUploadFileInfoEntity.data!.formData!;
var bytes = File(state.image!.path); final File bytes = File(state.image!.path);
var enc = await bytes.readAsBytes(); final Uint8List enc = await bytes.readAsBytes();
// user[minePersonGetUploadFileInfoEntity.data!.fileField!] = enc; // user[minePersonGetUploadFileInfoEntity.data!.fileField!] = enc;
final form = FormData(minePersonGetUploadFileInfoEntity.data!.formData!); final FormData form = FormData(minePersonGetUploadFileInfoEntity.data!.formData!);
form.files.add(MapEntry( form.files.add(MapEntry(
minePersonGetUploadFileInfoEntity.data!.fileField!, minePersonGetUploadFileInfoEntity.data!.fileField!,
MultipartFile(enc, MultipartFile(enc,
filename: filename:
minePersonGetUploadFileInfoEntity.data!.formData!["key"]))); minePersonGetUploadFileInfoEntity.data!.formData!['key'])));
var entity = await ApiRepository.to.uploadFile( final LoginEntity entity = await ApiRepository.to.uploadFile(
url: minePersonGetUploadFileInfoEntity.data!.uploadUrl!, body: form); url: minePersonGetUploadFileInfoEntity.data!.uploadUrl!, body: form);
if (entity.errorCode! == -1) { if (entity.errorCode! == -1) {
// null成功 // null成功
@ -62,15 +66,15 @@ class MinePersonInfoLogic extends BaseGetXController {
//- //-
Future<void> updateUserInfoRequest(String headUrl) async { Future<void> updateUserInfoRequest(String headUrl) async {
var entity = await ApiRepository.to.updateUserHeadUrlInfo(headUrl: headUrl); final PasswordKeyListEntity entity = await ApiRepository.to.updateUserHeadUrlInfo(headUrl: headUrl);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.headUrl.value = headUrl; state.headUrl.value = headUrl;
state.mineInfoData.value.headUrl = state.headUrl.value; state.mineInfoData.value.headUrl = state.headUrl.value;
final loginData = await Storage.getLoginData(); final LoginData? loginData = await Storage.getLoginData();
loginData!.headUrl = headUrl; loginData!.headUrl = headUrl;
await Storage.saveLoginData(loginData); await Storage.saveLoginData(loginData);
eventBus.fire(MineInfoChangeRefreshUI()); eventBus.fire(MineInfoChangeRefreshUI());
showToast("上传成功".tr); showToast('上传成功'.tr);
} }
} }
@ -86,34 +90,37 @@ class MinePersonInfoLogic extends BaseGetXController {
/// ///
Future<void> selectCamera() async { Future<void> selectCamera() async {
XFile? photo = await state.imagePicker.pickImage( final XFile? photo = await state.imagePicker.pickImage(
source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear); source: ImageSource.camera,
maxHeight: 250,
maxWidth: 250,
);
if (photo != null) { if (photo != null) {
state.image = photo; state.image = photo;
var bytes = File(state.image!.path); final File bytes = File(state.image!.path);
var enc = await bytes.readAsBytes(); final Uint8List enc = await bytes.readAsBytes();
getUpTokenRequest(state.image!.name, enc.length); getUpTokenRequest(state.image!.name, enc.length);
} }
} }
/// ///
Future<void> selectImage() async { Future<void> selectImage() async {
XFile? image = await state.imagePicker.pickImage( final XFile? image = await state.imagePicker.pickImage(
source: ImageSource.gallery, source: ImageSource.gallery,
maxHeight: 250, maxHeight: 250,
maxWidth: 250, maxWidth: 250,
); );
if (image != null) { if (image != null) {
state.image = image; state.image = image;
var bytes = File(state.image!.path); final File bytes = File(state.image!.path);
var enc = await bytes.readAsBytes(); final Uint8List enc = await bytes.readAsBytes();
getUpTokenRequest(state.image!.name, enc.length); getUpTokenRequest(state.image!.name, enc.length);
} }
} }
// 访 // 访
Future<void> _checkCameraPermission() async { Future<void> _checkCameraPermission() async {
var status = await PermissionDialog.request(Permission.camera); final bool status = await PermissionDialog.request(Permission.camera);
if (status) { if (status) {
selectCamera(); selectCamera();
} }
@ -121,7 +128,7 @@ class MinePersonInfoLogic extends BaseGetXController {
// 访 // 访
Future<void> _checkPhotoPermission() async { Future<void> _checkPhotoPermission() async {
var status = await PermissionDialog.requestPhotos(); final bool status = await PermissionDialog.requestPhotos();
if (status) { if (status) {
selectImage(); selectImage();
} }
@ -129,13 +136,11 @@ class MinePersonInfoLogic extends BaseGetXController {
@override @override
void onReady() { void onReady() {
// TODO: implement onReady
super.onReady(); super.onReady();
} }
@override @override
void onInit() { void onInit() {
// TODO: implement onInit
super.onInit(); super.onInit();
getUserInfoRequest(); getUserInfoRequest();
@ -143,6 +148,5 @@ class MinePersonInfoLogic extends BaseGetXController {
@override @override
void onClose() { void onClose() {
// TODO: implement onClose
} }
} }

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';

View File

@ -1,12 +1,13 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
class MinePersonInfoState { class MinePersonInfoState {
final mineInfoData = MinePersonInfoData().obs; final Rx<MinePersonInfoData> mineInfoData = MinePersonInfoData().obs;
final headUrl = ''.obs; final RxString headUrl = ''.obs;
var typeStr = '2'.obs; //2: RxString typeStr = '2'.obs; //2:
// ImagePicker获取内容后返回的对象是XFile // ImagePicker获取内容后返回的对象是XFile
XFile? image; XFile? image;
@ -14,8 +15,8 @@ class MinePersonInfoState {
// 使ImagePicker前必须先实例化 // 使ImagePicker前必须先实例化
final ImagePicker imagePicker = ImagePicker(); final ImagePicker imagePicker = ImagePicker();
var hasPhotoPermission = false.obs; // RxBool hasPhotoPermission = false.obs; //
var hasCameraPermission = false.obs; // RxBool hasCameraPermission = false.obs; //
} }

View File

@ -28,7 +28,7 @@ class _GetDeviceListPageState extends State<GetDeviceListPage> {
body: Column( body: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 30.w, top: 16.w, right: 30.w, bottom: 16.w), left: 30.w, top: 16.w, right: 30.w, bottom: 16.w),
@ -48,25 +48,25 @@ class _GetDeviceListPageState extends State<GetDeviceListPage> {
// //
Widget _permissionDeviceList() { Widget _permissionDeviceList() {
return Column( return Column(
children: [ children: <Widget>[
Expanded( Expanded(
child: ListView.separated( child: ListView.separated(
itemBuilder: (context, index) { itemBuilder: (BuildContext context, int index) {
if (index == 0) { if (index == 0) {
return _buildDeviceWidget( return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "大门锁"); context, index, 'images/icon_lock.png', '大门锁');
} else if (index == 1) { } else if (index == 1) {
return _buildDeviceWidget( return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "办公室锁"); context, index, 'images/icon_lock.png', '办公室锁');
} else if (index == 2) { } else if (index == 2) {
return _buildDeviceWidget( return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "会议室锁"); context, index, 'images/icon_lock.png', '会议室锁');
} else { } else {
return _buildDeviceWidget( return _buildDeviceWidget(
context, index, 'images/icon_lock.png', "宴会厅锁"); context, index, 'images/icon_lock.png', '宴会厅锁');
} }
}, },
separatorBuilder: (context, index) { separatorBuilder: (BuildContext context, int index) {
return const Divider( return const Divider(
height: 1, height: 1,
color: AppColors.greyLineColor, color: AppColors.greyLineColor,
@ -94,7 +94,7 @@ class _GetDeviceListPageState extends State<GetDeviceListPage> {
color: Colors.white, color: Colors.white,
width: ScreenUtil().screenWidth, width: ScreenUtil().screenWidth,
child: Row( child: Row(
children: [ children: <Widget>[
SizedBox( SizedBox(
width: 30.w, width: 30.w,
), ),

View File

@ -225,7 +225,7 @@ class _AddAuthorizedAdministratorPageState
maxLines: 1, maxLines: 1,
inputFormatters: <TextInputFormatter>[ inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.deny('\n'), FilteringTextInputFormatter.deny('\n'),
LengthLimitingTextInputFormatter(18), LengthLimitingTextInputFormatter(50),
], ],
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor), fontSize: 22.sp, color: AppColors.darkGrayTextColor),

View File

@ -14,6 +14,7 @@ import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart'; import '../../../../../translations/trans_lib.dart';
import '../../../../common/XSConstantMacro/XSConstantMacro.dart'; import '../../../../common/XSConstantMacro/XSConstantMacro.dart';
import '../../../../tools/EasyRefreshTool.dart'; import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/customNetworkImage.dart';
import '../../../../tools/showTipView.dart'; import '../../../../tools/showTipView.dart';
import '../../../../tools/storage.dart'; import '../../../../tools/storage.dart';
import 'authorizedAdministratorList_logic.dart'; import 'authorizedAdministratorList_logic.dart';
@ -195,7 +196,19 @@ class _AuthorizedAdministratorListPageState
SizedBox( SizedBox(
width: 30.w, width: 30.w,
), ),
Image.asset('images/controls_user.png', width: 60.w, height: 60.w), SizedBox(
width: 60.w,
height: 60.w,
child: ClipRRect(
borderRadius: BorderRadius.circular(30.w),
child: CustomNetworkImage(
url: itemData.headUrl ?? '',
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
),
),
),
SizedBox(width: 20.w), SizedBox(width: 20.w),
Expanded( Expanded(
child: Column( child: Column(

View File

@ -5,10 +5,12 @@ import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart'; import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_entity.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/expireLockList/expireElectronicKey/expireLockList_state.dart';
import '../../../../../appRouters.dart'; import '../../../../../appRouters.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/EasyRefreshTool.dart'; import '../../../../../tools/EasyRefreshTool.dart';
import '../../../../../tools/customNetworkImage.dart';
import '../../../../../tools/noData.dart'; import '../../../../../tools/noData.dart';
import 'expireLockList_logic.dart'; import 'expireLockList_logic.dart';
@ -20,8 +22,8 @@ class ExpireLockListPage extends StatefulWidget {
} }
class _ExpireLockListPageState extends State<ExpireLockListPage> { class _ExpireLockListPageState extends State<ExpireLockListPage> {
final logic = Get.put(ExpireLockListLogic()); final ExpireLockListLogic logic = Get.put(ExpireLockListLogic());
final state = Get.find<ExpireLockListLogic>().state; final ExpireLockListState state = Get.find<ExpireLockListLogic>().state;
Future<void> getHttpData() async { Future<void> getHttpData() async {
logic.expireLockListRequest().then((ExpireLockListEntity value){ logic.expireLockListRequest().then((ExpireLockListEntity value){
@ -46,7 +48,7 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
onLoad: (){ onLoad: (){
getHttpData(); getHttpData();
}, },
child: Obx(() => _buildMainUI()) child: Obx(_buildMainUI)
); );
} }
@ -56,14 +58,14 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
: SlidableAutoCloseBehavior( : SlidableAutoCloseBehavior(
child: ListView.separated( child: ListView.separated(
itemCount: state.dataList.length, itemCount: state.dataList.length,
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
ExpireLockItem indexEntity = state.dataList[index]; ExpireLockItem indexEntity = state.dataList[index];
return Slidable( return Slidable(
key:ValueKey(indexEntity.uid), key:ValueKey(indexEntity.uid),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: <Widget>[
SlidableAction( SlidableAction(
onPressed: (BuildContext context){ onPressed: (BuildContext context){
logic.deletKeyLogic(indexEntity); logic.deletKeyLogic(indexEntity);
@ -93,9 +95,9 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
onTap: () async { onTap: () async {
if(itemData.keyType! == 4){ if(itemData.keyType! == 4){
// //
var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: { var data = await Get.toNamed(Routers.electronicKeyPeriodValidityPage, arguments: <String, Object>{
"pushType": 0, 'pushType': 0,
"expireLockItem": itemData, 'expireLockItem': itemData,
}); });
if(data != null) { if(data != null) {
// setState(() { // setState(() {
@ -109,9 +111,9 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
getHttpData(); getHttpData();
} }
}else{ }else{
var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: { var data = await Get.toNamed(Routers.electronicKeyDetailChangeDate, arguments: <String, Object>{
"pushType": 0, 'pushType': 0,
"expireLockItem": itemData, 'expireLockItem': itemData,
}); });
if(data != null) { if(data != null) {
setState(() { setState(() {
@ -129,14 +131,22 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
height: 90.h, height: 90.h,
color: Colors.white, color: Colors.white,
child: Row( child: Row(
children: [ children: <Widget>[
SizedBox( SizedBox(
width: 30.w, width: 30.w,
), ),
Image.asset( SizedBox(
'images/controls_user.png',
width: 60.w, width: 60.w,
height: 60.w, height: 60.w,
child: ClipRRect(
borderRadius: BorderRadius.circular(30.w),
child: CustomNetworkImage(
url: itemData.headUrl ?? '',
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
),
),
), ),
SizedBox( SizedBox(
width: 20.w, width: 20.w,
@ -144,10 +154,10 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
Expanded( Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Text( Text(
itemData.nickname ?? '', itemData.nickname ?? '',
style: TextStyle( style: TextStyle(
@ -167,7 +177,7 @@ class _ExpireLockListPageState extends State<ExpireLockListPage> {
SizedBox(height: 10.h), SizedBox(height: 10.h),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Text( Text(
logic.getExpireDateStr(itemData), logic.getExpireDateStr(itemData),
style: TextStyle( style: TextStyle(

View File

@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList/lockUserManageList_state.dart';
import 'package:star_lock/tools/noData.dart'; import 'package:star_lock/tools/noData.dart';
import '../../../../../appRouters.dart'; import '../../../../../appRouters.dart';
@ -10,6 +11,7 @@ import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
import '../../../../../translations/trans_lib.dart'; import '../../../../../translations/trans_lib.dart';
import '../../../../tools/EasyRefreshTool.dart'; import '../../../../tools/EasyRefreshTool.dart';
import '../../../../tools/customNetworkImage.dart';
import '../../../../tools/keySearchWidget.dart'; import '../../../../tools/keySearchWidget.dart';
import '../../../../tools/showIosTipView.dart'; import '../../../../tools/showIosTipView.dart';
import 'lockUserManageList_logic.dart'; import 'lockUserManageList_logic.dart';
@ -22,12 +24,14 @@ class LockUserManageListPage extends StatefulWidget {
} }
class _LockUserManageListPageState extends State<LockUserManageListPage> { class _LockUserManageListPageState extends State<LockUserManageListPage> {
final logic = Get.put(LockUserManageListLogic()); final LockUserManageListLogic logic = Get.put(LockUserManageListLogic());
final state = Get.find<LockUserManageListLogic>().state; final LockUserManageListState state = Get.find<LockUserManageListLogic>().state;
Future<void> getHttpData() async { Future<void> getHttpData() async {
logic.lockUserListRequest().then((LockUserListEntity value) { logic.lockUserListRequest().then((LockUserListEntity value) {
if (mounted) setState(() {}); if (mounted) {
setState(() {});
}
}); });
} }
@ -46,7 +50,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
barTitle: TranslationLoader.lanKeys!.lockUserManagement!.tr, barTitle: TranslationLoader.lanKeys!.lockUserManagement!.tr,
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
actionsList: [ actionsList: <Widget>[
TextButton( TextButton(
child: Text( child: Text(
TranslationLoader.lanKeys!.aboutToExpire!.tr, TranslationLoader.lanKeys!.aboutToExpire!.tr,
@ -67,7 +71,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
getHttpData(); getHttpData();
}, },
child: Column( child: Column(
children: [ children: <Widget>[
KeySearchWidget( KeySearchWidget(
editingController: state.searchController, editingController: state.searchController,
onSubmittedAction: () { onSubmittedAction: () {
@ -89,7 +93,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
onPressed: () { onPressed: () {
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.massSendElectronicKeyManagePage) context, Routers.massSendElectronicKeyManagePage)
.then((value) { .then((Object? value) {
logic.lockUserListRequest(); logic.lockUserListRequest();
}); });
}, },
@ -121,22 +125,22 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
: SlidableAutoCloseBehavior( : SlidableAutoCloseBehavior(
child: ListView.separated( child: ListView.separated(
itemCount: state.dataList.length, itemCount: state.dataList.length,
itemBuilder: (c, index) { itemBuilder: (BuildContext c, int index) {
LockUserItemData indexEntity = state.dataList[index]; final LockUserItemData indexEntity = state.dataList[index];
if (index < state.dataList.length) { if (index < state.dataList.length) {
return Slidable( return Slidable(
key: ValueKey(indexEntity.uid), key: ValueKey(indexEntity.uid),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: <Widget>[
SlidableAction( SlidableAction(
onPressed: (BuildContext context) { onPressed: (BuildContext context) {
showIosTipViewDialog(context, indexEntity); showIosTipViewDialog(context, indexEntity);
}, },
backgroundColor: Colors.red, backgroundColor: Colors.red,
foregroundColor: Colors.white, foregroundColor: Colors.white,
label: '删除', label: '删除'.tr,
padding: EdgeInsets.only(left: 5.w, right: 5.w), padding: EdgeInsets.only(left: 5.w, right: 5.w),
), ),
], ],
@ -161,7 +165,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.pushNamed(context, Routers.ownedKeyListPage, Navigator.pushNamed(context, Routers.ownedKeyListPage,
arguments: {'uid': itemData.uid}); arguments: <String, int?>{'uid': itemData.uid});
}, },
child: Container( child: Container(
height: 90.h, height: 90.h,
@ -171,14 +175,20 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
// borderRadius: BorderRadius.circular(10.w), // borderRadius: BorderRadius.circular(10.w),
// ), // ),
child: Row( child: Row(
children: [ children: <Widget>[
SizedBox(width: 30.w),
SizedBox( SizedBox(
width: 30.w,
),
Image.asset(
'images/controls_user.png',
width: 60.w, width: 60.w,
height: 60.w, height: 60.w,
child: ClipRRect(
borderRadius: BorderRadius.circular(30.w),
child: CustomNetworkImage(
url: itemData.headUrl ?? '',
defaultUrl: 'images/controls_user.png',
width: 105.w,
height: 105.h,
),
),
), ),
SizedBox( SizedBox(
width: 20.w, width: 20.w,
@ -186,10 +196,10 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
Expanded( Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: <Widget>[
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Text( Text(
itemData.nickname ?? '', itemData.nickname ?? '',
style: TextStyle( style: TextStyle(
@ -200,7 +210,7 @@ class _LockUserManageListPageState extends State<LockUserManageListPage> {
SizedBox(height: 5.h), SizedBox(height: 5.h),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: <Widget>[
Text( Text(
itemData.userid ?? '', itemData.userid ?? '',
style: TextStyle( style: TextStyle(

View File

@ -30,6 +30,7 @@ abstract class Api {
'/key/modifyKeyNameForAdmin'; // '/key/modifyKeyNameForAdmin'; //
final String updateKeyDateURL = '/key/updateKeyDate'; // final String updateKeyDateURL = '/key/updateKeyDate'; //
final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; // final String passwordKeyListURL = '/keyboardPwd/listSendRecords'; //
final String passwordKeyDetailURL = '/keyboardPwd/detail'; //
final String keyboardPwdResetURL = '/keyboardPwd/reset'; // final String keyboardPwdResetURL = '/keyboardPwd/reset'; //
final String deleteElectronicKeyURL = '/key/delete'; // final String deleteElectronicKeyURL = '/key/delete'; //
final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; // final String deleteKeyboardPwdURL = '/keyboardPwd/delete'; //
@ -101,6 +102,7 @@ abstract class Api {
final String editCheckInSetInfoURL = '/attendanceCompany/update'; // final String editCheckInSetInfoURL = '/attendanceCompany/update'; //
final String getFingerprintListURL = '/fingerprint/list'; // final String getFingerprintListURL = '/fingerprint/list'; //
final String getFingerprintDetailURL = '/fingerprint/detail'; //
final String addFingerprintURL = '/fingerprint/add'; // final String addFingerprintURL = '/fingerprint/add'; //
final String editFingerprintURL = '/fingerprint/changePeriod'; // final String editFingerprintURL = '/fingerprint/changePeriod'; //
final String deleteFingerprintURL = '/fingerprint/delete'; // final String deleteFingerprintURL = '/fingerprint/delete'; //
@ -247,4 +249,5 @@ abstract class Api {
final String getDefaultTemplateURL = final String getDefaultTemplateURL =
'/v2/service/getDefaultTemplate'; // '/v2/service/getDefaultTemplate'; //
final String addSMSTemplateURL = '/v2/service/addSmsTemplate'; // final String addSMSTemplateURL = '/v2/service/addSmsTemplate'; //
final String keydetail = ' /key/detail'; //
} }

View File

@ -126,6 +126,16 @@ class ApiProvider extends BaseProvider {
'searchStr': searchStr 'searchStr': searchStr
})); }));
Future<Response> electronicKey(
int lockId, int keyId
) =>
post(
keydetail.toUrl,
jsonEncode({
'lockId': lockId.toString(),
'keyId': keyId.toString(),
}));
Future<Response> sendElectronicKey( Future<Response> sendElectronicKey(
int createUser, int createUser,
String countryCode, String countryCode,
@ -439,6 +449,14 @@ class ApiProvider extends BaseProvider {
'searchStr': searchStr 'searchStr': searchStr
})); }));
Future<Response> passwordKey(int lockId, int keyboardPwdId,) =>
post(
passwordKeyDetailURL.toUrl,
jsonEncode({
'lockId': lockId,
'keyboardPwdId': keyboardPwdId
}));
Future<Response> resetPasswordKey(String lockId, String operatorUid) => post( Future<Response> resetPasswordKey(String lockId, String operatorUid) => post(
resetPasswordURL.toUrl, resetPasswordURL.toUrl,
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
@ -1097,9 +1115,18 @@ class ApiProvider extends BaseProvider {
'staffId': staffId, 'staffId': staffId,
})); }));
//
Future<Response> getFingerprintsData(
int fingerprintId) =>
post(
getFingerprintDetailURL.toUrl,
jsonEncode({
'fingerprintId': fingerprintId,
}));
// //
Future<Response> getFingerprintsListData( Future<Response> getFingerprintsListData(
String lockId, String pageNo, String pageSize, String searchStr) => String lockId, String pageNo, String pageSize, String searchStr) =>
post( post(
getFingerprintListURL.toUrl, getFingerprintListURL.toUrl,
jsonEncode({ jsonEncode({

View File

@ -51,9 +51,10 @@ class BaseProvider extends GetConnect with Api {
query: query, query: query,
decoder: decoder, decoder: decoder,
uploadProgress: uploadProgress); uploadProgress: uploadProgress);
if (EasyLoading.isShow && !isUnShowLoading!) {
await EasyLoading.dismiss(animation: true);
}
if (res.body == null) { if (res.body == null) {
if (EasyLoading.isShow) await EasyLoading.dismiss(animation: true);
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
if (res.statusCode == null && isShowErrMsg!) { if (res.statusCode == null && isShowErrMsg!) {
EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr,

View File

@ -4,10 +4,12 @@ import 'package:star_lock/login/login/app_get_version.dart';
import 'package:star_lock/login/selectCountryRegion/common/countryRegionEntity.dart'; import 'package:star_lock/login/selectCountryRegion/common/countryRegionEntity.dart';
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart'; import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart'; import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_entity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyList/entity/ElectronicKeyListEntity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserList_entity.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/massSendLockGroupListEntity.dart';
import 'package:star_lock/main/lockDetail/face/addFace/addFace_entity.dart'; import 'package:star_lock/main/lockDetail/face/addFace/addFace_entity.dart';
import 'package:star_lock/main/lockDetail/fingerprint/fingerprintList/fingerprint_entity.dart';
import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart'; import 'package:star_lock/main/lockDetail/lockSet/basicInformation/basicInformation/KeyDetailEntity.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockEscalation/version_entity.dart'; import 'package:star_lock/main/lockDetail/lockSet/lockEscalation/version_entity.dart';
import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart'; import 'package:star_lock/main/lockDetail/messageWarn/lockUser/lockUser_entity.dart';
@ -171,6 +173,14 @@ class ApiRepository {
return ElectronicKeyListEntity.fromJson(res.body); return ElectronicKeyListEntity.fromJson(res.body);
} }
//
Future<ElectronicKeyEntity> electronicKey({
required int lockId,required int keyId
}) async {
final res = await apiProvider.electronicKey(lockId,keyId);
return ElectronicKeyEntity.fromJson(res.body);
}
// //
Future<AuthorizedAdminSendEntity> sendElectronicKey( Future<AuthorizedAdminSendEntity> sendElectronicKey(
{required int createUser, {required int createUser,
@ -414,6 +424,14 @@ class ApiRepository {
return PasswordKeyListEntity.fromJson(res.body); return PasswordKeyListEntity.fromJson(res.body);
} }
//
Future<PasswordKeyEntity> passwordKey( int lockId,int keyboardPwdId) async {
final res = await apiProvider.passwordKey(
lockId, keyboardPwdId);
return PasswordKeyEntity.fromJson(res.body);
}
// //
Future<PasswordKeyListEntity> resetPasswordKey( Future<PasswordKeyListEntity> resetPasswordKey(
String lockId, String operatorUid) async { String lockId, String operatorUid) async {
@ -1291,6 +1309,12 @@ class ApiRepository {
return FingerprintListDataEntity.fromJson(res.body); return FingerprintListDataEntity.fromJson(res.body);
} }
//
Future<FingerprintEntity> getFingerprintsData(int fingerprintId) async {
final res = await apiProvider.getFingerprintsData(fingerprintId);
return FingerprintEntity.fromJson(res.body);
}
// //
Future<AddFingerprintEntity> addFingerprintsData({ Future<AddFingerprintEntity> addFingerprintsData({
required String lockId, required String lockId,

View File

@ -6,6 +6,5 @@ import 'package:star_lock/app_settings/app_settings.dart';
FutureOr<dynamic> responseLogInterceptor(Request request, Response response) { FutureOr<dynamic> responseLogInterceptor(Request request, Response response) {
AppLog.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString}'); // \n ${response.headers} AppLog.log('HTTP request:${request.url}\n RESPONSE => stataCode:${response.statusCode} ${response.bodyString}'); // \n ${response.headers}
EasyLoading.dismiss(animation: true);
return response; return response;
} }

View File

@ -116,6 +116,40 @@ class DateTool {
return dateStr; return dateStr;
} }
/// PDuration及时间类型获取时间字符串
/// type 1: (2023-01-01 12:00) 2: (2023-01-01) 3: (12:00)
String getYMDHNDateStringWithDateTime(DateTime p, int type) {
final int year = p.year == 0 ? DateTime.now().year : p.year;
final int month = p.month == 0 ? DateTime.now().month : p.month;
final int day = p.day == 0 ? DateTime.now().day : p.day;
final int hour = p.hour;
final int minute = p.minute;
String dateStr = '';
switch (type) {
case 1:
// (2023-01-01 12:48)
dateStr =
'$year-${month!.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}';
break;
case 2:
// (2023-01-01)
dateStr =
'$year-${month!.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')}';
break;
case 3:
// (12:05)
dateStr =
'${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}';
break;
default:
dateStr =
'$year-${month!.toString().padLeft(2, '0')}-${day.toString().padLeft(2, '0')} ${hour.toString().padLeft(2, '0')}:${minute.toString().padLeft(2, '0')}';
break;
}
return dateStr;
}
/// ///
/// type 0: 12:00 1: /// type 0: 12:00 1:
int dateToTimestamp(String dateStr, int type) { int dateToTimestamp(String dateStr, int type) {

View File

@ -182,7 +182,8 @@ class Pickers {
DateCallback? onChanged, DateCallback? onChanged,
DateCallback? onConfirm, DateCallback? onConfirm,
Function(bool isCancel)? onCancel, Function(bool isCancel)? onCancel,
bool overlapTabBar = false}) { bool overlapTabBar = false,
bool hourShow24 = false}) {
pickerStyle ??= DefaultPickerStyle(); pickerStyle ??= DefaultPickerStyle();
pickerStyle.context ??= context; pickerStyle.context ??= context;
@ -212,6 +213,7 @@ class Pickers {
} }
} }
AppLog.log('picker Tip >>> hourShow24 : $hourShow24');
Navigator.of(context, rootNavigator: overlapTabBar).push(DatePickerRoute( Navigator.of(context, rootNavigator: overlapTabBar).push(DatePickerRoute(
mode: mode, mode: mode,
initDate: selectDate, initDate: selectDate,
@ -225,6 +227,7 @@ class Pickers {
// theme: Theme.of(context, shadowThemeOnly: true), // theme: Theme.of(context, shadowThemeOnly: true),
theme: Theme.of(context), theme: Theme.of(context),
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
hourShow24: hourShow24,
)); ));
} }
} }

View File

@ -35,6 +35,7 @@ class DatePickerRoute<T> extends PopupRoute<T> {
this.onCancel, this.onCancel,
this.theme, this.theme,
this.barrierLabel, this.barrierLabel,
this.hourShow24,
RouteSettings? settings, RouteSettings? settings,
}) : super(settings: settings); }) : super(settings: settings);
@ -48,6 +49,7 @@ class DatePickerRoute<T> extends PopupRoute<T> {
final DateCallback? onConfirm; final DateCallback? onConfirm;
final Function(bool isCancel)? onCancel; final Function(bool isCancel)? onCancel;
final PickerStyle? pickerStyle; final PickerStyle? pickerStyle;
bool? hourShow24;
@override @override
Duration get transitionDuration => const Duration(milliseconds: 200); Duration get transitionDuration => const Duration(milliseconds: 200);
@ -96,6 +98,7 @@ class DatePickerRoute<T> extends PopupRoute<T> {
minDate: minDate, minDate: minDate,
pickerStyle: pickerStyle!, pickerStyle: pickerStyle!,
route: this, route: this,
hourShow24: hourShow24 ?? false,
), ),
); );
if (theme != null) { if (theme != null) {
@ -115,6 +118,7 @@ class _PickerContentView extends StatefulWidget {
required this.maxDate, required this.maxDate,
required this.minDate, required this.minDate,
required this.route, required this.route,
this.hourShow24 = false,
}) : super(key: key); }) : super(key: key);
final DateMode? mode; final DateMode? mode;
@ -126,9 +130,12 @@ class _PickerContentView extends StatefulWidget {
late final PDuration maxDate; late final PDuration maxDate;
late final PDuration minDate; late final PDuration minDate;
// 24
late final bool hourShow24;
@override @override
State<StatefulWidget> createState() => _PickerState( State<StatefulWidget> createState() => _PickerState(
this.mode, this.initData, this.maxDate, this.minDate, this.pickerStyle); mode, initData, maxDate, minDate, pickerStyle, hourShow24);
} }
class _PickerState extends State<_PickerContentView> { class _PickerState extends State<_PickerContentView> {
@ -150,6 +157,9 @@ class _PickerState extends State<_PickerContentView> {
late final PDuration maxDate; late final PDuration maxDate;
late final PDuration minDate; late final PDuration minDate;
// 24
bool hourShow24 = false;
Animation<double>? animation; Animation<double>? animation;
Map<DateType, FixedExtentScrollController> scrollCtrl = {}; Map<DateType, FixedExtentScrollController> scrollCtrl = {};
@ -157,9 +167,9 @@ class _PickerState extends State<_PickerContentView> {
late double pickerItemHeight; late double pickerItemHeight;
_PickerState(DateMode? mode, this._initSelectData, this.maxDate, this.minDate, _PickerState(DateMode? mode, this._initSelectData, this.maxDate, this.minDate,
this._pickerStyle) { this._pickerStyle, this.hourShow24) {
this._dateItemModel = DateItemModel.parse(mode!); _dateItemModel = DateItemModel.parse(mode!);
this.pickerItemHeight = _pickerStyle.pickerItemHeight; pickerItemHeight = _pickerStyle.pickerItemHeight;
_init(); _init();
} }
@ -246,7 +256,7 @@ class _PickerState extends State<_PickerContentView> {
if (_dateItemModel.hour) { if (_dateItemModel.hour) {
index = 0; index = 0;
int begin = 0; int begin = 0;
int end = 23; int end = hourShow24 ? 24 : 23;
// //
if (intNotEmpty(minDate.hour)) { if (intNotEmpty(minDate.hour)) {
begin = minDate.hour!; begin = minDate.hour!;
@ -255,7 +265,7 @@ class _PickerState extends State<_PickerContentView> {
end = maxDate.hour!; end = maxDate.hour!;
} }
_dateTimeData.hour = TimeUtils.calcHour(begin: begin, end: end); _dateTimeData.hour = TimeUtils.calcHour(begin: begin, end: end, hourShow24: hourShow24);
if (_initSelectData.hour != null) { if (_initSelectData.hour != null) {
index = _dateTimeData.hour.indexOf(_initSelectData.hour); index = _dateTimeData.hour.indexOf(_initSelectData.hour);

View File

@ -24,9 +24,10 @@ class TimeUtils {
} }
/// ///
static List calcHour({int begin = 0, int end = 23}) { static List calcHour({int begin = 0, int end = 23, bool hourShow24 = false}) {
begin = begin < 0 ? 0 : begin; begin = begin < 0 ? 0 : begin;
end = end > 23 ? 23 : end; int hour = hourShow24 ? 24 : 23;
end = end > hour ? hour : end;
return _calcCount(begin, end); return _calcCount(begin, end);
} }

View File

@ -1,5 +1,6 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/app_settings/app_colors.dart';
@ -95,14 +96,15 @@ class ShowTipView {
} }
void showTFViewAlertDialog(TextEditingController controller, String title, void showTFViewAlertDialog(TextEditingController controller, String title,
String tipTitle, Function sureClick) { String tipTitle, Function sureClick, {List<TextInputFormatter>? inputFormatters}) {
// //
showDialog( showDialog(
context: Get.context!, context: Get.context!,
builder: (BuildContext context) { builder: (BuildContext context) {
return ShowTFView( return ShowTFView(
title: title, title: title,
tipTitle: tipTitle ?? "", tipTitle: tipTitle,
inputFormatters: inputFormatters,
controller: controller, controller: controller,
sureClick: () { sureClick: () {
// //

View File

@ -10,6 +10,20 @@ import '../app_settings/app_colors.dart';
* */ * */
class SubmitBtn extends StatelessWidget { class SubmitBtn extends StatelessWidget {
SubmitBtn({
required this.btnName, Key? key,
this.borderRadius,
this.color,
this.padding,
this.onClick,
this.margin,
this.width,
this.backgroundColorList,
this.isDelete,
this.fontSize,
this.isDisabled,
}) : super(key: key);
String? btnName; String? btnName;
Function()? onClick; Function()? onClick;
@ -32,21 +46,6 @@ class SubmitBtn extends StatelessWidget {
bool? isDisabled; bool? isDisabled;
SubmitBtn({
Key? key,
required this.btnName,
this.borderRadius,
this.color,
this.padding,
this.onClick,
this.margin,
this.width,
this.backgroundColorList,
this.isDelete,
this.fontSize,
this.isDisabled,
}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -113,16 +112,15 @@ class SubmitBtn extends StatelessWidget {
* */ * */
class AddBottomWhiteBtn extends StatelessWidget { class AddBottomWhiteBtn extends StatelessWidget {
AddBottomWhiteBtn({
required this.btnName, Key? key,
this.onClick,
}) : super(key: key);
String? btnName; String? btnName;
Function()? onClick; Function()? onClick;
AddBottomWhiteBtn({
Key? key,
required this.btnName,
this.onClick,
}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
@ -167,16 +165,15 @@ class AddBottomWhiteBtn extends StatelessWidget {
* */ * */
class OutLineBtn extends StatelessWidget { class OutLineBtn extends StatelessWidget {
OutLineBtn({
required this.btnName, Key? key,
this.onClick,
}) : super(key: key);
String? btnName; String? btnName;
Function()? onClick; Function()? onClick;
OutLineBtn({
Key? key,
required this.btnName,
this.onClick,
}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return SizedBox(

View File

@ -62,8 +62,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.53+2024052803xhj 线上环境,提审 sky 线上环境提审 # 1.0.53+2024052803xhj 线上环境,提审 sky 线上环境提审
# 1.0.53+2024052804xhj 线上环境,提审 修改鑫锁名字为星星锁 # 1.0.53+2024052804xhj 线上环境,提审 修改鑫锁名字为星星锁
# 1.0.54+2024053001xhj 线上环境,对外发布,提交测试 # 1.0.54+2024053001xhj 线上环境,对外发布,提交测试
# 1.0.56+202406401xhj 线上环境,对外发布,提交测试
version: 1.0.54+2024053001 version: 1.0.56+202406401
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'
@ -206,7 +207,6 @@ dependencies:
# 错误日志监控 # 错误日志监控
flutter_bugly_plugin: ^0.0.9 flutter_bugly_plugin: ^0.0.9
dependency_overrides: dependency_overrides:
#强制设置google_maps_flutter_ios 为 2.5.2 #强制设置google_maps_flutter_ios 为 2.5.2
google_maps_flutter_ios: 2.5.2 google_maps_flutter_ios: 2.5.2