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

This commit is contained in:
Daisy 2024-04-15 14:54:11 +08:00
commit 7a39bc735d
42 changed files with 655 additions and 335 deletions

View File

@ -95,7 +95,7 @@ flavors:
bundleId: "com.skychip.lock" bundleId: "com.skychip.lock"
xhj: xhj:
app: app:
name: "锁" name: "星星锁"
icon: "assets/icon/xhj.png" icon: "assets/icon/xhj.png"
android: android:
applicationId: "com.xhjcn.lock" applicationId: "com.xhjcn.lock"

View File

@ -662,6 +662,10 @@
"。如果是全自动锁,请使屏幕变亮": ". If it is a fully automatic lock, please make the screen brighter", "。如果是全自动锁,请使屏幕变亮": ". If it is a fully automatic lock, please make the screen brighter",
"用户无权限": "User has no permission", "用户无权限": "User has no permission",
"创建公司后,考勤功能才能使用": "After creating the company, the attendance function can be used", "创建公司后,考勤功能才能使用": "After creating the company, the attendance function can be used",
"是否删除钥匙?": "Whether to delete the key?",
"邮箱绑定成功": "Email binding success",
"手机绑定成功": "Mobile phone binding success",
"网络访问失败,请检查网络是否正常": "网络访问失败,请检查网络是否正常",
"相机": "camera", "相机": "camera",
"相册": "photos", "相册": "photos",

View File

@ -661,6 +661,10 @@
"。如果是全自动锁,请使屏幕变亮": "。如果是全自动锁,请使屏幕变亮", "。如果是全自动锁,请使屏幕变亮": "。如果是全自动锁,请使屏幕变亮",
"用户无权限": "用户无权限", "用户无权限": "用户无权限",
"创建公司后,考勤功能才能使用": "创建公司后,考勤功能才能使用", "创建公司后,考勤功能才能使用": "创建公司后,考勤功能才能使用",
"是否删除钥匙?": "是否删除钥匙?",
"邮箱绑定成功": "邮箱绑定成功",
"手机绑定成功": "手机绑定成功",
"网络访问失败,请检查网络是否正常": "网络访问失败,请检查网络是否正常",
"相机": "相机", "相机": "相机",
"相册": "相册", "相册": "相册",

View File

@ -663,6 +663,10 @@
"。如果是全自动锁,请使屏幕变亮": "。如果是全自动锁,请使屏幕变亮", "。如果是全自动锁,请使屏幕变亮": "。如果是全自动锁,请使屏幕变亮",
"用户无权限": "用户无权限", "用户无权限": "用户无权限",
"创建公司后,考勤功能才能使用": "创建公司后,考勤功能才能使用", "创建公司后,考勤功能才能使用": "创建公司后,考勤功能才能使用",
"是否删除钥匙?": "是否删除钥匙?",
"邮箱绑定成功": "邮箱绑定成功",
"手机绑定成功": "手机绑定成功",
"网络访问失败,请检查网络是否正常": "网络访问失败,请检查网络是否正常",
"相机": "相机", "相机": "相机",
"相册": "相册", "相册": "相册",

View File

@ -57,8 +57,12 @@ PODS:
- fluttertoast (0.0.2): - fluttertoast (0.0.2):
- Flutter - Flutter
- Toast - Toast
- g711_flutter (0.0.1): - fluwx (0.0.1):
- Flutter - Flutter
- fluwx/pay (= 0.0.1)
- fluwx/pay (0.0.1):
- Flutter
- WechatOpenSDK-XCFramework (~> 2.0.4)
- google_maps_flutter_ios (0.0.1): - google_maps_flutter_ios (0.0.1):
- Flutter - Flutter
- GoogleMaps (< 9.0) - GoogleMaps (< 9.0)
@ -88,7 +92,7 @@ PODS:
- path_provider_foundation (0.0.1): - path_provider_foundation (0.0.1):
- Flutter - Flutter
- FlutterMacOS - FlutterMacOS
- permission_handler_apple (9.1.1): - permission_handler_apple (9.3.0):
- Flutter - Flutter
- ReachabilitySwift (5.0.0) - ReachabilitySwift (5.0.0)
- shared_preferences_foundation (0.0.1): - shared_preferences_foundation (0.0.1):
@ -107,6 +111,7 @@ PODS:
- FlutterMacOS - FlutterMacOS
- webview_flutter_wkwebview (0.0.1): - webview_flutter_wkwebview (0.0.1):
- Flutter - Flutter
- WechatOpenSDK-XCFramework (2.0.4)
DEPENDENCIES: DEPENDENCIES:
- aj_captcha_flutter (from `.symlinks/plugins/aj_captcha_flutter/ios`) - aj_captcha_flutter (from `.symlinks/plugins/aj_captcha_flutter/ios`)
@ -128,7 +133,7 @@ DEPENDENCIES:
- flutter_pcm_sound (from `.symlinks/plugins/flutter_pcm_sound/ios`) - flutter_pcm_sound (from `.symlinks/plugins/flutter_pcm_sound/ios`)
- flutter_voice_processor (from `.symlinks/plugins/flutter_voice_processor/ios`) - flutter_voice_processor (from `.symlinks/plugins/flutter_voice_processor/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- g711_flutter (from `.symlinks/plugins/g711_flutter/ios`) - fluwx (from `.symlinks/plugins/fluwx/ios`)
- google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`)
- image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`) - image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
@ -164,6 +169,7 @@ SPEC REPOS:
- JPush - JPush
- ReachabilitySwift - ReachabilitySwift
- Toast - Toast
- WechatOpenSDK-XCFramework
EXTERNAL SOURCES: EXTERNAL SOURCES:
aj_captcha_flutter: aj_captcha_flutter:
@ -202,8 +208,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_voice_processor/ios" :path: ".symlinks/plugins/flutter_voice_processor/ios"
fluttertoast: fluttertoast:
:path: ".symlinks/plugins/fluttertoast/ios" :path: ".symlinks/plugins/fluttertoast/ios"
g711_flutter: fluwx:
:path: ".symlinks/plugins/g711_flutter/ios" :path: ".symlinks/plugins/fluwx/ios"
google_maps_flutter_ios: google_maps_flutter_ios:
:path: ".symlinks/plugins/google_maps_flutter_ios/ios" :path: ".symlinks/plugins/google_maps_flutter_ios/ios"
image_gallery_saver: image_gallery_saver:
@ -249,7 +255,7 @@ SPEC CHECKSUMS:
AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033 AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033
app_settings: 017320c6a680cdc94c799949d95b84cb69389ebc app_settings: 017320c6a680cdc94c799949d95b84cb69389ebc
audio_service: f509d65da41b9521a61f1c404dd58651f265a567 audio_service: f509d65da41b9521a61f1c404dd58651f265a567
audio_session: 4f3e461722055d21515cf3261b64c973c062f345 audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68 camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68
@ -263,7 +269,7 @@ SPEC CHECKSUMS:
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82 flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265 fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
g711_flutter: 8f2769052d2cf3549f83d11e1c42d81d94441123 fluwx: daa284756ce53442b3d0417ceeda66e981906811
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458 google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4 GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
@ -276,7 +282,7 @@ SPEC CHECKSUMS:
network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6 permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695 shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
@ -285,6 +291,7 @@ SPEC CHECKSUMS:
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579 video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579
webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4 webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4
WechatOpenSDK-XCFramework: 36fb2bea0754266c17184adf4963d7e6ff98b69f
PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc PODFILE CHECKSUM: 317f9473a5705c6fe4d79d95e81676f248048fdc

View File

@ -1,5 +1,6 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart'; import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/login/register/starLock_register_binding.dart'; import 'package:star_lock/login/register/starLock_register_binding.dart';
import 'package:star_lock/main/accessoriesList/accessoriesList_page.dart'; import 'package:star_lock/main/accessoriesList/accessoriesList_page.dart';
import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_page.dart'; import 'package:star_lock/main/lockDetail/doorLockLog/doorLockLog_page.dart';
@ -29,6 +30,7 @@ import 'package:star_lock/main/lockDetail/palm/addPalm/addPalm_page.dart';
import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmTypeManage/addPalmTypeManage_page.dart'; import 'package:star_lock/main/lockDetail/palm/addPalmType/addPalmTypeManage/addPalmTypeManage_page.dart';
import 'package:star_lock/main/lockDetail/palm/palmList/palmList_page.dart'; import 'package:star_lock/main/lockDetail/palm/palmList/palmList_page.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart';
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart';
import 'package:star_lock/mine/about/webviewShow_page.dart'; import 'package:star_lock/mine/about/webviewShow_page.dart';
import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart'; import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart';
@ -453,7 +455,9 @@ abstract class AppRouters {
), ),
GetPage( GetPage(
name: Routers.starLockMain, name: Routers.starLockMain,
page: () => const StarLockMainPage(), page: () => F.sw(
defaultCall: () => StarLockMainPage(),
xhjCall: () => const StarLockMainXHJPage()),
), ),
GetPage( GetPage(
name: Routers.starLockMinePage, name: Routers.starLockMinePage,
@ -465,7 +469,7 @@ abstract class AppRouters {
), ),
GetPage( GetPage(
name: Routers.lockMallPage, name: Routers.lockMallPage,
page: () => const LockMallPage(), page: () => LockMallPage(),
), ),
GetPage( GetPage(
name: Routers.addLockPage, name: Routers.addLockPage,
@ -729,7 +733,7 @@ abstract class AppRouters {
), ),
GetPage( GetPage(
name: Routers.minePersonInfoPage, name: Routers.minePersonInfoPage,
page: () => const MinePersonInfoPage(), page: () => MinePersonInfoPage(),
), ),
GetPage( GetPage(
name: Routers.minePersonInfoEditNamePage, name: Routers.minePersonInfoEditNamePage,
@ -761,7 +765,7 @@ abstract class AppRouters {
), ),
GetPage( GetPage(
name: Routers.messageListPage, name: Routers.messageListPage,
page: () => const MessageListPage(), page: () => MessageListPage(),
), ),
GetPage( GetPage(
name: Routers.supportStaffPage, name: Routers.supportStaffPage,

View File

@ -1,10 +1,15 @@
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluwx/fluwx.dart';
import 'package:star_lock/flavors.dart';
class AppColors { class AppColors {
// static Color mainColor = const Color(0xFF385DEA); // static Color mainColor = const Color(0xFF385DEA);
static Color mainColor = const Color(0xFF4777EE); static Color get mainColor => F.sw(
defaultCall: () => const Color(0xFF4777EE),
xhjCall: () => const Color(0xFF68c1b9));
static Color mainBackgroundColor = const Color(0xFFF5F5F5); static Color mainBackgroundColor = const Color(0xFFF5F5F5);
static Color primaryTopColor = const Color(0xFF021B38); static Color primaryTopColor = const Color(0xFF021B38);
@ -25,6 +30,7 @@ class AppColors {
//check box color //check box color
static Color checkBoxSelectedColor = touristColor; static Color checkBoxSelectedColor = touristColor;
static Color get checkBoxUnselectedColor => const Color(0xFFFFFFFF); static Color get checkBoxUnselectedColor => const Color(0xFFFFFFFF);
static Color checkBoxOverlayColor = checkBoxUnselectedColor.withOpacity(0.3); static Color checkBoxOverlayColor = checkBoxUnselectedColor.withOpacity(0.3);
@ -69,6 +75,7 @@ class AppColors {
static Color wifiDisableColor = const Color(0xFFA8A8A8); static Color wifiDisableColor = const Color(0xFFA8A8A8);
static Color get paginationColor => const Color(0xFF01295C).withOpacity(45); static Color get paginationColor => const Color(0xFF01295C).withOpacity(45);
static Color get paginationActiveColor => static Color get paginationActiveColor =>
const Color(0xFFFFFFFF).withOpacity(65); const Color(0xFFFFFFFF).withOpacity(65);
@ -128,8 +135,9 @@ class AppColors {
static const msgNoticeTextColor = Color.fromRGBO(139, 148, 176, 1); // static const msgNoticeTextColor = Color.fromRGBO(139, 148, 176, 1); //
static const alphaBgViewColor = Color.fromRGBO(0, 0, 0, 0.2); // static const alphaBgViewColor = Color.fromRGBO(0, 0, 0, 0.2); //
static Color openPassageModeColor = const Color(0xFFEB2A3B);// () static Color openPassageModeColor = const Color(0xFFEB2A3B); // ()
static Color listTimeYellowColor = const Color(0xFFF3BA37);// () static Color listTimeYellowColor = const Color(0xFFF3BA37); // ()
static Color get lockDetailBottomBtnUneable => const Color(0xFF808080);// () static Color get lockDetailBottomBtnUneable =>
const Color(0xFF808080); // ()
} }

View File

@ -180,6 +180,7 @@ class BlueManage {
FlutterBluePlus.startScan(timeout: Duration(seconds: timeout)); FlutterBluePlus.startScan(timeout: Duration(seconds: timeout));
Completer<dynamic> completer = Completer<dynamic>(); Completer<dynamic> completer = Completer<dynamic>();
var subscription = FlutterBluePlus.scanResults.listen((results) { var subscription = FlutterBluePlus.scanResults.listen((results) {
Get.log("startScanSingle扫描到的设备:$results");
bool isExit = results.any((element) => element.device.platformName == deviceName); bool isExit = results.any((element) => element.device.platformName == deviceName);
if (isExit) { if (isExit) {
for (var scanResult in results) { for (var scanResult in results) {
@ -442,7 +443,7 @@ class BlueManage {
_subScribeToCharacteristic(BluetoothCharacteristic characteristic) async { _subScribeToCharacteristic(BluetoothCharacteristic characteristic) async {
final subscription = characteristic.onValueReceived.listen((data) { final subscription = characteristic.onValueReceived.listen((data) {
Get.log("启动对特性的通知。当特性的值发生变化时,设备会发送一个通知"); // Get.log("启动对特性的通知。当特性的值发生变化时,设备会发送一个通知");
Get.log("订阅获取的数据:$data"); Get.log("订阅获取的数据:$data");
if (data == lastTimeData || data.isEmpty) { if (data == lastTimeData || data.isEmpty) {
return; return;
@ -455,14 +456,14 @@ class BlueManage {
// //
// //
dataLen = data[8] * 256 + data[9]; // 16 dataLen = data[8] * 256 + data[9]; // 16
// Get.log("dataLen1111:$dataLen getDataLength:${data.length}"); Get.log("dataLen1111:$dataLen getDataLength:${data.length} data:$data");
if (dataLen! + 12 > data.length) { if (dataLen! + 12 > data.length) {
// //
allData.addAll(data); allData.addAll(data);
} else { } else {
// //
allData.addAll(data); allData.addAll(data);
// Get.log("dataLen2222:$dataLen getDataLength:${data.length}"); Get.log("dataLen2222:$dataLen getDataLength:${data.length}");
CommandReciverManager.appDataReceive(allData); CommandReciverManager.appDataReceive(allData);
// //
allData = <int>[]; allData = <int>[];
@ -471,9 +472,9 @@ class BlueManage {
// //
allData.addAll(data); allData.addAll(data);
// var len = allData[8] * 256 + allData[9]; // var len = allData[8] * 256 + allData[9];
// print("dataLen3333:$dataLen"); print("dataLen3333:$dataLen allData.length:${allData.length} allData:$allData");
if ((dataLen! + 14) <= allData.length) { if ((dataLen! + 14) <= allData.length) {
// print("44444数据被解析了"); print("44444数据被解析了");
// //
CommandReciverManager.appDataReceive(allData); CommandReciverManager.appDataReceive(allData);
// //

View File

@ -67,7 +67,7 @@ class CommandReciverManager {
var dataLen = data[8] * 256 + data[9]; // 16 var dataLen = data[8] * 256 + data[9]; // 16
var oriLen = data[10] * 256 + data[11]; // 16 var oriLen = data[10] * 256 + data[11]; // 16
// print("dataLen:$dataLen oriLen:$oriLen"); print("dataLen:$dataLen oriLen:$oriLen");
// List<int> dataList = []; // List<int> dataList = [];
List<int> oriDataList = []; List<int> oriDataList = [];
switch (tmpType) { switch (tmpType) {

View File

@ -18,6 +18,8 @@ class StarLockAMapKey {
const StarLockAMapKey({required this.iosKey, required this.androidKey}); const StarLockAMapKey({required this.iosKey, required this.androidKey});
} }
typedef dynamic fCallFunction();
class F { class F {
static Flavor? appFlavor; static Flavor? appFlavor;
@ -26,6 +28,24 @@ class F {
static String get name => appFlavor?.name ?? ''; static String get name => appFlavor?.name ?? '';
//便
static dynamic sw(
{required fCallFunction defaultCall, fCallFunction? xhjCall}) {
if (xhjCall == null) {
return defaultCall();
}
switch (appFlavor) {
case Flavor.xhj:
return xhjCall();
case Flavor.local:
case Flavor.dev:
case Flavor.pre:
case Flavor.sky:
default:
return defaultCall();
}
}
static bool get debug { static bool get debug {
switch (appFlavor) { switch (appFlavor) {
case Flavor.local: case Flavor.local:
@ -54,7 +74,7 @@ class F {
case Flavor.sky: case Flavor.sky:
return '锁通通'; return '锁通通';
case Flavor.xhj: case Flavor.xhj:
return ''; return '星星';
default: default:
throw Exception('flavor[$name] title not found'); throw Exception('flavor[$name] title not found');
} }
@ -71,7 +91,7 @@ class F {
case Flavor.sky: case Flavor.sky:
return '锁通通'; return '锁通通';
case Flavor.xhj: case Flavor.xhj:
return ''; return '星星';
default: default:
throw Exception('flavor[$name] title not found'); throw Exception('flavor[$name] title not found');
} }
@ -89,7 +109,8 @@ class F {
case Flavor.sky: case Flavor.sky:
return 'https://lock.skychip.top'; return 'https://lock.skychip.top';
case Flavor.xhj: case Flavor.xhj:
return 'https://lock.xhjcn.ltd'; // return 'https://lock.xhjcn.ltd';
return 'https://pre.lock.star-lock.cn';
default: default:
throw Exception('flavor[$name] apiPrefix not found'); throw Exception('flavor[$name] apiPrefix not found');
} }

View File

@ -17,8 +17,11 @@ class StarLockLoginLogic extends BaseGetXController {
final stateMyLogic = Get.put(StarLockMineLogic()).state; final stateMyLogic = Get.put(StarLockMineLogic()).state;
void login() async { void login() async {
var entity = await ApiRepository.to var entity = await ApiRepository.to.login(
.login("1", state.pwd.value, "+86", state.emailOrPhone.value); loginType:"1",
password:state.pwd.value,
countryCode:state.countryCode.value,
username:state.emailOrPhone.value);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
Storage.saveLoginData(entity.data); Storage.saveLoginData(entity.data);
eventBus.fire(MineInfoChangeRefreshUI()); eventBus.fire(MineInfoChangeRefreshUI());

View File

@ -8,6 +8,7 @@ import 'package:star_lock/flavors.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/commonItem.dart';
import '../../tools/tf_loginInput.dart'; import '../../tools/tf_loginInput.dart';
import '../../tools/submitBtn.dart'; import '../../tools/submitBtn.dart';
import '../../tools/titleAppBar.dart'; import '../../tools/titleAppBar.dart';
@ -61,6 +62,28 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
child: Image.asset('images/icon_main_1024.png', child: Image.asset('images/icon_main_1024.png',
width: 110.w, height: 110.w))), width: 110.w, height: 110.w))),
SizedBox(height: 50.w), SizedBox(height: 50.w),
CommonItem(
leftTitel: "${"你所在的".tr}${TranslationLoader.lanKeys!.countryAndRegion!.tr}",
rightTitle: "",
isHaveLine: true,
isPadding: false,
isHaveRightWidget: true,
isHaveDirection: true,
rightWidget: Text(
'${state.countryName.value} +${state.countryCode.value}',
textAlign: TextAlign.end,
style:
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
var result = await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
}
},
),
LoginInput( LoginInput(
controller: state.emailOrPhoneController, controller: state.emailOrPhoneController,
onchangeAction: (v) { onchangeAction: (v) {

View File

@ -5,6 +5,9 @@ class StarLockLoginState {
var passwordShow = true.obs; var passwordShow = true.obs;
var agree = false.obs; var agree = false.obs;
var countryCode = '86'.obs;
var countryName = '中国'.obs;
var emailOrPhone = ''.obs; var emailOrPhone = ''.obs;
var pwd = ''.obs; var pwd = ''.obs;
var canNext = false.obs; var canNext = false.obs;

View File

@ -31,7 +31,7 @@ class StarLockRegisterLogic extends BaseGetXController {
void register() async { void register() async {
var entity = await ApiRepository.to.register( var entity = await ApiRepository.to.register(
receiverType: state.isIphoneType.value == true ? 1 : 2, receiverType: state.isIphoneType.value == true ? 1 : 2,
countryCode: state.countryCode.value, countryCode: int.parse(state.countryCode.value),
account: state.phoneOrEmailStr.value, account: state.phoneOrEmailStr.value,
password: state.pwd.value, password: state.pwd.value,
verificationCode: state.verificationCode.value); verificationCode: state.verificationCode.value);

View File

@ -143,16 +143,15 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
SizedBox(height: 60.h), SizedBox(height: 60.h),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
var result = await Navigator.pushNamed( var result = await Get.toNamed(Routers.selectCountryRegionPage);
context, Routers.selectCountryRegionPage);
if (result != null) { if (result != null) {
result as Map<String, dynamic>; result as Map<String, dynamic>;
state.countryCode.value = result['code']; state.countryCode.value = result['code'];
state.countryName.value = result['countryName']; state.countryName.value = result['countryName'];
} }
// print("路由返回值: ${result}, countryCode:${logic.state.countryCode} ,countryId:${logic.state.countryId}"); Get.log("路由返回值: $result, countryCode:${logic.state.countryCode}");
}, },
child: SizedBox( child: Obx(() => SizedBox(
height: 70.h, height: 70.h,
child: Row( child: Row(
children: [ children: [
@ -165,14 +164,14 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Obx(() => Text( Text(
state.isIphoneType.value state.isIphoneType.value
? '${state.countryName} +${state.countryCode}' ? '${state.countryName.value} +${state.countryCode.value}'
: "${state.countryName}", : state.countryName.value,
textAlign: TextAlign.end, textAlign: TextAlign.end,
style: TextStyle( style: TextStyle(
fontSize: 26.sp, color: AppColors.blackColor), fontSize: 26.sp, color: AppColors.blackColor),
)) )
], ],
), ),
SizedBox(width: 5.w), SizedBox(width: 5.w),
@ -183,7 +182,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
), ),
], ],
), ),
), )),
), ),
Container( Container(
height: 0.5.h, height: 0.5.h,

View File

@ -10,7 +10,7 @@ class StarLockRegisterState {
final TextEditingController sureController = TextEditingController(); final TextEditingController sureController = TextEditingController();
final TextEditingController codeController = TextEditingController(); final TextEditingController codeController = TextEditingController();
var countryCode = 86.obs; var countryCode = "86".obs;
var countryName = '中国'.tr.obs; var countryName = '中国'.tr.obs;
var phoneOrEmailStr = ''.obs; var phoneOrEmailStr = ''.obs;

View File

@ -451,9 +451,7 @@ class LockDetailLogic extends BaseGetXController {
// ); // );
Get.log("openMode:${state.openDoorModel}"); Get.log("openMode:${state.openDoorModel}");
BlueManage() BlueManage().bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (BluetoothConnectionState deviceConnectionState) async {
.bludSendData(state.keyInfos.value.bluetooth!.bluetoothDeviceName!,
(BluetoothConnectionState deviceConnectionState) async {
if (deviceConnectionState == BluetoothConnectionState.connected) { if (deviceConnectionState == BluetoothConnectionState.connected) {
IoSenderManage.senderOpenLock( IoSenderManage.senderOpenLock(
keyID: BlueManage().connectDeviceName, keyID: BlueManage().connectDeviceName,
@ -636,12 +634,16 @@ class LockDetailLogic extends BaseGetXController {
// token // token
void getLockNetToken() async { void getLockNetToken() async {
LockNetTokenEntity entity = await ApiRepository.to LockNetTokenEntity entity = await ApiRepository.to.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
.getLockNetToken(lockId: state.keyInfos.value.lockId.toString());
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.lockNetToken = entity.data!.token!; state.lockNetToken = entity.data!.token!;
Get.log("state.lockNetToken:${state.lockNetToken}"); Get.log("state.lockNetToken:${state.lockNetToken}");
openDoorAction(); openDoorAction();
}else{
showToast("获取联网token失败", something: (){
state.openLockBtnState.value = 0;
cancelBlueConnetctToastTimer();
});
} }
} }
@ -649,7 +651,8 @@ class LockDetailLogic extends BaseGetXController {
void _updateLockUserNo() async { void _updateLockUserNo() async {
LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo( LockNetTokenEntity entity = await ApiRepository.to.updateLockUserNo(
keyId: state.keyInfos.value.keyId.toString(), keyId: state.keyInfos.value.keyId.toString(),
lockUserNo: state.lockUserNo.toString()); lockUserNo: state.lockUserNo.toString()
);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
eventBus.fire(RefreshLockDetailInfoDataEvent()); eventBus.fire(RefreshLockDetailInfoDataEvent());
SchedulerBinding.instance.addPostFrameCallback((_) { SchedulerBinding.instance.addPostFrameCallback((_) {
@ -718,19 +721,16 @@ class LockDetailLogic extends BaseGetXController {
void initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() { void initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction() {
// eventBus // eventBus
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent = state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent =
eventBus eventBus.on<LockSetChangeSetRefreshLockDetailWithType>().listen((event) {
.on<LockSetChangeSetRefreshLockDetailWithType>()
.listen((event) {
if (event.type == 0) { if (event.type == 0) {
// 0 // 0
state.isAttendance.value = int.parse(event.setResult); state.isAttendance.value = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.attendance = state.keyInfos.value.lockSetting!.attendance = int.parse(event.setResult);
int.parse(event.setResult);
} else if (event.type == 1) { } else if (event.type == 1) {
// 1 // 1
state.isOpenLockNeedOnline.value = int.parse(event.setResult); state.isOpenLockNeedOnline.value = int.parse(event.setResult);
state.keyInfos.value.lockSetting!.appUnlockOnline = state.keyInfos.value.lockSetting!.appUnlockOnline = int.parse(event.setResult);
int.parse(event.setResult); state.lockNetToken = "";// token
Get.log( Get.log(
"state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}"); "state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
} else if (event.type == 2) { } else if (event.type == 2) {
@ -858,8 +858,7 @@ class LockDetailLogic extends BaseGetXController {
Future<void> positionPermissionAlert() async { Future<void> positionPermissionAlert() async {
// //
if (Platform.isAndroid) { if (Platform.isAndroid) {
AppFirstEnterHandle() AppFirstEnterHandle().getAppFirstEnter(state.widgetContext, isAgreePosition);
.getAppFirstEnter(state.widgetContext, isAgreePosition);
var getFlag = await Storage.getString(isAgreePosition); var getFlag = await Storage.getString(isAgreePosition);
if (getFlag == isAgreePosition) { if (getFlag == isAgreePosition) {
openBlueSet(); openBlueSet();

View File

@ -33,8 +33,7 @@ class LockDetailPage extends StatefulWidget {
State<LockDetailPage> createState() => _LockDetailPageState(); State<LockDetailPage> createState() => _LockDetailPageState();
} }
class _LockDetailPageState extends State<LockDetailPage> class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStateMixin, RouteAware {
with TickerProviderStateMixin, RouteAware {
// with RouteAware // with RouteAware
final logic = Get.put(LockDetailLogic()); final logic = Get.put(LockDetailLogic());
final state = Get.find<LockDetailLogic>().state; final state = Get.find<LockDetailLogic>().state;
@ -122,8 +121,7 @@ class _LockDetailPageState extends State<LockDetailPage>
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
// signKey // signKey
List<int> signKeyData = List<int> signKeyData = state.keyInfos.value.bluetooth!.signKey!.cast<int>();
state.keyInfos.value.bluetooth!.signKey!.cast<int>();
var saveSignKeyList = changeIntListToStringList(signKeyData); var saveSignKeyList = changeIntListToStringList(signKeyData);
Storage.setStringList(saveBlueSignKey, saveSignKeyList); Storage.setStringList(saveBlueSignKey, saveSignKeyList);

View File

@ -46,6 +46,8 @@ class _EditLockNamePageState extends State<EditLockNamePage> {
controller: state.changeLockNameController, controller: state.changeLockNameController,
leftWidget: const SizedBox(), leftWidget: const SizedBox(),
hintText: "请输入名称".tr, hintText: "请输入名称".tr,
isHaveLeftWidget: true,
isSuffixIcon: true,
inputFormatters: [ inputFormatters: [
LengthLimitingTextInputFormatter(50), LengthLimitingTextInputFormatter(50),
]), ]),

View File

@ -535,7 +535,9 @@ class LockSetLogic extends BaseGetXController {
}); });
} else{ } else{
// //
deletKeyData(); ShowTipView().showIosTipWithContentDialog("是否删除钥匙?".tr, (){
deletKeyData();
});
} }
} }

View File

@ -133,10 +133,11 @@ class LockListLogic extends BaseGetXController{
state.deleteAdministratorIsHaveAllData.value = a; state.deleteAdministratorIsHaveAllData.value = a;
deletKeyData(); deletKeyData();
}); });
// showDeleteAdministratorIsHaveAllDataDialog();
} else{ } else{
// //
deletKeyData(); ShowTipView().showIosTipWithContentDialog("是否删除钥匙?".tr, (){
deletKeyData();
});
} }
} }

View File

@ -22,20 +22,20 @@ import '../lockList/lockList_page.dart';
import 'lockMain_logic.dart'; import 'lockMain_logic.dart';
class StarLockMainPage extends StatefulWidget { class StarLockMainPage extends StatefulWidget {
const StarLockMainPage({Key? key}) : super(key: key); StarLockMainPage({Key? key, this.showAppBar = true, this.showDrawer = true})
: super(key: key);
bool showAppBar;
bool showDrawer;
@override @override
State<StarLockMainPage> createState() => _StarLockMainPageState(); State<StarLockMainPage> createState() => _StarLockMainPageState();
} }
// GlobalKey<_StarLockMainPageState> starLockMainKey = GlobalKey();
class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget { class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
final logic = Get.put(LockMainLogic()); final logic = Get.put(LockMainLogic());
final state = Get.find<LockMainLogic>().state; final state = Get.find<LockMainLogic>().state;
Future<void> getHttpData() async { Future<void> getHttpData() async {
// await logic.getStarLockInfo();
// setState(() {});
logic.getStarLockInfo().then((LockListInfoEntity value) { logic.getStarLockInfo().then((LockListInfoEntity value) {
if (mounted) { if (mounted) {
setState(() {}); setState(() {});
@ -46,7 +46,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance!.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
logic.pageNo = 1; logic.pageNo = 1;
getHttpData(); getHttpData();
}); });
@ -57,60 +57,38 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
@override @override
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
// WidgetsBinding.instance!.addPostFrameCallback((_) {
// getHttpData();
// });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: const Color(0xFFF5F5F5), backgroundColor: const Color(0xFFF5F5F5),
appBar: TitleAppBar( appBar: widget.showAppBar
barTitle: F.navTitle, ? TitleAppBar(
haveBack: false, barTitle: F.navTitle,
haveOtherLeftWidget: true, haveBack: false,
leftWidget: Builder( haveOtherLeftWidget: true,
builder: (context) => IconButton( leftWidget: Builder(
icon: Image.asset( builder: (context) => IconButton(
"images/main/mainLeft_menu_icon.png", icon: Image.asset(
color: Colors.white, "images/main/mainLeft_menu_icon.png",
width: 44.w, color: Colors.white,
height: 44.w, width: 44.w,
), height: 44.w,
onPressed: () { ),
// _globalKey.currentState!.openDrawer(); onPressed: () {
Scaffold.of(context).openDrawer(); Scaffold.of(context).openDrawer();
}, },
)), )),
backgroundColor: AppColors.mainColor, backgroundColor: AppColors.mainColor,
// actionsList: [ )
// TextButton( : null,
// child: const Text("", style: TextStyle(color: Colors.white)), drawer: widget.showDrawer
// onPressed: () { ? Drawer(
// Navigator.pushNamed(context, Routers.starLockLoginPage); width: 1.sw / 3 * 2,
// }, child: const StarLockMinePage(),
// ), )
// ], : null,
),
drawer: Drawer(
width: 1.sw / 3 * 2,
child: const StarLockMinePage(),
),
// body: FutureBuilder<LockListInfoGroupEntity>(
// future: logic.getStarLockInfo(), //
// builder: (BuildContext context, AsyncSnapshot<LockListInfoGroupEntity> snapshot) {
// if (snapshot.connectionState == ConnectionState.waiting) {
// // return CircularProgressIndicator(); //
// return Container();
// } else if (snapshot.hasError) {
// // return Text('Error: ${snapshot.error}'); //
// return unHaveData();
// } else {
// return getDataReturnUI(snapshot.data!.groupList!.length ?? 0); //
// }
// },
// ),
body: EasyRefreshTool( body: EasyRefreshTool(
onRefresh: () { onRefresh: () {
SchedulerBinding.instance.addPostFrameCallback((_) { SchedulerBinding.instance.addPostFrameCallback((_) {
@ -120,13 +98,6 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
}); });
}, },
child: getDataReturnUI(state.dataLength.value)), child: getDataReturnUI(state.dataLength.value)),
// body:smartRefresher(
// logic.refreshController,
// onRefresh:logic.onRefresh,
// onLoading:logic.onLoading,
// child:Obx(() => getDataReturnUI(state.dataLength.value))),
// body: getLockList(),
// body: unHaveData(),
); );
} }
@ -140,11 +111,12 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
case 1: case 1:
// //
Storage.setBool(ifIsDemoModeOrNot, false); Storage.setBool(ifIsDemoModeOrNot, false);
print("state.lockListInfoEntity.value.data!.groupList![0].lockList![0]:${state.lockListInfoGroupEntity.value.groupList![0].lockList![0].endDate}"); print(
"state.lockListInfoEntity.value.data!.groupList![0].lockList![0]:${state.lockListInfoGroupEntity.value.groupList![0].lockList![0].endDate}");
returnWidget = LockDetailPage( returnWidget = LockDetailPage(
isOnlyOneData: true, isOnlyOneData: true,
lockListInfoItemEntity: state lockListInfoItemEntity:
.lockListInfoGroupEntity.value.groupList![0].lockList![0]); state.lockListInfoGroupEntity.value.groupList![0].lockList![0]);
break; break;
case 2: case 2:
// //
@ -156,8 +128,6 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
returnWidget = NoData(); returnWidget = NoData();
break; break;
} }
// Future.delayed(const Duration(seconds: 1));
// Future.delayed(const Duration(milliseconds: 200));
return returnWidget; return returnWidget;
} }
@ -175,12 +145,6 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
children: [ children: [
SizedBox( SizedBox(
width: 330.w, width: 330.w,
// height: 330.w,
// margin: EdgeInsets.only(top: 180.h),
// decoration: BoxDecoration(
// border: Border.all(width: 4.w, color: AppColors.mainColor),
// borderRadius: BorderRadius.circular(110.w),
// ),
child: InkWell( child: InkWell(
child: Padding( child: Padding(
padding: const EdgeInsets.all(30.0), padding: const EdgeInsets.all(30.0),
@ -193,11 +157,8 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
onTap: () { onTap: () {
// //
Navigator.pushNamed( Navigator.pushNamed(
context, Routers.selectLockTypePage, context,
// arguments: { Routers.selectLockTypePage,
// "url": ConstConfig.privacAgreementUrl,
// "title": '隐私政策'
// }
); );
}, },
)), )),
@ -235,10 +196,10 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
void onHide() {} void onHide() {}
late StreamSubscription _teamEvent; late StreamSubscription _teamEvent;
void _initLoadDataAction() { void _initLoadDataAction() {
print("监听刷新首页数据消息"); print("监听刷新首页数据消息");
_teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) { _teamEvent = eventBus.on<RefreshLockListInfoDataEvent>().listen((event) {
// getLockInfo();
logic.pageNo = 1; logic.pageNo = 1;
getHttpData(); getHttpData();
print("收到刷新首页数据消息"); print("收到刷新首页数据消息");

View File

@ -0,0 +1,29 @@
import 'dart:async';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_state.dart';
import 'package:star_lock/tools/baseGetXController.dart';
class LockMainXHJLogic extends BaseGetXController {
final LockMainXHJState state = LockMainXHJState();
void setIndex(int index) {
state.index = index;
update();
}
@override
void onReady() {
super.onReady();
}
@override
void onInit() {
super.onInit();
}
@override
void onClose() {
super.onClose();
}
}

View File

@ -0,0 +1,164 @@
import 'dart:async';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/baseWidget.dart';
import 'package:star_lock/main/lockMian/lockMain/lockMain_page.dart';
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart';
import 'package:star_lock/mine/mall/lockMall_page.dart';
import 'package:star_lock/mine/message/messageList/messageList_page.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
import 'package:star_lock/tools/noData.dart';
import 'package:star_lock/tools/submitBtn.dart';
class StarLockMainXHJPage extends StatefulWidget {
const StarLockMainXHJPage({Key? key}) : super(key: key);
@override
State<StarLockMainXHJPage> createState() => _StarLockMainXHJPageState();
}
class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
with BaseWidget {
@override
void initState() {
super.initState();
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
}
@override
Widget build(BuildContext context) {
return GetBuilder<LockMainXHJLogic>(
init: LockMainXHJLogic(),
builder: (LockMainXHJLogic logic) {
return Scaffold(
backgroundColor: const Color(0xFFF5F5F5),
body: SafeArea(
bottom: false,
child: Stack(
children: [
pageView(
widget: StarLockMainPage(
showAppBar: false,
showDrawer: false,
),
logic: logic,
index: 0,
),
pageView(
widget: MessageListPage(
showAppBar: false,
),
logic: logic,
index: 1),
pageView(
widget: LockMallPage(
showAppBar: false,
),
logic: logic,
index: 2),
pageView(
widget: MinePersonInfoPage(
showAppBar: false,
),
logic: logic,
index: 3),
],
),
),
bottomNavigationBar: Container(
height: 100.h + Get.bottomBarHeight,
decoration: const BoxDecoration(
color: Colors.transparent,
border: Border(
top: BorderSide(
color: Colors.black, //
width: 0.3, //
),
),
),
child: Row(
children: [
// navigationBarItem(Icons.start, '场景', false, () {
// logic.setIndex(0);
// }),
navigationBarItem(Icons.devices, '设备', logic, 0, () {
logic.setIndex(0);
}),
navigationBarItem(Icons.message, '消息', logic, 1, () {
logic.setIndex(1);
}),
navigationBarItem(Icons.shopping_cart, '商城', logic, 2, () {
logic.setIndex(2);
}),
navigationBarItem(Icons.account_circle, '我的', logic, 3, () {
logic.setIndex(3);
}),
],
),
),
);
});
}
//
Widget pageView(
{required Widget widget,
required LockMainXHJLogic logic,
required int index}) {
return Positioned.fill(
child: Offstage(
offstage: logic.state.index != index,
child: widget,
),
);
}
//
Widget navigationBarItem(IconData icon, String text, LockMainXHJLogic logic,
int index, var onTop) {
bool check = logic.state.index == index;
return Expanded(
child: GestureDetector(
onTap: onTop,
child: Container(
color: Colors.transparent,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: EdgeInsets.only(bottom: 8.h),
child: Icon(
icon,
size: 32.r,
color:
check ? AppColors.mainColor : AppColors.darkGrayTextColor,
),
),
Text(
text,
style: TextStyle(
fontSize: 16.sp,
color:
check ? AppColors.mainColor : AppColors.darkGrayTextColor,
),
),
],
),
),
),
);
}
@override
void dispose() {
super.dispose();
}
}

View File

@ -0,0 +1,9 @@
import 'dart:async';
import 'package:get/get.dart';
class LockMainXHJState {
int index = 0;
}

View File

@ -1,6 +1,5 @@
import 'dart:async'; import 'dart:async';
// import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/blue/io_protocol/io_getPrivateKey.dart'; import 'package:star_lock/blue/io_protocol/io_getPrivateKey.dart';
@ -28,7 +27,6 @@ class NearbyLockLogic extends BaseGetXController {
IoSenderManage.getPublicKey(lockId: deviceName); IoSenderManage.getPublicKey(lockId: deviceName);
}else if (state == BluetoothConnectionState.disconnected) { }else if (state == BluetoothConnectionState.disconnected) {
dismissEasyLoading(); dismissEasyLoading();
// showBlueConnetctToast();
} }
}, isAddEquipment: true); }, isAddEquipment: true);
} }
@ -36,8 +34,7 @@ class NearbyLockLogic 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) {
if (reply is GetPublicKeyReply) { if (reply is GetPublicKeyReply) {
_replyGetPublicKey(reply); _replyGetPublicKey(reply);
} }
@ -58,7 +55,7 @@ class NearbyLockLogic extends BaseGetXController {
switch (reply.status) { switch (reply.status) {
case 0x00: case 0x00:
// //
print("获取公钥成功"); Get.log("获取公钥成功");
// //
var publicKey = reply.data.sublist(3); var publicKey = reply.data.sublist(3);
var saveStrList = changeIntListToStringList(publicKey); var saveStrList = changeIntListToStringList(publicKey);
@ -75,15 +72,15 @@ class NearbyLockLogic extends BaseGetXController {
break; break;
case 0x07: case 0x07:
// //
print("获取公钥无权限"); Get.log("获取公钥无权限");
break; break;
case 0x0f: case 0x0f:
// //
print("获取公钥用户已存在"); Get.log("获取公钥用户已存在");
break; break;
default: default:
// //
print("获取公钥失败"); Get.log("获取公钥失败");
break; break;
} }
} }
@ -92,19 +89,19 @@ class NearbyLockLogic extends BaseGetXController {
switch (reply.status) { switch (reply.status) {
case 0x00: case 0x00:
// //
print('获取私钥成功'); Get.log('获取私钥成功');
reply.data.removeAt(0); reply.data.removeAt(0);
print("reply.data:${reply.data}"); Get.log("reply.data:${reply.data}");
// //
List<int> privateKey = reply.data.sublist(0, 16); List<int> privateKey = reply.data.sublist(0, 16);
print("privateKey:$privateKey"); Get.log("privateKey:$privateKey");
var savePrivateKeyList = changeIntListToStringList(privateKey); var savePrivateKeyList = changeIntListToStringList(privateKey);
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
// signKey // signKey
List<int> signKey = reply.data.sublist(16, 32); List<int> signKey = reply.data.sublist(16, 32);
print("signKey:$signKey"); Get.log("signKey:$signKey");
var saveSignKeyList = changeIntListToStringList(signKey); var saveSignKeyList = changeIntListToStringList(signKey);
Storage.setStringList(saveBlueSignKey, saveSignKeyList); Storage.setStringList(saveBlueSignKey, saveSignKeyList);
@ -114,23 +111,21 @@ class NearbyLockLogic extends BaseGetXController {
(0xff & timestamp[1]) << 16 | (0xff & timestamp[1]) << 16 |
(0xff & timestamp[2]) << 8 | (0xff & timestamp[2]) << 8 |
(0xFF & timestamp[3])); (0xFF & timestamp[3]));
// String timestampValueStr = DateTool().dateToYMDHNSString(timestampValue.toString());
// print("timestamp:$timestamp timestampValue:$timestampValue timestampValueStr:$timestampValueStr");
_getStarLockStatus(); _getStarLockStatus();
break; break;
case 0x07: case 0x07:
// //
print('获取私钥无权限'); Get.log('获取私钥无权限');
break; break;
case 0x0f: case 0x0f:
// //
print('获取私钥:用户已存在'); Get.log('获取私钥:用户已存在');
break; break;
default: default:
// //
print('获取私钥失败'); Get.log('获取私钥失败');
break; break;
} }
} }
@ -145,63 +140,62 @@ class NearbyLockLogic extends BaseGetXController {
// //
var vendor = reply.data.sublist(3, 23); var vendor = reply.data.sublist(3, 23);
print("vendor:$vendor reply.data:${reply.data}"); Get.log("vendor:$vendor reply.data:${reply.data}");
var vendorStr = utf8String(vendor); var vendorStr = utf8String(vendor);
state.lockInfo["vendor"] = vendorStr; state.lockInfo["vendor"] = vendorStr;
// print("vendor:$vendor vendorStr:$vendorStr vendorStr.length${vendorStr.length}");
// //
var product = reply.data[23]; var product = reply.data[23];
state.lockInfo["product"] = product; state.lockInfo["product"] = product;
// print("product:$product"); // Get.log("product:$product");
// //
var model = reply.data.sublist(24, 44); var model = reply.data.sublist(24, 44);
var modelStr = utf8String(model); var modelStr = utf8String(model);
state.lockInfo["model"] = modelStr; state.lockInfo["model"] = modelStr;
// print("model:$model modelStr:$modelStr modelStr:${modelStr.length}"); // Get.log("model:$model modelStr:$modelStr modelStr:${modelStr.length}");
// //
var fwVersion = reply.data.sublist(44, 64); var fwVersion = reply.data.sublist(44, 64);
var fwVersionStr = utf8String(fwVersion); var fwVersionStr = utf8String(fwVersion);
state.lockInfo["fwVersion"] = fwVersionStr; state.lockInfo["fwVersion"] = fwVersionStr;
// print("fwVersion:$fwVersion fwVersionStr:$fwVersionStr fwVersionStr:${fwVersionStr.length}"); // Get.log("fwVersion:$fwVersion fwVersionStr:$fwVersionStr fwVersionStr:${fwVersionStr.length}");
// //
var hwVersion = reply.data.sublist(64, 84); var hwVersion = reply.data.sublist(64, 84);
var hwVersionStr = utf8String(hwVersion); var hwVersionStr = utf8String(hwVersion);
state.lockInfo["hwVersion"] = hwVersionStr; state.lockInfo["hwVersion"] = hwVersionStr;
// print("hwVersion:$hwVersion hwVersionStr:${hwVersionStr.length}"); // Get.log("hwVersion:$hwVersion hwVersionStr:${hwVersionStr.length}");
// //
var serialNum0 = reply.data.sublist(84, 100); var serialNum0 = reply.data.sublist(84, 100);
var serialNum0Str = utf8String(serialNum0); var 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}";
print("serialNum0Str:$serialNum0Str serialNum0Str:${serialNum0Str.length}"); Get.log("serialNum0Str:$serialNum0Str serialNum0Str:${serialNum0Str.length}");
// //
var serialNum1 = reply.data.sublist(100, 116); var serialNum1 = reply.data.sublist(100, 116);
var serialNum1Str = utf8String(serialNum1); var serialNum1Str = utf8String(serialNum1);
state.lockInfo["serialNum1"] = serialNum1Str; state.lockInfo["serialNum1"] = serialNum1Str;
// print("serialNum1Str:$serialNum1Str serialNum1Str:${serialNum1Str.length}"); // Get.log("serialNum1Str:$serialNum1Str serialNum1Str:${serialNum1Str.length}");
// //
var btDeviceName = reply.data.sublist(116, 132); var btDeviceName = reply.data.sublist(116, 132);
var btDeviceNameStr = utf8String(btDeviceName); var btDeviceNameStr = utf8String(btDeviceName);
state.lockInfo["btDeviceName"] = btDeviceNameStr; state.lockInfo["btDeviceName"] = btDeviceNameStr;
// print("btDeviceName:$btDeviceName btDeviceNameStr:$btDeviceNameStr btDeviceNameStr:${btDeviceNameStr.length}"); // Get.log("btDeviceName:$btDeviceName btDeviceNameStr:$btDeviceNameStr btDeviceNameStr:${btDeviceNameStr.length}");
// //
var battRemCap = reply.data[132]; var battRemCap = reply.data[132];
state.lockInfo["electricQuantity"] = battRemCap; state.lockInfo["electricQuantity"] = battRemCap;
// print("battRemCap:$battRemCap"); // Get.log("battRemCap:$battRemCap");
// //
var restoreCounter = reply.data.sublist(133, 135); var restoreCounter = reply.data.sublist(133, 135);
state.lockInfo["restoreCount"] = state.lockInfo["restoreCount"] =
restoreCounter[0] * 256 + restoreCounter[1]; restoreCounter[0] * 256 + restoreCounter[1];
// print("restoreCounter:$restoreCounter"); // Get.log("restoreCounter:$restoreCounter");
// //
var restoreDate = reply.data.sublist(135, 139); var restoreDate = reply.data.sublist(135, 139);
@ -211,13 +205,13 @@ class NearbyLockLogic extends BaseGetXController {
(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;
// print("restoreDate:$restoreDate restoreDateValue:$restoreDateValue"); // Get.log("restoreDate:$restoreDate restoreDateValue:$restoreDateValue");
// //
var icPartNo = reply.data.sublist(139, 149); var icPartNo = reply.data.sublist(139, 149);
var icPartNoStr = utf8String(icPartNo); var icPartNoStr = utf8String(icPartNo);
state.lockInfo["icPartNo"] = icPartNoStr; state.lockInfo["icPartNo"] = icPartNoStr;
// print("icPartNo:$icPartNo icPartNoStr:$icPartNoStr"); // Get.log("icPartNo:$icPartNo icPartNoStr:$icPartNoStr");
// //
var indate = reply.data.sublist(149, 153); var indate = reply.data.sublist(149, 153);
@ -227,13 +221,13 @@ class NearbyLockLogic extends BaseGetXController {
(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;
// print("indate:$indate indateValue:$indateValue"); // Get.log("indate:$indate indateValue:$indateValue");
// mac地址 // mac地址
var macAddress = reply.data.sublist(153, 173); var macAddress = reply.data.sublist(153, 173);
var macAddressStr = utf8String(macAddress); var macAddressStr = utf8String(macAddress);
state.lockInfo["mac"] = macAddressStr; state.lockInfo["mac"] = macAddressStr;
print("macAddress:$macAddress macAddressStr:$macAddressStr"); Get.log("macAddress:$macAddress macAddressStr:$macAddressStr");
var index = 173; var index = 173;
// //
@ -249,7 +243,7 @@ class NearbyLockLogic extends BaseGetXController {
String featureValueStr = asciiString(featureValue); String featureValueStr = asciiString(featureValue);
state.featureValue = featureValueStr; state.featureValue = featureValueStr;
// List allFeatureValueTwoList = charListChangeIntList(featureValue); // List allFeatureValueTwoList = charListChangeIntList(featureValue);
// print("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr"); // Get.log("featureValueLength:$featureValueLength featureValue:$featureValue \n featureValueStr:$featureValueStr");
index = index + featureValueLength + 1; index = index + featureValueLength + 1;
// 使 // 使
@ -264,7 +258,7 @@ class NearbyLockLogic extends BaseGetXController {
String featureEnValStr = asciiString(featureEnVal); String featureEnValStr = asciiString(featureEnVal);
state.featureSettingValue = featureEnValStr; state.featureSettingValue = featureEnValStr;
// List allFeatureEnValTwoList = charListChangeIntList(featureEnVal); // List allFeatureEnValTwoList = charListChangeIntList(featureEnVal);
// print("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr"); // Get.log("featureEnValLength:$featureEnValLength featureEnVal:$featureEnVal \n featureEnValStr:$featureEnValStr");
index = index + featureEnValLength + 1; index = index + featureEnValLength + 1;
// //
@ -272,7 +266,7 @@ class NearbyLockLogic extends BaseGetXController {
var featureParaTotalList = reply.data.sublist(index); var featureParaTotalList = reply.data.sublist(index);
state.featureSettingParams = featureParaTotalList; state.featureSettingParams = featureParaTotalList;
// print("featureParaTotalList:$featureParaTotalList"); // Get.log("featureParaTotalList:$featureParaTotalList");
Get.toNamed(Routers.lockAddressGaoDePage, arguments: { Get.toNamed(Routers.lockAddressGaoDePage, arguments: {
"pwdTimestamp": state.timestampValue * 1000, "pwdTimestamp": state.timestampValue * 1000,
@ -285,23 +279,19 @@ class NearbyLockLogic extends BaseGetXController {
break; break;
case 0x06: case 0x06:
// //
print("${reply.commandType}需要鉴权"); Get.log("${reply.commandType}需要鉴权");
break; break;
case 0x07: case 0x07:
// //
print("${reply.commandType}用户无权限"); Get.log("${reply.commandType}用户无权限");
break; break;
case 0x09: case 0x09:
// //
print("${reply.commandType}权限校验错误"); Get.log("${reply.commandType}权限校验错误");
break; break;
default: default:
// //
print("${reply.commandType}失败"); Get.log("${reply.commandType}失败");
break; break;
} }
} }

View File

@ -7,7 +7,8 @@ import 'package:star_lock/tools/titleAppBar.dart';
import 'package:webview_flutter/webview_flutter.dart'; import 'package:webview_flutter/webview_flutter.dart';
class LockMallPage extends StatefulWidget { class LockMallPage extends StatefulWidget {
const LockMallPage({Key? key}) : super(key: key); LockMallPage({Key? key, this.showAppBar = true}) : super(key: key);
bool showAppBar;
@override @override
State<LockMallPage> createState() => _LockMallPageState(); State<LockMallPage> createState() => _LockMallPageState();
@ -33,11 +34,13 @@ class _LockMallPageState extends State<LockMallPage> {
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF), backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar( appBar: widget.showAppBar
barTitle: getWebTitle(), ? TitleAppBar(
haveBack: true, barTitle: getWebTitle(),
backgroundColor: AppColors.mainColor, haveBack: true,
), backgroundColor: AppColors.mainColor,
)
: null,
body: Obx(() => Column( body: Obx(() => Column(
children: <Widget>[ children: <Widget>[
Container( Container(
@ -45,7 +48,8 @@ class _LockMallPageState extends State<LockMallPage> {
child: LinearProgressIndicator( child: LinearProgressIndicator(
value: state.webProgress.value, value: state.webProgress.value,
backgroundColor: Colors.grey, backgroundColor: Colors.grey,
valueColor: AlwaysStoppedAnimation<Color>(AppColors.mainColor), valueColor:
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
), ),
), ),
Expanded( Expanded(

View File

@ -14,18 +14,20 @@ import 'messageList_logic.dart';
import 'package:flutter_slidable/flutter_slidable.dart'; import 'package:flutter_slidable/flutter_slidable.dart';
class MessageListPage extends StatefulWidget { class MessageListPage extends StatefulWidget {
const MessageListPage({Key? key}) : super(key: key); MessageListPage({Key? key, this.showAppBar = true}) : super(key: key);
bool showAppBar;
@override @override
State<MessageListPage> createState() => _MessageListPageState(); State<MessageListPage> createState() => _MessageListPageState();
} }
class _MessageListPageState extends State<MessageListPage> with TickerProviderStateMixin { class _MessageListPageState extends State<MessageListPage>
with TickerProviderStateMixin {
final logic = Get.put(MessageListLogic()); final logic = Get.put(MessageListLogic());
final state = Get.find<MessageListLogic>().state; final state = Get.find<MessageListLogic>().state;
void getHttpData(){ void getHttpData() {
logic.messageListDataRequest().then((MessageListEntity value){ logic.messageListDataRequest().then((MessageListEntity value) {
setState(() {}); setState(() {});
}); });
} }
@ -41,58 +43,61 @@ class _MessageListPageState extends State<MessageListPage> with TickerProviderSt
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: widget.showAppBar
barTitle: TranslationLoader.lanKeys!.message!.tr, ? TitleAppBar(
haveBack: true, barTitle: TranslationLoader.lanKeys!.message!.tr,
backgroundColor: AppColors.mainColor), haveBack: true,
body: EasyRefreshTool( backgroundColor: AppColors.mainColor)
onRefresh: (){ : null,
logic.pageNo = 1; body: EasyRefreshTool(onRefresh: () {
getHttpData(); logic.pageNo = 1;
}, getHttpData();
onLoad: (){ }, onLoad: () {
getHttpData(); getHttpData();
}, }, child: Obx(() {
child: Obx(() { return state.itemDataList.value.isEmpty
return state.itemDataList.value.isEmpty ? NoData()
? NoData() : SlidableAutoCloseBehavior(
: SlidableAutoCloseBehavior( child: ListView.builder(
child: ListView.builder( itemCount: state.itemDataList.value.length,
itemCount: state.itemDataList.value.length, itemBuilder: (c, index) {
itemBuilder: (c, index) { MessageItemEntity messageItemEntity =
MessageItemEntity messageItemEntity = state.itemDataList.value[index]; state.itemDataList.value[index];
return Slidable( return Slidable(
key:ValueKey(messageItemEntity.id), key: ValueKey(messageItemEntity.id),
endActionPane: ActionPane( endActionPane: ActionPane(
extentRatio: 0.2, extentRatio: 0.2,
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: [
SlidableAction( SlidableAction(
onPressed: (BuildContext context){ onPressed: (BuildContext context) {
logic.deletMessageDataRequest(messageItemEntity.id!, (){ logic.deletMessageDataRequest(
logic.pageNo = 1; messageItemEntity.id!, () {
getHttpData(); logic.pageNo = 1;
}); getHttpData();
}, });
backgroundColor: Colors.red, },
foregroundColor: Colors.white, backgroundColor: Colors.red,
label: '删除', foregroundColor: Colors.white,
padding: EdgeInsets.only(left: 5.w, right: 5.w), label: '删除',
), padding: EdgeInsets.only(left: 5.w, right: 5.w),
], ),
), ],
child: _messageListItem(messageItemEntity, () { ),
Get.toNamed(Routers.messageDetailPage, arguments: {"messageItemEntity": messageItemEntity}); child: _messageListItem(messageItemEntity, () {
}), Get.toNamed(Routers.messageDetailPage, arguments: {
); "messageItemEntity": messageItemEntity
}), });
); }),
}) );
), }),
);
})),
); );
} }
Widget _messageListItem(MessageItemEntity messageItemEntity, Function() action) { Widget _messageListItem(
MessageItemEntity messageItemEntity, Function() action) {
return GestureDetector( return GestureDetector(
onTap: action, onTap: action,
child: Container( child: Container(
@ -117,7 +122,10 @@ class _MessageListPageState extends State<MessageListPage> with TickerProviderSt
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
fontSize: 22.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor), fontSize: 22.sp,
color: messageItemEntity.readAt! == 0
? AppColors.blackColor
: AppColors.placeholderTextColor),
), ),
), ),
], ],
@ -128,7 +136,14 @@ class _MessageListPageState extends State<MessageListPage> with TickerProviderSt
children: [ children: [
// Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 40.w, height: 40.w,), // Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 40.w, height: 40.w,),
// SizedBox(width: 10.w,), // SizedBox(width: 10.w,),
Text(DateTool().dateToYMDHNString(messageItemEntity.createdAt!.toString()), style: TextStyle(fontSize: 18.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor)), Text(
DateTool().dateToYMDHNString(
messageItemEntity.createdAt!.toString()),
style: TextStyle(
fontSize: 18.sp,
color: messageItemEntity.readAt! == 0
? AppColors.blackColor
: AppColors.placeholderTextColor)),
], ],
), ),
SizedBox(width: 20.h), SizedBox(width: 20.h),

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:get/get.dart'; import 'package:get/get.dart';

View File

@ -51,7 +51,7 @@ class MineBindPhoneOrEmailLogic extends BaseGetXController {
state.verificationCode.value, state.verificationCode.value,
state.unbindToken.value); state.unbindToken.value);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("邮箱绑定成功", something: () async { showToast("邮箱绑定成功".tr, something: () async {
final loginData = await Storage.getLoginData(); final loginData = await Storage.getLoginData();
loginData!.email = state.inputAccount.value; loginData!.email = state.inputAccount.value;
Storage.saveLoginData(loginData); Storage.saveLoginData(loginData);
@ -69,7 +69,7 @@ class MineBindPhoneOrEmailLogic extends BaseGetXController {
state.verificationCode.value, state.verificationCode.value,
state.unbindToken.value); state.unbindToken.value);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast("手机绑定成功", something: () async { showToast("手机绑定成功".tr, something: () async {
final loginData = await Storage.getLoginData(); final loginData = await Storage.getLoginData();
loginData!.mobile = state.inputAccount.value; loginData!.mobile = state.inputAccount.value;
Storage.saveLoginData(loginData); Storage.saveLoginData(loginData);

View File

@ -4,7 +4,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_logic.dart';
import '../../../appRouters.dart';
import '../../../app_settings/app_colors.dart'; import '../../../app_settings/app_colors.dart';
import '../../../tools/commonItem.dart';
import '../../../tools/submitBtn.dart'; import '../../../tools/submitBtn.dart';
import '../../../tools/tf_loginInput.dart'; import '../../../tools/tf_loginInput.dart';
import '../../../tools/titleAppBar.dart'; import '../../../tools/titleAppBar.dart';
@ -33,6 +35,7 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
haveBack: true, haveBack: true,
backgroundColor: AppColors.mainColor), backgroundColor: AppColors.mainColor),
body: Container( body: Container(
color: Colors.white,
padding: EdgeInsets.only(top: 10.h, left: 30.w, right: 30.w), padding: EdgeInsets.only(top: 10.h, left: 30.w, right: 30.w),
child: Column( child: Column(
children: [ children: [
@ -45,6 +48,28 @@ class _MineBindPhoneOrEmailPageState extends State<MineBindPhoneOrEmailPage> {
: TranslationLoader.lanKeys!.changeEmailTip!.tr, : TranslationLoader.lanKeys!.changeEmailTip!.tr,
style: TextStyle(fontSize: 20.sp), style: TextStyle(fontSize: 20.sp),
)), )),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: "",
isHaveLine: true,
isPadding: false,
isHaveRightWidget: true,
isHaveDirection: true,
rightWidget: Text(
'${state.countryName.value} +${state.countryCode.value}',
textAlign: TextAlign.end,
style:
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
),
action: () async {
var result = await Get.toNamed(Routers.selectCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
}
},
),
LoginInput( LoginInput(
controller: state.accountController, controller: state.accountController,
isPwd: false, isPwd: false,

View File

@ -10,11 +10,12 @@ class MineBindPhoneOrEmailState {
return DateTime.now().millisecondsSinceEpoch; return DateTime.now().millisecondsSinceEpoch;
} }
var countryCode = '+86'.obs; var countryCode = '86'.obs;
var countryName = '中国'.obs;
var countryId = '9'.obs; var countryId = '9'.obs;
var codeType = '4'.obs; //123456 7 var codeType = '4'.obs; //123456 7
var channel = '1'.obs; // 1 2 var channel = '1'.obs; // 1 2
var uniqueid = 'B748F838-94EE-4BDB-A0E6-7B2D16849792'.obs;
var verificationCode = ''.obs; var verificationCode = ''.obs;
var xWidth = ''.obs; // var xWidth = ''.obs; //
var canSub = false.obs; var canSub = false.obs;

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:get/get.dart'; import 'package:get/get.dart';
@ -14,7 +13,8 @@ import '../../../tools/titleAppBar.dart';
import '../../../translations/trans_lib.dart'; import '../../../translations/trans_lib.dart';
class MinePersonInfoPage extends StatefulWidget { class MinePersonInfoPage extends StatefulWidget {
const MinePersonInfoPage({Key? key}) : super(key: key); MinePersonInfoPage({Key? key, this.showAppBar = true}) : super(key: key);
bool showAppBar;
@override @override
State<MinePersonInfoPage> createState() => _MinePersonInfoPageState(); State<MinePersonInfoPage> createState() => _MinePersonInfoPageState();
@ -28,34 +28,43 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: AppColors.mainBackgroundColor, backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar( appBar: widget.showAppBar
barTitle: TranslationLoader.lanKeys!.personalInformation!.tr, ? TitleAppBar(
haveBack: true, barTitle: TranslationLoader.lanKeys!.personalInformation!.tr,
backgroundColor: AppColors.mainColor), haveBack: true,
backgroundColor: AppColors.mainColor)
: null,
body: Column( body: Column(
children: [ children: [
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.avatar!.tr, leftTitel: TranslationLoader.lanKeys!.avatar!.tr,
rightTitle: "", rightTitle: "",
allHeight: 100.h, allHeight: 100.h,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
isHaveRightWidget: true, isHaveRightWidget: true,
rightWidget: ClipRRect( rightWidget: ClipRRect(
borderRadius: BorderRadius.circular(36.w), borderRadius: BorderRadius.circular(36.w),
child: CustomNetworkImage(url:state.headUrl.value, defaultUrl: 'images/controls_user.png', width:72.w, height:72.w), child: CustomNetworkImage(
), url: state.headUrl.value,
action: () async { defaultUrl: 'images/controls_user.png',
_openModalBottomSheet(); width: 72.w,
}, height: 72.w),
)), ),
action: () async {
_openModalBottomSheet();
},
)),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.nickName!.tr, leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.mineInfoData.value.nickname != null ? state.mineInfoData.value.nickname! : "", rightTitle: state.mineInfoData.value.nickname != null
? state.mineInfoData.value.nickname!
: "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed(context, Routers.minePersonInfoEditNamePage, Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage,
arguments: {'mineInfoData': state.mineInfoData.value}) arguments: {'mineInfoData': state.mineInfoData.value})
.then((value) => logic.getUserInfoRequest()); .then((value) => logic.getUserInfoRequest());
})), })),
@ -69,13 +78,18 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
action: () { action: () {
// isFrom1 2 // isFrom1 2
if (state.mineInfoData.value.mobile!.isNotEmpty) { if (state.mineInfoData.value.mobile!.isNotEmpty) {
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage, Navigator.pushNamed(
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'}) context, Routers.mineUnbindPhoneOrEmailPage,
.then((value) => logic.getUserInfoRequest()); arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage, Navigator.pushNamed(
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'}) context, Routers.mineBindPhoneOrEmailPage, arguments: {
.then((value) => logic.getUserInfoRequest()); 'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
} }
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
@ -88,13 +102,18 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
action: () { action: () {
// isFrom1 2 // isFrom1 2
if (state.mineInfoData.value.email!.isNotEmpty) { if (state.mineInfoData.value.email!.isNotEmpty) {
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage, Navigator.pushNamed(
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!}) context, Routers.mineUnbindPhoneOrEmailPage,
.then((value) => logic.getUserInfoRequest()); arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage, Navigator.pushNamed(
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!}) context, Routers.mineBindPhoneOrEmailPage, arguments: {
.then((value) => logic.getUserInfoRequest()); 'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
} }
})), })),
CommonItem( CommonItem(
@ -103,24 +122,30 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Navigator.pushNamed(context, Routers.minePersonInfoResetPasswordPage); Navigator.pushNamed(
context, Routers.minePersonInfoResetPasswordPage);
}), }),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr, leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "", rightTitle:
state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) { if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed(context, Routers.minePersonInfoSetSafetyProblemPage) Navigator.pushNamed(
context, Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest()); .then((value) => logic.getUserInfoRequest());
} else { } else {
Navigator.pushNamed(context, Routers.minePersonInfoViewSafetyProblemPage); Navigator.pushNamed(
context, Routers.minePersonInfoViewSafetyProblemPage);
} }
})), })),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr, leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null ? state.mineInfoData.value.countryName! : "", rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName!
: "",
isHaveLine: false, isHaveLine: false,
isHaveDirection: false)), isHaveDirection: false)),
], ],
@ -152,7 +177,8 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> {
Future _openModalBottomSheet() async { Future _openModalBottomSheet() async {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
shape: RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.circular(10)), shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertBottomWidget( return AlertBottomWidget(
topTitle: '', topTitle: '',

View File

@ -40,7 +40,7 @@ class _GroupEditLockPageState extends State<GroupEditLockPage> {
), ),
), ),
Expanded(child: _buildMainUI()), Expanded(child: _buildMainUI()),
SubmitBtn(btnName: TranslationLoader.lanKeys!.send!.tr, onClick: () async { SubmitBtn(btnName: TranslationLoader.lanKeys!.sure!.tr, onClick: () async {
var idList = []; var idList = [];
for(int i = 0; i<state.lockList.length; i++){ for(int i = 0; i<state.lockList.length; i++){
LockListItem lockListItem = state.lockList[i]; LockListItem lockListItem = state.lockList[i];

View File

@ -10,7 +10,6 @@ import '../../../../../../tools/titleAppBar.dart';
import '../../../../../../translations/trans_lib.dart'; import '../../../../../../translations/trans_lib.dart';
import '../../../../appRouters.dart'; import '../../../../appRouters.dart';
import '../../../../tools/custom_bottom_sheet.dart'; import '../../../../tools/custom_bottom_sheet.dart';
import '../../../../tools/jh_pop_menus.dart';
class LockItemListPage extends StatefulWidget { class LockItemListPage extends StatefulWidget {
const LockItemListPage({Key? key}) : super(key: key); const LockItemListPage({Key? key}) : super(key: key);

View File

@ -308,33 +308,33 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
} }
// //
void _showDialog(widgetContext) { // void _showDialog(widgetContext) {
showCupertinoDialog( // showCupertinoDialog(
context: widgetContext, // context: widgetContext,
builder: (context) { // builder: (context) {
return CupertinoAlertDialog( // return CupertinoAlertDialog(
title: Text(TranslationLoader.lanKeys!.deleteAccountTips!.tr), // title: Text(TranslationLoader.lanKeys!.deleteAccountTips!.tr),
actions: [ // actions: [
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr), // child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () { // onPressed: () {
Navigator.of(context).pop(); // Navigator.of(context).pop();
}, // },
), // ),
CupertinoDialogAction( // CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.sure!.tr), // child: Text(TranslationLoader.lanKeys!.sure!.tr),
onPressed: () { // onPressed: () {
Get.back(); // Get.back();
// // //
Get.toNamed(Routers.safeVerifyPage); // Get.toNamed(Routers.safeVerifyPage);
setState(() {}); // setState(() {});
}, // },
), // ),
], // ],
); // );
}, // },
); // );
} // }
// void showLoginOutAlertTipDialog() { // void showLoginOutAlertTipDialog() {
// showCupertinoDialog( // showCupertinoDialog(

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:star_lock/mine/mine/starLockMine_page.dart'; import 'package:star_lock/mine/mine/starLockMine_page.dart';
@ -16,7 +15,7 @@ class NavPages extends StatefulWidget {
class _NavPagesState extends State<NavPages> { class _NavPagesState extends State<NavPages> {
int _currentIndex = 0; int _currentIndex = 0;
final List<Widget> _listPage = [ final List<Widget> _listPage = [
const StarLockMainPage(), StarLockMainPage(),
// StarLockMinePage(key: starLockMineKey), // StarLockMinePage(key: starLockMineKey),
]; ];

View File

@ -52,11 +52,11 @@ class BaseProvider extends GetConnect with Api {
// print('res.body======>${res.body}'); // print('res.body======>${res.body}');
if (res.body == null) { if (res.body == null) {
if (EasyLoading.isShow) await EasyLoading.dismiss(animation: true); if (EasyLoading.isShow) await EasyLoading.dismiss(animation: true);
EasyLoading.showToast("数据请求失败", duration: 2000.milliseconds); EasyLoading.showToast("网络访问失败,请检查网络是否正常".tr, duration: 2000.milliseconds);
// EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
if (res.statusCode == null) { // if (res.statusCode == null) {
EasyLoading.showToast("Network Error!", duration: 2000.milliseconds); // EasyLoading.showToast("Network Error!", duration: 2000.milliseconds);
} // }
var rs = { var rs = {
"errorMsg": "Network Error!", "errorMsg": "Network Error!",
"errorCode": -1, "errorCode": -1,

View File

@ -100,8 +100,13 @@ class ApiRepository {
} }
// //
Future<LoginEntity> login(String loginType, String password, Future<LoginEntity> login(
String countryCode, String username) async { {
required String loginType,
required String password,
required String countryCode,
required String username
}) async {
final res = final res =
await apiProvider.login(loginType, password, countryCode, username); await apiProvider.login(loginType, password, countryCode, username);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
@ -269,8 +274,7 @@ class ApiRepository {
} }
// NO // NO
Future<LockNetTokenEntity> updateLockUserNo( Future<LockNetTokenEntity> updateLockUserNo({required String keyId, required String lockUserNo}) async {
{required String keyId, required String lockUserNo}) async {
final res = await apiProvider.updateLockUserNo(keyId, lockUserNo); final res = await apiProvider.updateLockUserNo(keyId, lockUserNo);
return LockNetTokenEntity.fromJson(res.body); return LockNetTokenEntity.fromJson(res.body);
} }

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/login/login/starLock_login_page.dart'; import 'package:star_lock/login/login/starLock_login_page.dart';
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart';
import 'package:star_lock/tools/appFirstEnterHandle.dart'; import 'package:star_lock/tools/appFirstEnterHandle.dart';
import 'package:star_lock/debug/debug_tool.dart'; import 'package:star_lock/debug/debug_tool.dart';
import 'package:star_lock/tools/storage.dart'; import 'package:star_lock/tools/storage.dart';
@ -42,7 +43,9 @@ class _StarLockApplicationState extends State<StarLockApplication> {
} else if (snapshot.hasData) { } else if (snapshot.hasData) {
if (snapshot.data!) { if (snapshot.data!) {
// //
return const StarLockMainPage(); return F.sw(
defaultCall: () => StarLockMainPage(),
xhjCall: () => const StarLockMainXHJPage());
} else { } else {
// //
return const StarLockLoginPage(); return const StarLockLoginPage();

View File

@ -13,6 +13,7 @@ class CommonItem extends StatelessWidget {
Function()? tipsImgAction; Function()? tipsImgAction;
double? allHeight; double? allHeight;
bool? isTipsImg; bool? isTipsImg;
bool? isPadding;
CommonItem( CommonItem(
{Key? key, {Key? key,
@ -22,6 +23,7 @@ class CommonItem extends StatelessWidget {
this.isHaveDirection = false, this.isHaveDirection = false,
this.isHaveLine = false, this.isHaveLine = false,
this.isHaveRightWidget = false, this.isHaveRightWidget = false,
this.isPadding = true,
this.rightWidget, this.rightWidget,
this.isTipsImg, this.isTipsImg,
this.action, this.action,
@ -38,8 +40,7 @@ class CommonItem extends StatelessWidget {
Container( Container(
height: allHeight ?? 65.h, height: allHeight ?? 65.h,
color: Colors.white, color: Colors.white,
padding: EdgeInsets.only( padding: isPadding == true ? EdgeInsets.only(left: 20.w, right: 10.w) : EdgeInsets.zero, // , top: 20.w, bottom: 20.w
left: 20.w, right: 10.w), // , top: 20.w, bottom: 20.w
child: Row( child: Row(
children: [ children: [
// SizedBox(width: 20.w), // SizedBox(width: 20.w),
@ -99,8 +100,8 @@ class CommonItem extends StatelessWidget {
isHaveLine! isHaveLine!
? Divider( ? Divider(
color: AppColors.greyLineColor, color: AppColors.greyLineColor,
indent: 20.w, indent: isPadding == true ? 20.w : 0,
endIndent: 20.w, endIndent: isPadding == true ? 20.w : 0,
height: 1, height: 1,
) )
: Container() : Container()

View File

@ -20,6 +20,7 @@ class LoginInput extends StatelessWidget {
Widget? leftWidget; Widget? leftWidget;
String? label; String? label;
bool? isPwd; bool? isPwd;
bool? isSuffixIcon;
Widget? rightSlot; Widget? rightSlot;
BlockStrCallback? onchangeAction; BlockStrCallback? onchangeAction;
BlockClickCallback? onTapAction; BlockClickCallback? onTapAction;
@ -30,6 +31,7 @@ class LoginInput extends StatelessWidget {
this.rightSlot, this.rightSlot,
this.label, this.label,
this.isPwd, this.isPwd,
this.isSuffixIcon,
this.inputFormatters, this.inputFormatters,
this.keyboardType, this.keyboardType,
this.background, this.background,
@ -67,6 +69,10 @@ class LoginInput extends StatelessWidget {
hintText: hintText, hintText: hintText,
//线 //线
border: InputBorder.none, border: InputBorder.none,
suffixIcon: isSuffixIcon! ? IconButton(
icon: const Icon(Icons.clear),
onPressed: controller!.clear,
) : null,
// //
icon: isHaveLeftWidget == true icon: isHaveLeftWidget == true
? leftWidget ? leftWidget