Merge branch 'master' of https://gitee.com/weishaoyang/star_lock
This commit is contained in:
commit
b6f6442d9e
@ -6,6 +6,9 @@ PODS:
|
||||
- Flutter (1.0.0)
|
||||
- flutter_native_contact_picker (0.0.1):
|
||||
- Flutter
|
||||
- fluttertoast (0.0.2):
|
||||
- Flutter
|
||||
- Toast
|
||||
- image_picker_ios (0.0.1):
|
||||
- Flutter
|
||||
- package_info_plus (0.4.5):
|
||||
@ -22,6 +25,7 @@ PODS:
|
||||
- Flutter
|
||||
- FlutterMacOS
|
||||
- SwiftProtobuf (1.22.0)
|
||||
- Toast (4.0.0)
|
||||
- url_launcher_ios (0.0.1):
|
||||
- Flutter
|
||||
|
||||
@ -30,6 +34,7 @@ DEPENDENCIES:
|
||||
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`)
|
||||
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
|
||||
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
|
||||
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
|
||||
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
|
||||
@ -41,6 +46,7 @@ SPEC REPOS:
|
||||
trunk:
|
||||
- Protobuf
|
||||
- SwiftProtobuf
|
||||
- Toast
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
aj_captcha_flutter:
|
||||
@ -51,6 +57,8 @@ EXTERNAL SOURCES:
|
||||
:path: Flutter
|
||||
flutter_native_contact_picker:
|
||||
:path: ".symlinks/plugins/flutter_native_contact_picker/ios"
|
||||
fluttertoast:
|
||||
:path: ".symlinks/plugins/fluttertoast/ios"
|
||||
image_picker_ios:
|
||||
:path: ".symlinks/plugins/image_picker_ios/ios"
|
||||
package_info_plus:
|
||||
@ -69,6 +77,7 @@ SPEC CHECKSUMS:
|
||||
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
|
||||
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
|
||||
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
|
||||
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
|
||||
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
|
||||
@ -76,6 +85,7 @@ SPEC CHECKSUMS:
|
||||
reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c
|
||||
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
|
||||
SwiftProtobuf: 40bd808372cb8706108f22d28f8ab4a6b9bc6989
|
||||
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
|
||||
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
|
||||
|
||||
PODFILE CHECKSUM: 2f695eae20a86ca77f41095e9bd74ba52bd6304c
|
||||
|
||||
@ -2,9 +2,6 @@ import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/safetyVerification/safetyVerification_binding.dart';
|
||||
import 'package:star_lock/login/register/starLock_register_binding.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/minePersonInfoEmail_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorityManagement/authorityManagement_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorityManagement/getDeviceList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorityManagement/getNameList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/authorizedAdministrator/addAuthorizedAdministrator_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockGroup/lockGroupList_page.dart';
|
||||
import 'package:star_lock/mine/mineSet/lockUserManage/lockUserManageList_page.dart';
|
||||
@ -89,6 +86,7 @@ import 'mine/gateway/gatewayConnectionLock/gatewayConnectionLockList_page.dart';
|
||||
import 'mine/gateway/gatewayDetail/gatewayDetail_page.dart';
|
||||
import 'mine/gateway/gatewayList/gatewayList_page.dart';
|
||||
import 'mine/message/messageList_page.dart';
|
||||
import 'mine/mine/starLockMine_page.dart';
|
||||
import 'mine/mineMultiLanguage/mineMultiLanguage_page.dart';
|
||||
import 'mine/minePersonInfo/minePersonInfo/minePersonInfo_page.dart';
|
||||
import 'mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/minePersonInfoEditAccount_page.dart';
|
||||
@ -98,11 +96,13 @@ import 'mine/minePersonInfo/minePersonInfoEditName/minePersonInfoEditName_page.d
|
||||
import 'mine/minePersonInfo/minePersonInfoResetPassword/minePersonInfoResetPassword_page.dart';
|
||||
import 'mine/minePersonInfo/minePersonInfoSetSafetyProblem/minePersonInfoSetSafetyProblem_page.dart';
|
||||
import 'mine/mineSet/appUnlockNeedMobileNetworkingLock/appUnlockNeedMobileNetworkingLock_page.dart';
|
||||
import 'mine/mineSet/authorityManagement/authorityManagement_page.dart';
|
||||
import 'mine/mineSet/authorityManagement/getDeviceList_page.dart';
|
||||
import 'mine/mineSet/authorityManagement/getNameList_page.dart';
|
||||
import 'mine/mineSet/hideInvalidUnlockPermissions/hideInvalidUnlockPermissions_page.dart';
|
||||
import 'mine/mineSet/lockGroup/lockItemList_page.dart';
|
||||
import 'mine/mineSet/lockScreen/lockScreen_page.dart';
|
||||
import 'mine/mineSet/lockUserManage/ownedKeyList_page.dart';
|
||||
import 'mine/mine_page.dart';
|
||||
import 'mine/supportStaff/supportStaff_page.dart';
|
||||
import 'mine/valueAddedServices/valueAddedServicesBuy/valueAddedServicesBuy_page.dart';
|
||||
import 'mine/valueAddedServices/valueAddedServicesBuyAndUseRecord/valueAddedServicesBuyAndUseRecordManage/valueAddedServicesBuyAndUseRecordManage_page.dart';
|
||||
@ -115,7 +115,7 @@ import 'mine/valueAddedServices/valueAddedServicesRealName/valueAddedServicesRea
|
||||
import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesAddSMSTemplate/valueAddedServicesAddSMSTemplate_page.dart';
|
||||
import 'mine/valueAddedServices/valueAddedServicesSMSTemplate/valueAddedServicesListSMSTemplate/valueAddedServicesListSMSTemplate_page.dart';
|
||||
import 'mine/mineSet/authorizedAdministrator/authorizedAdministratorList_page.dart';
|
||||
import 'starLockApplication.dart';
|
||||
import 'starLockApplication/starLockApplication.dart';
|
||||
|
||||
abstract class Routers {
|
||||
static const initial = '/'; // 加载页
|
||||
@ -246,39 +246,34 @@ abstract class Routers {
|
||||
'/ValueAddedServicesListEmailTemplatePage'; // 增值服务-邮箱模版列表
|
||||
static const valueAddedServicesAddEmailTemplatePage =
|
||||
'/ValueAddedServicesAddEmailTemplatePage'; // 增值服务-自定义邮箱模版
|
||||
static const valueAddedServicesBuyAndUseRecordManagePage =
|
||||
'/ValueAddedServicesBuyAndUseRecordManagePage'; // 增值服务-购买使用记录
|
||||
static const valueAddedServicesBuyAndUseRecordManagePage = '/ValueAddedServicesBuyAndUseRecordManagePage'; // 增值服务-购买使用记录
|
||||
|
||||
static const lockScreenPage = '/LockScreenPage'; // 我的设置-锁屏
|
||||
static const aPPUnlockNeedMobileNetworkingLockPage =
|
||||
'/APPUnlockNeedMobileNetworkingLockPage'; // 我的设置-app开锁时需手机连网的锁
|
||||
static const hideInvalidUnlockPermissionsPage =
|
||||
'/HideInvalidUnlockPermissionsPage'; // 我的设置-隐藏无效开锁权限
|
||||
static const aPPUnlockNeedMobileNetworkingLockPage = '/APPUnlockNeedMobileNetworkingLockPage'; // 我的设置-app开锁时需手机连网的锁
|
||||
static const hideInvalidUnlockPermissionsPage = '/HideInvalidUnlockPermissionsPage'; // 我的设置-隐藏无效开锁权限
|
||||
|
||||
static const lockUserManageLisPage = '/LockUserManageLisPage'; //我的设置-锁用户管理
|
||||
static const authorizedAdministratorListPage =
|
||||
'/AuthorizedAdministratorListPage'; //我的设置-授权管理员
|
||||
static const authorizedAdministratorListPage = '/AuthorizedAdministratorListPage'; //我的设置-授权管理员
|
||||
static const lockGroupListPage = '/LockGroupListPage'; //我的设置-锁分组
|
||||
static const lockItemListPage = '/LockItemListPage'; //锁分组-锁列表
|
||||
static const transferSmartLockPage = '/transferSmartLockPage'; //转移智能锁
|
||||
static const recipientInformationPage = '/recipientInformationPage'; //接受人信息
|
||||
static const selectBranchPage = '/SelectBranchPage'; //选择分店
|
||||
static const selectGetewayListPage = '/selectGetewayListPage'; //选择网关
|
||||
static const addAuthorizedAdministratorPage =
|
||||
'/addAuthorizedAdministratorPage'; //添加授权管理员
|
||||
static const addAuthorizedAdministratorPage = '/addAuthorizedAdministratorPage'; //添加授权管理员
|
||||
static const ownedKeyListPage = '/ownedKeyListPage'; //拥有的钥匙
|
||||
static const authorityManagementPage = '/authorityManagementPage'; //权限管理
|
||||
static const getDeviceListPage = '/getDeviceListPage'; //设备列表
|
||||
static const getNameListPage = '/getNameListPage'; //姓名列表
|
||||
|
||||
static const starLockLoginPage = '/StarLockLoginPage'; // 登录
|
||||
static const starLockRegisterPage = '/StarLockRegisterPage'; // 注册
|
||||
static const starLockForgetPasswordPage =
|
||||
'/StarLockForgetPasswordPage'; // 忘记密码
|
||||
static const starLockForgetPasswordPage = '/StarLockForgetPasswordPage'; // 忘记密码
|
||||
static const seletCountryRegionPage = '/SeletCountryRegionPage'; // 选择国家和地区
|
||||
static const safetyVerificationPage = '/SafetyVerificationPage'; // 安全验证
|
||||
|
||||
static const keyOperationRecordPage = '/keyOperationRecordPage'; //钥匙详情-操作记录
|
||||
|
||||
static const getDeviceListPage = '/getDeviceListPage'; //设备列表
|
||||
static const getNameListPage = '/getNameListPage'; //姓名列表
|
||||
static const authorityManagementPage = '/authorityManagementPage'; //权限管理
|
||||
}
|
||||
|
||||
abstract class AppRouters {
|
||||
@ -289,7 +284,7 @@ abstract class AppRouters {
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.starLockMain,
|
||||
page: () => const StarLockMain(),
|
||||
page: () => const StarLockMainPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.starLockMinePage,
|
||||
@ -400,9 +395,9 @@ abstract class AppRouters {
|
||||
page: () => const StarLockLoginPage(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.starLockRegisterPage,
|
||||
page: () => const StarLockRegisterPage(),
|
||||
binding: StarLockRegisterBinding()),
|
||||
name: Routers.starLockRegisterPage,
|
||||
page: () => const StarLockRegisterPage(), binding:StarLockRegisterBinding()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.starLockForgetPasswordPage,
|
||||
page: () => const StarLockForgetPasswordPage(),
|
||||
@ -677,46 +672,52 @@ abstract class AppRouters {
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.authorizedAdministratorListPage,
|
||||
page: () => const AuthorizedAdministratorListPage()),
|
||||
page: () => const AuthorizedAdministratorListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.lockUserManageLisPage,
|
||||
page: () => const LockUserManageListListPage()),
|
||||
page: () => const LockUserManageListListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.lockGroupListPage, page: () => const LockGroupListPage()),
|
||||
name: Routers.lockGroupListPage, page: () => const LockGroupListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.lockItemListPage, page: () => const LockItemListPage()),
|
||||
name: Routers.lockItemListPage, page: () => const LockItemListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.transferSmartLockPage,
|
||||
page: () => const TransferSmartLockPage()),
|
||||
page: () => const TransferSmartLockPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.recipientInformationPage,
|
||||
page: () => const RecipientInformationPage()),
|
||||
page: () => const RecipientInformationPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.selectBranchPage, page: () => const SelectBranchPage()),
|
||||
name: Routers.selectBranchPage, page: () => const SelectBranchPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.selectGetewayListPage,
|
||||
page: () => const SelectGetewayListPage()),
|
||||
page: () => const SelectGetewayListPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.minePersonInfoEditEmailPage,
|
||||
page: () => const MinePersonInfoEditEmailPage()),
|
||||
page: () => const MinePersonInfoEditEmailPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.addAuthorizedAdministratorPage,
|
||||
page: () => const AddAuthorizedAdministratorPage()),
|
||||
page: () => const AddAuthorizedAdministratorPage()
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.safetyVerificationPage,
|
||||
page: () => const SafetyVerificationPage(),
|
||||
name: Routers.safetyVerificationPage,
|
||||
page: () => const SafetyVerificationPage(),
|
||||
binding: SafetyVerificationBinding(),
|
||||
),
|
||||
GetPage(
|
||||
name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage()),
|
||||
GetPage(
|
||||
name: Routers.keyOperationRecordPage,
|
||||
page: () => const KeyOperationRecordPage()),
|
||||
GetPage(
|
||||
name: Routers.authorityManagementPage,
|
||||
page: () => const AuthorityManagementPage()),
|
||||
GetPage(
|
||||
name: Routers.getDeviceListPage, page: () => const GetDeviceListPage()),
|
||||
GetPage(name: Routers.getNameListPage, page: () => const GetNameListPage())
|
||||
name: Routers.ownedKeyListPage, page: () => const OwnedKeyListPage()
|
||||
),
|
||||
GetPage(name: Routers.keyOperationRecordPage, page: () => const KeyOperationRecordPage()),
|
||||
GetPage(name: Routers.getDeviceListPage, page: () => const GetDeviceListPage()),
|
||||
GetPage(name: Routers.getNameListPage, page: () => const GetNameListPage()),
|
||||
GetPage(name: Routers.authorityManagementPage, page: () => const AuthorityManagementPage()),
|
||||
];
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ abstract class SenderProtocol extends IOData {
|
||||
final int identifier = 0x22 ; // 高 4 位表示包版本,低 4 位用来指示后面数据的加密类型,长度为 1 字节,加密类型取值说明,0:明文,1:AES128,2:SM4(事先约定密钥),3:SM4(设备指定密钥)
|
||||
|
||||
List<int>? commandData = []; //数据域
|
||||
final int? tail = 0xFF; //帧尾
|
||||
final int? tail = 0xFF; //用来校验包的完整性,采用 CRC 校验方法,长度为 2 个字节
|
||||
|
||||
SenderProtocol(this.commandType) {
|
||||
_commandIndex = IoManager().commandIndex;
|
||||
|
||||
@ -10,7 +10,6 @@ import '../../app_settings/app_colors.dart';
|
||||
import '../../network/api_repository.dart';
|
||||
import '../../tools/titleAppBar.dart';
|
||||
import '../../translations/trans_lib.dart';
|
||||
import 'entity/SafetyVerificationEntity.dart';
|
||||
|
||||
class SafetyVerificationPage extends StatefulWidget {
|
||||
const SafetyVerificationPage({Key? key}) : super(key: key);
|
||||
@ -21,7 +20,7 @@ class SafetyVerificationPage extends StatefulWidget {
|
||||
|
||||
class _SafetyVerificationPageState extends State<SafetyVerificationPage> with TickerProviderStateMixin {
|
||||
|
||||
final logic = Get.find<SafetyVerificationLogic>();
|
||||
final logic = Get.put(SafetyVerificationLogic());
|
||||
final state = Get.find<SafetyVerificationLogic>().state;
|
||||
|
||||
String baseImageBase64 = "";
|
||||
@ -173,7 +172,7 @@ class _SafetyVerificationPageState extends State<SafetyVerificationPage> with Ti
|
||||
_showTimeLine = false;
|
||||
});
|
||||
//关闭验证码
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context, {'xWidth': state.sliderXMoved.value.toString()});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
class Data {
|
||||
Data({
|
||||
this.id,
|
||||
this.tel,
|
||||
this.email,
|
||||
this.deviceId,
|
||||
this.type,
|
||||
this.token,
|
||||
this.snName,
|
||||
this.createTime,});
|
||||
|
||||
Data.fromJson(dynamic json) {
|
||||
id = json['id'];
|
||||
tel = json['tel'];
|
||||
email = json['email'];
|
||||
deviceId = json['deviceId'];
|
||||
type = json['type'];
|
||||
token = json['token'];
|
||||
snName = json['snName'];
|
||||
createTime = json['createTime'];
|
||||
}
|
||||
int? id;
|
||||
String? tel;
|
||||
String? email;
|
||||
String? deviceId;
|
||||
int? type;
|
||||
String? token;
|
||||
String? snName;
|
||||
int? createTime;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['id'] = id;
|
||||
map['tel'] = tel;
|
||||
map['email'] = email;
|
||||
map['deviceId'] = deviceId;
|
||||
map['type'] = type;
|
||||
map['token'] = token;
|
||||
map['snName'] = snName;
|
||||
map['createTime'] = createTime;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
52
star_lock/lib/login/login/entity/LoginData.dart
Normal file
52
star_lock/lib/login/login/entity/LoginData.dart
Normal file
@ -0,0 +1,52 @@
|
||||
class LoginData {
|
||||
LoginData({
|
||||
this.accessToken,
|
||||
this.userid,
|
||||
this.expiresAt,
|
||||
this.expiresAtString,
|
||||
this.mobile,
|
||||
this.headUrl,
|
||||
this.email,
|
||||
this.nickname,
|
||||
this.haveSafeAnswer,
|
||||
this.uid});
|
||||
|
||||
LoginData.fromJson(dynamic json) {
|
||||
accessToken = json['accessToken'];
|
||||
userid = json['userid'];
|
||||
expiresAt = json['expiresAt'];
|
||||
expiresAtString = json['expiresAtString'];
|
||||
mobile = json['mobile'];
|
||||
headUrl = json['headUrl'];
|
||||
email = json['email'];
|
||||
nickname = json['nickname'];
|
||||
haveSafeAnswer = json['haveSafeAnswer'];
|
||||
uid = json['uid'];
|
||||
}
|
||||
String? accessToken;
|
||||
int? userid;
|
||||
int? expiresAt;
|
||||
String? expiresAtString;
|
||||
String? mobile;
|
||||
String? headUrl;
|
||||
String? email;
|
||||
String? nickname;
|
||||
bool? haveSafeAnswer;
|
||||
int? uid;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['accessToken'] = accessToken;
|
||||
map['userid'] = userid;
|
||||
map['expiresAt'] = expiresAt;
|
||||
map['expiresAtString'] = expiresAtString;
|
||||
map['mobile'] = mobile;
|
||||
map['headUrl'] = headUrl;
|
||||
map['email'] = email;
|
||||
map['nickname'] = nickname;
|
||||
map['haveSafeAnswer'] = haveSafeAnswer;
|
||||
map['uid'] = uid;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,29 +1,29 @@
|
||||
import 'Data.dart';
|
||||
import 'LoginData.dart';
|
||||
|
||||
class LoginEntity {
|
||||
LoginEntity({
|
||||
this.description,
|
||||
this.errorCode,
|
||||
this.content,
|
||||
this.data,
|
||||
this.errorMsg,});
|
||||
|
||||
LoginEntity.fromJson(dynamic json) {
|
||||
description = json['description'];
|
||||
errorCode = json['errorCode'];
|
||||
content = json['content'] != null ? Data.fromJson(json['content']) : null;
|
||||
data = json['data'] != null ? LoginData.fromJson(json['data']) : null;
|
||||
errorMsg = json['errorMsg'];
|
||||
}
|
||||
String? description;
|
||||
int? errorCode;
|
||||
Data? content;
|
||||
int? errorMsg;
|
||||
LoginData? data;
|
||||
String? errorMsg;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['description'] = description;
|
||||
map['errorCode'] = errorCode;
|
||||
if (content != null) {
|
||||
map['data'] = content!.toJson();
|
||||
if (data != null) {
|
||||
map['data'] = data!.toJson();
|
||||
}
|
||||
map['errorMsg'] = errorMsg;
|
||||
return map;
|
||||
|
||||
12
star_lock/lib/login/login/starLock_login_binding.dart
Normal file
12
star_lock/lib/login/login/starLock_login_binding.dart
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'starLock_login_logic.dart';
|
||||
|
||||
|
||||
class StarLockLoginBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => StarLockLoginLogic());
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,59 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
class StarLockLoginLogic extends GetxController{
|
||||
import '../../mine/mine/starLockMine_logic.dart';
|
||||
import '../../network/api_repository.dart';
|
||||
import '../../tools/store_service.dart';
|
||||
import 'starLock_login_state.dart';
|
||||
|
||||
class StarLockLoginLogic extends BaseGetXController{
|
||||
final StarLockLoginState state = StarLockLoginState();
|
||||
final stateMyLogic = Get.put(StarLockMineLogic()).state;
|
||||
|
||||
void login() async{
|
||||
var entity = await ApiRepository.to.login(
|
||||
"1",
|
||||
state.pwd.value,
|
||||
"+86",
|
||||
state.emailOrPhone.value
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
// await StoreService.to.saveLogInInfo(entity);
|
||||
stateMyLogic.saveLoginData(entity);
|
||||
Get.back();
|
||||
}
|
||||
}
|
||||
|
||||
void changeAgreeState() {
|
||||
_resetCanNext();
|
||||
}
|
||||
|
||||
void exchangeFistShow() => state.passwordShow.value = !state.passwordShow.value;
|
||||
|
||||
void checkNext(TextEditingController controller) {
|
||||
changeInput(controller);
|
||||
}
|
||||
|
||||
void changeInput(TextEditingController controller) {
|
||||
if(controller == state.emailOrPhoneController){
|
||||
state.emailOrPhone.value = controller.text;
|
||||
}
|
||||
if(controller == state.pwdController) {
|
||||
state.pwd.value = controller.text;
|
||||
}
|
||||
_resetCanNext();
|
||||
}
|
||||
|
||||
void _resetCanNext(){
|
||||
state.canNext.value = state.pwdIsOK && state.isEmailOrPhone && state.agree.value;
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
state.onClose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
}
|
||||
@ -9,6 +9,7 @@ import '../../tools/tf_loginInput.dart';
|
||||
import '../../tools/submitBtn.dart';
|
||||
import '../../tools/titleAppBar.dart';
|
||||
import '../../translations/trans_lib.dart';
|
||||
import 'starLock_login_logic.dart';
|
||||
|
||||
class StarLockLoginPage extends StatefulWidget {
|
||||
const StarLockLoginPage({Key? key}) : super(key: key);
|
||||
@ -18,8 +19,8 @@ class StarLockLoginPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
final TextEditingController _phoneController = TextEditingController();
|
||||
final TextEditingController _pwdController = TextEditingController();
|
||||
final logic = Get.put(StarLockLoginLogic());
|
||||
final state = Get.find<StarLockLoginLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -34,7 +35,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.register!.tr,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, Routers.starLockRegisterPage);
|
||||
@ -47,23 +48,18 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(10.w),
|
||||
child: Center(
|
||||
child: Image.asset('images/icon_main_1024.png',
|
||||
width: 110.w, height: 110.w))),
|
||||
child: Center(child: Image.asset('images/icon_main_1024.png', width: 110.w, height: 110.w))),
|
||||
SizedBox(height: 50.w),
|
||||
LoginInput(
|
||||
controller: _phoneController,
|
||||
controller: state.emailOrPhoneController,
|
||||
onchangeAction: (v){
|
||||
logic.checkNext(state.emailOrPhoneController);
|
||||
},
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
child: Image.asset(
|
||||
'images/icon_login_account.png',
|
||||
width: 36.w,
|
||||
height: 36.w,
|
||||
),
|
||||
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
child: Image.asset('images/icon_login_account.png', width: 36.w, height: 36.w,),
|
||||
),
|
||||
hintText:
|
||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
hintText: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||
keyboardType: TextInputType.number,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
@ -71,19 +67,16 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
]),
|
||||
SizedBox(height: 10.h),
|
||||
LoginInput(
|
||||
controller: _pwdController,
|
||||
controller: state.pwdController,
|
||||
onchangeAction: (v){
|
||||
logic.checkNext(state.pwdController);
|
||||
},
|
||||
isPwd: true,
|
||||
leftWidget: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
child: Image.asset(
|
||||
'images/icon_login_password.png',
|
||||
width: 36.w,
|
||||
height: 36.w,
|
||||
),
|
||||
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
||||
child: Image.asset('images/icon_login_password.png', width: 36.w, height: 36.w,),
|
||||
),
|
||||
hintText:
|
||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
hintText: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||
inputFormatters: [
|
||||
LengthLimitingTextInputFormatter(20),
|
||||
]),
|
||||
@ -91,43 +84,30 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Image.asset(
|
||||
'images/icon_select_circle.png',
|
||||
width: 28.w,
|
||||
height: 28.w,
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 20.h,
|
||||
// width: 26.w,
|
||||
// child: Checkbox(value: false, onChanged: (value) {})),
|
||||
SizedBox(
|
||||
width: 15.w,
|
||||
),
|
||||
Obx(() => GestureDetector(
|
||||
onTap: (){
|
||||
state.agree.value = !state.agree.value;
|
||||
logic.changeAgreeState();
|
||||
},
|
||||
child: Image.asset(state.agree.value ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', width: 30.w, height: 30.w,)
|
||||
)),
|
||||
SizedBox(width: 15.w,),
|
||||
Flexible(
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: TranslationLoader.lanKeys!.readAndAgree!.tr,
|
||||
style: TextStyle(
|
||||
color: const Color(0xff333333), fontSize: 20.sp),
|
||||
style: TextStyle(color: const Color(0xff333333), fontSize: 20.sp),
|
||||
children: [
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
child: Text(
|
||||
'《${TranslationLoader.lanKeys!.userAgreement!.tr}》',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
child: Text('《${TranslationLoader.lanKeys!.userAgreement!.tr}》', style: TextStyle(color: AppColors.mainColor, fontSize: 20.sp)),
|
||||
onTap: () {},
|
||||
)),
|
||||
WidgetSpan(
|
||||
alignment: PlaceholderAlignment.middle,
|
||||
child: GestureDetector(
|
||||
child: Text(
|
||||
'《${TranslationLoader.lanKeys!.privacyPolicy!.tr}》',
|
||||
style: TextStyle(
|
||||
color: AppColors.mainColor,
|
||||
fontSize: 20.sp)),
|
||||
child: Text('《${TranslationLoader.lanKeys!.privacyPolicy!.tr}》', style: TextStyle( color: AppColors.mainColor, fontSize: 20.sp)),
|
||||
onTap: () {},
|
||||
)),
|
||||
],
|
||||
@ -136,12 +116,16 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
],
|
||||
),
|
||||
SizedBox(height: 50.w),
|
||||
SubmitBtn(
|
||||
Obx(() => SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.login!.tr,
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {}),
|
||||
isDisabled: state.canNext.value,
|
||||
onClick: state.canNext.value ? (){
|
||||
logic.login();
|
||||
}: null)
|
||||
),
|
||||
SizedBox(height: 50.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@ -152,15 +136,11 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
|
||||
height: 50.h,
|
||||
// color: Colors.red,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${TranslationLoader.lanKeys!.forgetPassword!.tr}?',
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.mainColor)),
|
||||
child: Text('${TranslationLoader.lanKeys!.forgetPassword!.tr}?', style: TextStyle(fontSize: 22.sp, color: AppColors.mainColor)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.starLockForgetPasswordPage);
|
||||
Navigator.pushNamed(context, Routers.starLockForgetPasswordPage);
|
||||
},
|
||||
)
|
||||
],
|
||||
|
||||
@ -1,5 +1,30 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../tools/store_service.dart';
|
||||
|
||||
class StarLockLoginState{
|
||||
|
||||
var passwordShow = true.obs;
|
||||
var agree = false.obs;
|
||||
|
||||
var emailOrPhone = ''.obs;
|
||||
var pwd = ''.obs;
|
||||
var canNext = false.obs;
|
||||
bool get isEmailOrPhone => emailOrPhone.value.isNotEmpty;
|
||||
bool get pwdIsOK => pwd.value.isNotEmpty;
|
||||
|
||||
TextEditingController emailOrPhoneController = TextEditingController();
|
||||
TextEditingController pwdController = TextEditingController();
|
||||
StarLockLoginState() {
|
||||
// emailOrPhone.value = StoreService.to.getLastUserAccount() as String;
|
||||
emailOrPhoneController.text = emailOrPhone.value;
|
||||
}
|
||||
|
||||
void onClose() {
|
||||
emailOrPhoneController.dispose();
|
||||
pwdController.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
28
star_lock/lib/login/register/entity/Data.dart
Normal file
28
star_lock/lib/login/register/entity/Data.dart
Normal file
@ -0,0 +1,28 @@
|
||||
class Data {
|
||||
Data({
|
||||
this.originalImageBase64,
|
||||
this.jigsawImageBase64,
|
||||
this.secretKey,
|
||||
this.token});
|
||||
|
||||
Data.fromJson(dynamic json) {
|
||||
originalImageBase64 = json['originalImageBase64'];
|
||||
jigsawImageBase64 = json['jigsawImageBase64'];
|
||||
secretKey = json['secretKey'];
|
||||
token = json['token'];
|
||||
}
|
||||
int? originalImageBase64;
|
||||
String? jigsawImageBase64;
|
||||
String? secretKey;
|
||||
String? token;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['originalImageBase64'] = originalImageBase64;
|
||||
map['jigsawImageBase64'] = jigsawImageBase64;
|
||||
map['secretKey'] = secretKey;
|
||||
map['token'] = token;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
import 'Data.dart';
|
||||
|
||||
class SendValidationCodeEntity {
|
||||
SendValidationCodeEntity({
|
||||
this.description,
|
||||
this.errorCode,
|
||||
this.content,
|
||||
this.errorMsg,});
|
||||
|
||||
SendValidationCodeEntity.fromJson(dynamic json) {
|
||||
description = json['description'];
|
||||
errorCode = json['errorCode'];
|
||||
content = json['content'] != null ? Data.fromJson(json['content']) : null;
|
||||
errorMsg = json['errorMsg'];
|
||||
}
|
||||
String? description;
|
||||
int? errorCode;
|
||||
Data? content;
|
||||
String? errorMsg;
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final map = <String, dynamic>{};
|
||||
map['description'] = description;
|
||||
map['errorCode'] = errorCode;
|
||||
if (content != null) {
|
||||
map['data'] = content!.toJson();
|
||||
}
|
||||
map['errorMsg'] = errorMsg;
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,25 +1,64 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../network/api_repository.dart';
|
||||
import '../../tools/baseGetXController.dart';
|
||||
import '../../tools/toast.dart';
|
||||
import 'starLock_register_state.dart';
|
||||
|
||||
class StarLockRegisterLogic extends BaseGetXController{
|
||||
final StarLockRegisterState state = StarLockRegisterState();
|
||||
|
||||
late Timer _timer;
|
||||
void _startTimer() {
|
||||
_timer = Timer.periodic(1.seconds, (timer) {
|
||||
if(state.currentSecond > 1){
|
||||
state.currentSecond--;
|
||||
}else {
|
||||
_cancelTimer();
|
||||
state.currentSecond = state.totalSeconds;
|
||||
}
|
||||
state.resetResend();
|
||||
});
|
||||
}
|
||||
|
||||
void _cancelTimer() {
|
||||
_timer.cancel();
|
||||
// _timer = null;
|
||||
}
|
||||
|
||||
void register() async{
|
||||
var entity = await ApiRepository.to.register(
|
||||
state.countryCode.value,
|
||||
state.countryId.value,
|
||||
state.phoneOrEmailStr.value,
|
||||
state.pwd.value,
|
||||
"gdasdfasdfasdf",
|
||||
"477E6814-289D-402A-9F49-F89A8BD05D63",
|
||||
state.verificationCode.value
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
await loginSuccess(loginEntity: entity);
|
||||
// await loginSuccess(loginEntity: entity);
|
||||
Toast.show(msg: "注册成功");
|
||||
Get.back();
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void sendValidationCode() async{
|
||||
var entity = await ApiRepository.to.sendValidationCode(
|
||||
// state.countryCode.value,
|
||||
"+86",
|
||||
state.phoneOrEmailStr.value,
|
||||
state.isIphoneType.value?"1":"2",
|
||||
"B748F838-94EE-4BDB-A0E6-7B2D16849792",
|
||||
state.xWidth.value.toString()
|
||||
);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
_startTimer();
|
||||
} else {
|
||||
|
||||
}
|
||||
@ -32,6 +71,7 @@ class StarLockRegisterLogic extends BaseGetXController{
|
||||
void changeInput(TextEditingController controller) {
|
||||
if(controller == state.phoneOrEmailController){
|
||||
state.phoneOrEmailStr.value = controller.text;
|
||||
state.phoneOrEmailStrIsOK.value = state.phoneOrEmailStr.value.isNotEmpty;
|
||||
}
|
||||
if(controller == state.pwdController) {
|
||||
state.pwd.value = controller.text;
|
||||
|
||||
@ -22,11 +22,11 @@ class StarLockRegisterPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
final logic = Get.find<StarLockRegisterLogic>();
|
||||
final logic = Get.put(StarLockRegisterLogic());
|
||||
final state = Get.find<StarLockRegisterLogic>().state;
|
||||
|
||||
late Timer _timer;
|
||||
final int _seconds = 60;
|
||||
// late Timer _timer;
|
||||
// final int _seconds = 60;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -43,7 +43,6 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
topSeletCountryAndRegionWidget(),
|
||||
middleTFWidget(),
|
||||
Obx(() {
|
||||
print("11111:${state.canSub.value}");
|
||||
return SubmitBtn(
|
||||
btnName: TranslationLoader.lanKeys!.register!.tr,
|
||||
// backgroundColorList: state.canSub.value ? [AppColors.mainColor] :[Colors.grey],
|
||||
@ -78,63 +77,42 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
// color: Colors.red,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
||||
border: const Border(
|
||||
top: BorderSide(width: 1.0, color: AppColors.greyLineColor),
|
||||
left:
|
||||
BorderSide(width: 1.0, color: AppColors.greyLineColor),
|
||||
right:
|
||||
BorderSide(width: 1.0, color: AppColors.greyLineColor),
|
||||
bottom:
|
||||
BorderSide(width: 1.0, color: AppColors.greyLineColor),
|
||||
)),
|
||||
border: Border.all(width: 1.0, color: AppColors.greyLineColor)),
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
onTap: () {
|
||||
state.isIphoneType.value = true;
|
||||
},
|
||||
child: Obx(() => Container(
|
||||
width: 170.w,
|
||||
height: 60.h,
|
||||
// color: Colors.red,
|
||||
decoration: BoxDecoration(
|
||||
decoration: state.isIphoneType.value ? BoxDecoration(
|
||||
color: AppColors.mainColor,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(30.h)),
|
||||
border: const Border(
|
||||
top: BorderSide(
|
||||
width: 1.0, color: AppColors.greyLineColor),
|
||||
left: BorderSide(
|
||||
width: 1.0, color: AppColors.greyLineColor),
|
||||
right: BorderSide(
|
||||
width: 1.0, color: AppColors.greyLineColor),
|
||||
bottom: BorderSide(
|
||||
width: 1.0, color: AppColors.greyLineColor),
|
||||
)),
|
||||
BorderRadius.all(Radius.circular(30.h)),
|
||||
border: Border.all(width: 1.0, color: AppColors.greyLineColor)):null,
|
||||
child: Center(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.iphone!.tr,
|
||||
style: TextStyle(color: Colors.white),
|
||||
))),
|
||||
TranslationLoader.lanKeys!.iphone!.tr,
|
||||
style: TextStyle(color: state.isIphoneType.value ? Colors.white : Colors.black),
|
||||
)))),
|
||||
),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
onTap: () {
|
||||
state.isIphoneType.value = false;
|
||||
},
|
||||
child: Obx(() => Container(
|
||||
height: 60.h,
|
||||
// color: Colors.red,
|
||||
// decoration: BoxDecoration(
|
||||
// borderRadius: BorderRadius.all(Radius.circular(30.h)),
|
||||
// border: const Border(
|
||||
// top: BorderSide(width: 1.0, color: Color(0xffC0C0C0)),
|
||||
// left: BorderSide(width: 1.0, color: Color(0xffC0C0C0)),
|
||||
// right: BorderSide(width: 1.0, color: Color(0xffC0C0C0)),
|
||||
// bottom: BorderSide(width: 1.0, color: Color(0xffC0C0C0)),
|
||||
// )
|
||||
// ),
|
||||
decoration: state.isIphoneType.value ? null : BoxDecoration(
|
||||
color: AppColors.mainColor,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(30.h)),
|
||||
border: Border.all(width: 1.0, color: AppColors.greyLineColor)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.email!.tr,
|
||||
style: const TextStyle(color: Colors.black),
|
||||
))),
|
||||
child: Text(TranslationLoader.lanKeys!.email!.tr, style: TextStyle(color: state.isIphoneType.value ? Colors.black : Colors.white),)))),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -145,42 +123,31 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
SizedBox(height: 60.h),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
Navigator.pushNamed(context, Routers.seletCountryRegionPage);
|
||||
var result = await Navigator.pushNamed(
|
||||
context, Routers.seletCountryRegionPage);
|
||||
logic.state.countryCode.value =
|
||||
(result as Map<String, dynamic>)['code'];
|
||||
logic.state.countryId.value = result["countryId"];
|
||||
// Navigator.pushNamed(context, Routers.seletCountryRegionPage);
|
||||
var result = await Navigator.pushNamed(context, Routers.seletCountryRegionPage);
|
||||
// logic.state.countryCode.value = (result as Map<String, dynamic>)['code'];
|
||||
// logic.state.countryId.value = result["countryId"];
|
||||
logic.state.countryCode.value = "+86";
|
||||
logic.state.countryId.value = "9";
|
||||
|
||||
// print("路由返回值: ${result}, countryCode:${logic.state.countryCode} ,countryId:${logic.state.countryId}");
|
||||
},
|
||||
child: Container(
|
||||
height: 70.h,
|
||||
// color: Colors.red,
|
||||
// padding: EdgeInsets.only(left:20.w, right: 10.w, top: 20.w, bottom: 20.w),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(width: 5.w),
|
||||
Expanded(
|
||||
child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp, color: AppColors.blackColor))),
|
||||
child: Text(TranslationLoader.lanKeys!.countryAndRegion!.tr, style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor))),
|
||||
SizedBox(width: 20.w),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"中国+86",
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp, color: AppColors.blackColor),
|
||||
)
|
||||
Obx(() => Text(state.isIphoneType.value ? "中国+86" : "中国", textAlign: TextAlign.end, style: TextStyle(fontSize: 26.sp, color: AppColors.blackColor),))
|
||||
],
|
||||
),
|
||||
SizedBox(width: 5.w),
|
||||
Image.asset(
|
||||
'images/icon_right.png',
|
||||
width: 50.w,
|
||||
height: 50.w,
|
||||
Image.asset('images/icon_right.png', width: 50.w, height: 50.w,
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -259,7 +226,6 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
Expanded(
|
||||
child: LoginInput(
|
||||
controller: state.codeController,
|
||||
isPwd: true,
|
||||
onchangeAction: (v) {
|
||||
logic.checkNext(state.codeController);
|
||||
},
|
||||
@ -269,11 +235,6 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
width: 30.w,
|
||||
height: 30.w,
|
||||
),
|
||||
// Image.asset(
|
||||
// 'images/main/icon_main_search.png',
|
||||
// width: 40.w,
|
||||
// height: 40.w,
|
||||
// ),
|
||||
),
|
||||
hintText: "${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||
inputFormatters: [
|
||||
@ -283,37 +244,28 @@ class _StarLockRegisterPageState extends State<StarLockRegisterPage> {
|
||||
SizedBox(
|
||||
width: 20.w,
|
||||
),
|
||||
GestureDetector(
|
||||
Obx(() => GestureDetector(
|
||||
onTap: state.phoneOrEmailStrIsOK.value ? () async {
|
||||
// Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
||||
var result = await Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":state.phoneOrEmailStr.value});
|
||||
logic.state.xWidth.value = (result as Map<String, dynamic>)['xWidth'];
|
||||
logic.sendValidationCode();
|
||||
}:null,
|
||||
child: Container(
|
||||
width: 180.w,
|
||||
height: 60.h,
|
||||
padding: EdgeInsets.all(5.h),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.mainColor,
|
||||
color: state.phoneOrEmailStrIsOK.value ? AppColors.mainColor : Colors.grey,
|
||||
borderRadius: BorderRadius.circular(5)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
_seconds == 60
|
||||
? TranslationLoader.lanKeys!.getVerificationCode!.tr
|
||||
: (_seconds < 10)
|
||||
? '0$_seconds s'
|
||||
: '$_seconds s',
|
||||
state.btnText.value,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 26.sp,
|
||||
)),
|
||||
style: TextStyle(color: Colors.white, fontSize: 26.sp,)),
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pushNamed(context, Routers.safetyVerificationPage, arguments: {"countryCode":"+86", "account":"15080825640"});
|
||||
if (_seconds == 60) {
|
||||
// _setVerify();
|
||||
} else {
|
||||
// Toast.show(msg: '正在获取验证码');
|
||||
}
|
||||
},
|
||||
)
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(height: 50.w),
|
||||
|
||||
@ -3,6 +3,8 @@ import 'package:flustars/flustars.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../translations/trans_lib.dart';
|
||||
|
||||
class StarLockRegisterState{
|
||||
|
||||
final TextEditingController phoneOrEmailController = TextEditingController();
|
||||
@ -13,16 +15,33 @@ class StarLockRegisterState{
|
||||
var countryCode = ''.obs;
|
||||
var countryId = ''.obs;
|
||||
var phoneOrEmailStr = ''.obs;
|
||||
var phoneOrEmailStrIsOK = false.obs;
|
||||
var pwd = ''.obs;
|
||||
var surePwd = ''.obs;
|
||||
var verificationCode = ''.obs;
|
||||
var xWidth = ''.obs;// 滑动验证码滑动位置
|
||||
var isIphoneType = true.obs;
|
||||
var canSub = false.obs;
|
||||
|
||||
bool get isEmail => RegexUtil.isEmail(phoneOrEmailStr.value);
|
||||
bool get isIphone => RegexUtil.isMobileSimple(phoneOrEmailStr.value);
|
||||
bool get pwdIsOK => pwd.value.isNotEmpty && (pwd.value == surePwd.value);
|
||||
bool get codeIsOK => verificationCode.value.isNotEmpty;
|
||||
|
||||
var canResend = false.obs;
|
||||
var btnText = ''.obs;
|
||||
var totalSeconds = 120;
|
||||
var currentSecond = 120;
|
||||
|
||||
StarLockRegisterState(){
|
||||
resetResend();
|
||||
}
|
||||
|
||||
void resetResend() {
|
||||
canResend.value = totalSeconds == currentSecond;
|
||||
btnText.value = !canResend.value ? '$currentSecond s' : btnText.value = TranslationLoader.lanKeys!.getVerificationCode!.tr;
|
||||
}
|
||||
|
||||
void onClose() {
|
||||
phoneOrEmailController.dispose();
|
||||
pwdController.dispose();
|
||||
|
||||
@ -8,12 +8,13 @@ import 'package:star_lock/tools/bindings/app_binding.dart';
|
||||
import 'package:star_lock/tools/device_info_service.dart';
|
||||
import 'package:star_lock/tools/platform_info_services.dart';
|
||||
import 'package:star_lock/tools/reactiveBlueTool/getx_ble.dart';
|
||||
import 'package:star_lock/tools/store_service.dart';
|
||||
// import 'package:star_lock/tools/store_service.dart';
|
||||
import 'package:star_lock/translations/app_dept.dart';
|
||||
import 'package:star_lock/translations/trans_lib.dart';
|
||||
|
||||
import 'appRouters.dart';
|
||||
import 'baseWidget.dart';
|
||||
import 'tools/store_service.dart';
|
||||
|
||||
void main() async {
|
||||
_setCommonServices();
|
||||
|
||||
11
star_lock/lib/main/lockMian/lockMain_binding.dart
Normal file
11
star_lock/lib/main/lockMian/lockMain_binding.dart
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'lockMain_logic.dart';
|
||||
|
||||
class LockMainBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => LockMainLogic());
|
||||
}
|
||||
}
|
||||
7
star_lock/lib/main/lockMian/lockMain_logic.dart
Normal file
7
star_lock/lib/main/lockMian/lockMain_logic.dart
Normal file
@ -0,0 +1,7 @@
|
||||
import '../../tools/baseGetXController.dart';
|
||||
import 'lockMain_state.dart';
|
||||
|
||||
class LockMainLogic extends BaseGetXController {
|
||||
final LockMainState state = LockMainState();
|
||||
|
||||
}
|
||||
@ -9,31 +9,27 @@ import 'package:star_lock/mine/mineSet/mineSet_page.dart';
|
||||
|
||||
import '../../appRouters.dart';
|
||||
import '../../baseWidget.dart';
|
||||
import '../../mine/mine_page.dart';
|
||||
import '../../mine/mine/starLockMine_page.dart';
|
||||
import '../../tools/reactiveBlueTool/getx_ble.dart';
|
||||
import '../../tools/titleAppBar.dart';
|
||||
import '../../translations/trans_lib.dart';
|
||||
import 'lockMain_logic.dart';
|
||||
|
||||
class StarLockMain extends StatefulWidget {
|
||||
const StarLockMain({Key? key}) : super(key: key);
|
||||
class StarLockMainPage extends StatefulWidget {
|
||||
const StarLockMainPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StarLockMain> createState() => _StarLockMainState();
|
||||
State<StarLockMainPage> createState() => _StarLockMainPageState();
|
||||
}
|
||||
GlobalKey<_StarLockMainPageState> starLockMainKey = GlobalKey();
|
||||
class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
|
||||
class _StarLockMainState extends State<StarLockMain> with BaseWidget {
|
||||
// final logic = Get.put(GetxBle());
|
||||
|
||||
StreamSubscription<DiscoveredDevice>? _streamSubscription;
|
||||
StreamSubscription<ConnectionStateUpdate>? _connectionStreamSubscription;
|
||||
final flutterReactiveBle = FlutterReactiveBle();
|
||||
List<DiscoveredDevice> deviceList = [];
|
||||
|
||||
final GlobalKey<ScaffoldState> _globalKey = GlobalKey();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final logic = Get.put(GetxBle());
|
||||
// Get.lazyPut(()=>GetxBle());
|
||||
logic.scanner.startScan([]);
|
||||
|
||||
final logic = Get.put(LockMainLogic());
|
||||
final state = Get.find<LockMainLogic>().state;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFFF5F5F5),
|
||||
@ -50,6 +46,7 @@ class _StarLockMainState extends State<StarLockMain> with BaseWidget {
|
||||
height: 44.w,
|
||||
),
|
||||
onPressed: () {
|
||||
// _globalKey.currentState!.openDrawer();
|
||||
Scaffold.of(context).openDrawer();
|
||||
},
|
||||
)),
|
||||
@ -65,7 +62,7 @@ class _StarLockMainState extends State<StarLockMain> with BaseWidget {
|
||||
),
|
||||
drawer: Drawer(
|
||||
width: 1.sw / 3 * 2,
|
||||
child: StarLockMinePage(),
|
||||
child: const StarLockMinePage(),
|
||||
),
|
||||
body: getLockList(),
|
||||
// body: unHaveData(),
|
||||
|
||||
4
star_lock/lib/main/lockMian/lockMain_state.dart
Normal file
4
star_lock/lib/main/lockMian/lockMain_state.dart
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
class LockMainState {
|
||||
|
||||
}
|
||||
54
star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart
Normal file
54
star_lock/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../tools/reactiveBlueTool/getx_ble.dart';
|
||||
import 'nearbyLock_state.dart';
|
||||
|
||||
class NearbyLockLogic extends BaseGetXController{
|
||||
|
||||
// StreamSubscription<DiscoveredDevice>? _streamSubscription;
|
||||
// StreamSubscription<ConnectionStateUpdate>? _connectionStreamSubscription;
|
||||
// final flutterReactiveBle = FlutterReactiveBle();
|
||||
// List<DiscoveredDevice> deviceList = [];
|
||||
|
||||
final NearbyLockState state = NearbyLockState();
|
||||
final logicGetxBle = Get.put(GetxBle());
|
||||
|
||||
final StreamController<BleScannerState> _stateStreamController = StreamController();
|
||||
late StreamSubscription<BleScannerState> _streamSubscription;
|
||||
void _initScheduleSubscription() {
|
||||
_streamSubscription= _stateStreamController.stream.listen((BleScannerState) {
|
||||
print("页面B接收到数据 $BleScannerState");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
_initScheduleSubscription();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
logicGetxBle.scanner.startScan((List<DiscoveredDevice> devices){
|
||||
// print("zzzzzzzzz:$devices");
|
||||
// print("ccccccccc:${state.devices}");
|
||||
bool isHave = state.devices.any((element) => element.id == devices[0].id);
|
||||
if (isHave == false){
|
||||
state.devices.addAll(devices);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,10 +1,14 @@
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
import 'nearbyLock_logic.dart';
|
||||
|
||||
class NearbyLockPage extends StatefulWidget {
|
||||
const NearbyLockPage({Key? key}) : super(key: key);
|
||||
@ -14,6 +18,9 @@ class NearbyLockPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _NearbyLockPageState extends State<NearbyLockPage> {
|
||||
final logic = Get.put(NearbyLockLogic());
|
||||
final state = Get.find<NearbyLockLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -21,29 +28,34 @@ class _NearbyLockPageState extends State<NearbyLockPage> {
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.nearbyLock!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView.separated(
|
||||
itemCount: 5,
|
||||
itemBuilder: (c, index) {
|
||||
return nearbyLockItem(
|
||||
'images/icon_lockGroup_item.png', "MCBN01-ea9240", () {
|
||||
Navigator.pushNamed(context, Routers.lockAddressPage);
|
||||
});
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
indent: 20.w,
|
||||
endIndent: 0,
|
||||
);
|
||||
},
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
CupertinoActivityIndicator(radius: 18.w, color: Colors.white,),
|
||||
SizedBox(width: 30.w)
|
||||
],
|
||||
),
|
||||
body: Obx(() {
|
||||
return ListView.separated(
|
||||
itemCount: state.devices.length,
|
||||
itemBuilder: (c, index) {
|
||||
return nearbyLockItem('images/icon_lockGroup_item.png', state.devices[index], () {
|
||||
Navigator.pushNamed(context, Routers.lockAddressPage);
|
||||
});
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return Divider(
|
||||
height: 1,
|
||||
color: AppColors.greyLineColor,
|
||||
indent: 20.w,
|
||||
endIndent: 0,
|
||||
);
|
||||
},
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
Widget nearbyLockItem(
|
||||
String lockTypeIcon, String lockTypeTitle, Function() action) {
|
||||
Widget nearbyLockItem(String lockTypeIcon, DiscoveredDevice discoveredDevice, Function() action ) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Column(
|
||||
@ -65,11 +77,7 @@ class _NearbyLockPageState extends State<NearbyLockPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
lockTypeTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.blackColor),
|
||||
),
|
||||
Text(discoveredDevice.name, style: TextStyle(fontSize: 20.sp, color: AppColors.blackColor),),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
@ -95,7 +103,12 @@ class _NearbyLockPageState extends State<NearbyLockPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void onShow() {}
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
super.dispose();
|
||||
|
||||
void onHide() {}
|
||||
logic.logicGetxBle.scanner.stopScan();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class NearbyLockState {
|
||||
|
||||
var devices = <DiscoveredDevice>[].obs;
|
||||
|
||||
}
|
||||
@ -28,7 +28,7 @@ class _SaveLockPageState extends State<SaveLockPage> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(TranslationLoader.lanKeys!.addSuccessfullyPleaseRename!.tr, style: TextStyle(fontSize: 36.sp, fontWeight: FontWeight.w500),),
|
||||
Text(TranslationLoader.lanKeys!.addSuccessfullyPleaseRename!.tr, style: TextStyle(fontSize: 24.sp, fontWeight: FontWeight.w500),),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 80.h,),
|
||||
@ -43,7 +43,7 @@ class _SaveLockPageState extends State<SaveLockPage> {
|
||||
hintText: '请填写信息',
|
||||
hintStyle: TextStyle(
|
||||
// height: 1.1,
|
||||
fontSize: 30.sp,
|
||||
fontSize: 24.sp,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: const Color(0xFF999999)
|
||||
),
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../baseWidget.dart';
|
||||
// import '../../../tools/store_service.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
|
||||
|
||||
10
star_lock/lib/mine/mine/starLockMine_binding.dart
Normal file
10
star_lock/lib/mine/mine/starLockMine_binding.dart
Normal file
@ -0,0 +1,10 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'starLockMine_logic.dart';
|
||||
|
||||
class StarLockMineBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => StarLockMineLogic());
|
||||
}
|
||||
}
|
||||
27
star_lock/lib/mine/mine/starLockMine_logic.dart
Normal file
27
star_lock/lib/mine/mine/starLockMine_logic.dart
Normal file
@ -0,0 +1,27 @@
|
||||
import '../../tools/baseGetXController.dart';
|
||||
import 'starLockMine_state.dart';
|
||||
|
||||
class StarLockMineLogic extends BaseGetXController {
|
||||
final StarLockMineState state = StarLockMineState();
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
print("ready home");
|
||||
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
print("init home");
|
||||
super.onInit();
|
||||
state.initLoginData();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
print("close home");
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,13 +1,20 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/safetyVerification/entity/Data.dart';
|
||||
|
||||
import '../appRouters.dart';
|
||||
import '../app_settings/app_colors.dart';
|
||||
import '../baseWidget.dart';
|
||||
import '../tools/submitBtn.dart';
|
||||
import '../tools/titleAppBar.dart';
|
||||
import '../translations/trans_lib.dart';
|
||||
import '../../appRouters.dart';
|
||||
import '../../app_settings/app_colors.dart';
|
||||
import '../../baseWidget.dart';
|
||||
import '../../login/login/entity/LoginData.dart';
|
||||
import '../../login/login/entity/LoginEntity.dart';
|
||||
import '../../tools/store_service.dart';
|
||||
import '../../tools/submitBtn.dart';
|
||||
import '../../tools/titleAppBar.dart';
|
||||
import '../../translations/trans_lib.dart';
|
||||
import 'starLockMine_logic.dart';
|
||||
|
||||
class StarLockMinePage extends StatefulWidget {
|
||||
const StarLockMinePage({Key? key}) : super(key: key);
|
||||
@ -19,6 +26,9 @@ class StarLockMinePage extends StatefulWidget {
|
||||
GlobalKey<_StarLockMinePageState> starLockMineKey = GlobalKey();
|
||||
|
||||
class _StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
final logic = Get.put(StarLockMineLogic());
|
||||
final state = Get.find<StarLockMineLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -51,7 +61,7 @@ class _StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
height: 380.h,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
Center(
|
||||
Obx(() => Center(
|
||||
child: Column(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
@ -63,18 +73,22 @@ class _StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
// Navigator.pushNamed(context, Routers.starLockLoginPage);
|
||||
Navigator.pushNamed(context, Routers.minePersonInfoPage);
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 108.w,
|
||||
child: Container(
|
||||
width: 105.w,
|
||||
height: 105.w,
|
||||
child: Image.asset(
|
||||
'images/mine/icon_mine_main_defaultAvatar.png',
|
||||
width: 60.w,
|
||||
height: 60.w)),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(52.5.w)),
|
||||
),
|
||||
child:
|
||||
// state.headUrl().isNotEmpty ?
|
||||
// Image(image: NetworkImage(state.loginData.value.data!.headUrl!)) :
|
||||
Image.asset('images/mine/icon_mine_main_defaultAvatar.png', width: 60.w, height: 60.w)
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.h,
|
||||
),
|
||||
Text("15080825640",
|
||||
Text(state.mobile(),
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp,
|
||||
color: Colors.white,
|
||||
@ -83,14 +97,14 @@ class _StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
height: 10.h,
|
||||
),
|
||||
Text(
|
||||
"${TranslationLoader.lanKeys!.accountNumber!.tr}:15080825640",
|
||||
"${TranslationLoader.lanKeys!.accountNumber!.tr}:-",
|
||||
style: TextStyle(
|
||||
fontSize: 18.sp,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w500)),
|
||||
],
|
||||
),
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
54
star_lock/lib/mine/mine/starLockMine_state.dart
Normal file
54
star_lock/lib/mine/mine/starLockMine_state.dart
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../login/login/entity/LoginData.dart';
|
||||
import '../../login/login/entity/LoginEntity.dart';
|
||||
import '../../tools/storage.dart';
|
||||
|
||||
class StarLockMineState {
|
||||
|
||||
final loginData = LoginEntity().obs;
|
||||
|
||||
///本地存储 登录信息
|
||||
void saveLoginData(LoginEntity data) async {
|
||||
print("saveLoginData:${data.data!.mobile}");
|
||||
await Storage.setData('userLoginData',jsonEncode(data));
|
||||
loginData.value=data;
|
||||
}
|
||||
|
||||
///初始化本地数据
|
||||
void initLoginData() async {
|
||||
final data = await Storage.getData<String>('userLoginData');
|
||||
print("getLoginData:$data");
|
||||
if(data != null && data.isNotEmpty){
|
||||
loginData.value = LoginEntity.fromJson(jsonDecode(data));
|
||||
}
|
||||
}
|
||||
|
||||
///退出登录
|
||||
void logOut() async {
|
||||
await Storage.setData('userLoginData','');
|
||||
loginData.value = LoginEntity();
|
||||
}
|
||||
|
||||
///用户登录token
|
||||
String token(){
|
||||
return loginData.value.data?.accessToken??'';
|
||||
}
|
||||
|
||||
String mobile(){
|
||||
return loginData.value.data?.mobile??'-';
|
||||
}
|
||||
|
||||
///用户头像
|
||||
String headUrl(){
|
||||
return loginData.value.data!.headUrl??'';
|
||||
// return "https://img2.woyaogexing.com/2022/04/14/156cdbabd5bc496abee2cd0fca527434!400x400.jpeg";
|
||||
}
|
||||
|
||||
void onClose() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,6 @@ class MineMultiLanguageState {
|
||||
|
||||
void resetLan() {
|
||||
currentLanguageType.value = ExtensionLanguageType.fromLanguageCode(Get.locale!.languageCode);
|
||||
StoreService.to.saveLanguageCode(Get.locale!.languageCode);
|
||||
// StoreService.to.saveLanguageCode(Get.locale!.languageCode);
|
||||
}
|
||||
}
|
||||
11
star_lock/lib/nav/navBinding.dart
Normal file
11
star_lock/lib/nav/navBinding.dart
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'navLogic.dart';
|
||||
|
||||
class NavBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => NavLogic());
|
||||
}
|
||||
}
|
||||
9
star_lock/lib/nav/navLogic.dart
Normal file
9
star_lock/lib/nav/navLogic.dart
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
import '../tools/baseGetXController.dart';
|
||||
import 'navState.dart';
|
||||
|
||||
class NavLogic extends BaseGetXController {
|
||||
final NavState state = NavState();
|
||||
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:star_lock/mine/mine_page.dart';
|
||||
import 'package:star_lock/mine/mine/starLockMine_page.dart';
|
||||
|
||||
import 'app_settings/app_colors.dart';
|
||||
import 'main/lockMian/lockMain_page.dart';
|
||||
import '../app_settings/app_colors.dart';
|
||||
import '../main/lockMian/lockMain_page.dart';
|
||||
|
||||
class NavPages extends StatefulWidget {
|
||||
const NavPages({Key? key}) : super(key: key);
|
||||
@ -16,7 +16,7 @@ class NavPages extends StatefulWidget {
|
||||
class _NavPagesState extends State<NavPages> {
|
||||
int _currentIndex = 0;
|
||||
final List<Widget> _listPage = [
|
||||
StarLockMain(),
|
||||
const StarLockMainPage(),
|
||||
// StarLockMinePage(key: starLockMineKey),
|
||||
];
|
||||
|
||||
5
star_lock/lib/nav/navState.dart
Normal file
5
star_lock/lib/nav/navState.dart
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
class NavState{
|
||||
|
||||
}
|
||||
@ -4,10 +4,11 @@ abstract class Api {
|
||||
// final String baseUrl = "http://test.lock.star-lock.cn/api"; // 葛工
|
||||
final String baseUrl = "https://lock.star-lock.cn/api";// 测试环境
|
||||
|
||||
final String getVerificationCodeUrl = '/api/v1/vcode/email';
|
||||
// 登录注册
|
||||
final String getVerificationCodeUrl = '/user/sendValidationCode';
|
||||
final String registerUrl = '/user/register';
|
||||
final String getSliderVerifyImgUrl = '/user/getSliderVerifyImg';
|
||||
final String checkImgUrl = '/user/isSliderValid';
|
||||
final String loginUrl = '/api/v1/vcode/email';
|
||||
final String loginUrl = '/user/login';
|
||||
|
||||
}
|
||||
|
||||
@ -4,11 +4,27 @@ import 'api_provider_base.dart';
|
||||
|
||||
class ApiProvider extends BaseProvider {
|
||||
|
||||
Future<Response> requestForVCode(String email) => post(getVerificationCodeUrl.toUrl, null,query: {
|
||||
'email':email,
|
||||
Future<Response> getVerificationCode(
|
||||
String countryCode,
|
||||
String account,
|
||||
String channel,
|
||||
String uniqueid,
|
||||
String xWidth) => post(getVerificationCodeUrl.toUrl, null, query: {
|
||||
'countryCode':countryCode,
|
||||
'account':account,
|
||||
"channel":channel,
|
||||
'codeType':"1",
|
||||
"uniqueid":uniqueid,
|
||||
'xWidth':xWidth,
|
||||
});
|
||||
|
||||
Future<Response> register(String countryCode, String countryId, String mobile, String password, String uniqueid, String verificationCode) => post(registerUrl.toUrl, null,query: {
|
||||
Future<Response> register(
|
||||
String countryCode,
|
||||
String countryId,
|
||||
String mobile,
|
||||
String password,
|
||||
String uniqueid,
|
||||
String verificationCode) => post(registerUrl.toUrl, null,query: {
|
||||
'countryCode':countryCode,
|
||||
'countryId':countryId,
|
||||
"mobile":mobile,
|
||||
@ -18,18 +34,34 @@ class ApiProvider extends BaseProvider {
|
||||
'verificationCode':verificationCode,
|
||||
});
|
||||
|
||||
Future<Response> getSliderVerifyImg(String countryCode, String account) => post(getSliderVerifyImgUrl.toUrl, null,query: {
|
||||
Future<Response> getSliderVerifyImg(
|
||||
String countryCode,
|
||||
String account) => post(getSliderVerifyImgUrl.toUrl, null,query: {
|
||||
'countryCode':countryCode,
|
||||
'account':account,
|
||||
});
|
||||
|
||||
Future<Response> checkSliderVerifyImg(String countryCode, String account, String xWidth) => post(checkImgUrl.toUrl, null,query: {
|
||||
Future<Response> checkSliderVerifyImg(
|
||||
String countryCode,
|
||||
String account,
|
||||
String xWidth) => post(checkImgUrl.toUrl, null,query: {
|
||||
'countryCode':countryCode,
|
||||
'account':account,
|
||||
'xWidth':xWidth,
|
||||
});
|
||||
|
||||
Future<Response> login(String email,String password) => post(loginUrl.toUrl, null,query: {'email':email,'password':password});
|
||||
Future<Response> login(
|
||||
String loginType,
|
||||
String password,
|
||||
String countryCode,
|
||||
String username) => post(loginUrl.toUrl, null,query: {
|
||||
'loginType':loginType,
|
||||
'password':password,
|
||||
"platId":"2",
|
||||
'uniqueid':"477E6814-289D-402A-9F49-F89A8BD05D63",
|
||||
'countryCode':countryCode,
|
||||
"username":username
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -21,14 +21,15 @@ class BaseProvider extends GetConnect with Api {
|
||||
|
||||
@override
|
||||
Future<Response<T>> post<T>(String? url, body, {String? contentType, Map<String, String>? headers, Map<String, dynamic>? query, Decoder<T>? decoder, Progress? uploadProgress}) async {
|
||||
// print("post: url:${url} body:${body} contentType:${contentType} headers:${headers} query:${query}");
|
||||
var res = await super.post(url, body, contentType: contentType, headers:headers, query: query, decoder:decoder, uploadProgress: uploadProgress);
|
||||
if(res.body == null){
|
||||
if(EasyLoading.isShow)EasyLoading.dismiss(animation: true);
|
||||
var rs = {
|
||||
"msg": "Network Error!",
|
||||
"msgCode": -1,
|
||||
"errorMsg": "Network Error!",
|
||||
"errorCode": -1,
|
||||
"data": null,
|
||||
"code": 200
|
||||
"description": "表示成功或是。"
|
||||
};
|
||||
return Response(
|
||||
request: res.request,
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:get/get.dart';
|
||||
import '../common/safetyVerification/entity/CheckSafetyVerificationEntity.dart';
|
||||
import '../common/safetyVerification/entity/SafetyVerificationEntity.dart';
|
||||
import '../login/login/entity/LoginEntity.dart';
|
||||
import '../login/register/entity/SendValidationCodeEntity.dart';
|
||||
import 'api_provider.dart';
|
||||
|
||||
class ApiRepository {
|
||||
@ -12,30 +13,57 @@ class ApiRepository {
|
||||
static ApiRepository get to => Get.find<ApiRepository>();
|
||||
ApiRepository(this.apiProvider);
|
||||
|
||||
// Future<VerficationCodeEntity> requestForVCode(String email) async {
|
||||
// final res = await apiProvider.requestForVCode(email);
|
||||
// return VerficationCodeEntity.fromJson(res.body);
|
||||
// }
|
||||
//
|
||||
Future<LoginEntity> register(String countryCode, String countryId, String mobile, String password, String uniqueid, String verificationCode) async {
|
||||
// 发送验证码
|
||||
Future<SendValidationCodeEntity> sendValidationCode(
|
||||
String countryCode,
|
||||
String account,
|
||||
String channel,
|
||||
String uniqueid,
|
||||
String xWidth
|
||||
) async {
|
||||
final res = await apiProvider.getVerificationCode(countryCode, account, channel, uniqueid, xWidth);
|
||||
return SendValidationCodeEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// 注册
|
||||
Future<LoginEntity> register(
|
||||
String countryCode,
|
||||
String countryId,
|
||||
String mobile,
|
||||
String password,
|
||||
String uniqueid,
|
||||
String verificationCode
|
||||
) async {
|
||||
final res = await apiProvider.register(countryCode, countryId, mobile, password, uniqueid, verificationCode);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
Future<SafetyVerificationEntity> getSliderVerifyImg(String countryCode, String account) async {
|
||||
// 获取图片验证码
|
||||
Future<SafetyVerificationEntity> getSliderVerifyImg(
|
||||
String countryCode,
|
||||
String account
|
||||
) async {
|
||||
final res = await apiProvider.getSliderVerifyImg(countryCode, account);
|
||||
return SafetyVerificationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
Future<CheckSafetyVerificationEntity> checkSliderVerifyImg(String countryCode, String account, String xWidth) async {
|
||||
// 检验图片验证码
|
||||
Future<CheckSafetyVerificationEntity> checkSliderVerifyImg(
|
||||
String countryCode,
|
||||
String account,
|
||||
String xWidth) async {
|
||||
final res = await apiProvider.checkSliderVerifyImg(countryCode, account, xWidth);
|
||||
return CheckSafetyVerificationEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
// Future<LoginEntity> login({String? email,String? password}) async {
|
||||
// final res = await apiProvider.login(email,SecrecyUtils.md5EncodeUpperCase(input: password));
|
||||
// return LoginEntity.fromJson(res.body);
|
||||
// }
|
||||
Future<LoginEntity> login(
|
||||
String loginType,
|
||||
String password,
|
||||
String countryCode,
|
||||
String username) async {
|
||||
final res = await apiProvider.login(loginType, password, countryCode, username);
|
||||
return LoginEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,16 +1,26 @@
|
||||
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get/get_connect/http/src/request/request.dart';
|
||||
|
||||
import '../login/login/entity/LoginEntity.dart';
|
||||
import '../tools/platform_info_services.dart';
|
||||
import '../tools/storage.dart';
|
||||
import '../tools/store_service.dart';
|
||||
|
||||
FutureOr<Request> requestInterceptor(Request request) async {
|
||||
request.headers['User-Agent'] = 'StarLock/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}';
|
||||
request.headers['Accept-Language'] = 'zh_CN';
|
||||
request.headers['Content-Type'] = 'application/json';
|
||||
// request.headers['token'] = StoreService.to.userToken!;
|
||||
request.headers['Authorization'] = "Bearer ${StoreService.to.userToken!}";
|
||||
// print("11111${StoreService.to.userToken}");
|
||||
String? xToken = '';
|
||||
final data = await Storage.getData<String>('userLoginData');
|
||||
if(data != null && data.isNotEmpty){
|
||||
xToken = LoginEntity.fromJson(jsonDecode(data)).data!.accessToken;
|
||||
}
|
||||
request.headers['Authorization'] = "Bearer ${xToken ?? ''}";
|
||||
return request;
|
||||
}
|
||||
@ -1,7 +1,8 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'navPages.dart';
|
||||
import '../main/lockMian/lockMain_page.dart';
|
||||
|
||||
|
||||
class StarLockApplication extends StatefulWidget {
|
||||
const StarLockApplication({Key? key}) : super(key: key);
|
||||
@ -15,6 +16,7 @@ class _StarLockApplicationState extends State<StarLockApplication> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return NavPages();
|
||||
// return NavPages();
|
||||
return const StarLockMainPage();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'starLockApplication_logic.dart';
|
||||
|
||||
class StarLockApplicationBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.lazyPut(() => StarLockApplicationLogic());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
|
||||
import '../tools/baseGetXController.dart';
|
||||
import 'starLockApplication_state.dart';
|
||||
|
||||
class StarLockApplicationLogic extends BaseGetXController {
|
||||
final StarLockApplicationState state = StarLockApplicationState();
|
||||
|
||||
}
|
||||
@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
class StarLockApplicationState{
|
||||
|
||||
}
|
||||
@ -83,7 +83,7 @@ class BaseGetXController extends GetxController{
|
||||
Get.offAllNamed(Routers.starLockLoginPage);
|
||||
}
|
||||
|
||||
Future loginSuccess({LoginEntity? loginEntity, bool byToken = false}) async => ClientManager().loginSuccess(loginEntity: loginEntity,byToken: byToken);
|
||||
// Future loginSuccess({LoginEntity? loginEntity, bool byToken = false}) async => ClientManager().loginSuccess(loginEntity: loginEntity,byToken: byToken);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ class DeviceInfoService extends GetxService {
|
||||
if(dId.isNotEmpty){
|
||||
dId = const Uuid().v1();
|
||||
print('初始化设备ID:$dId');
|
||||
StoreService.to.saveDeviceId(dId);
|
||||
// StoreService.to.saveDeviceId(dId);
|
||||
}
|
||||
_deviceID = dId;
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// import 'package:hookii_robot/get_dom/services/store_service.dart';
|
||||
// import '../../get_dom/network/api_models/login/LoginEntity.dart';
|
||||
// import '../mower_manager/model_equipment.dart';
|
||||
import '../../login/login/entity/Data.dart' as ud;
|
||||
import '../../login/login/entity/LoginData.dart' as ud;
|
||||
import '../../login/login/entity/LoginEntity.dart';
|
||||
import '../store_service.dart';
|
||||
|
||||
@ -19,7 +19,7 @@ class ClientManager {
|
||||
|
||||
factory ClientManager() => shareManager();
|
||||
|
||||
List<ud.Data> devices = <ud.Data>[];
|
||||
List<ud.LoginData> devices = <ud.LoginData>[];
|
||||
|
||||
String vCode = '',cardText = '',password = '';
|
||||
bool isEmail = true;
|
||||
@ -43,15 +43,15 @@ class ClientManager {
|
||||
void resetDevices() => devices = [];
|
||||
|
||||
Future logOff() async {
|
||||
await StoreService.to.removeUserInfo();
|
||||
// await StoreService.to.removeUserInfo();
|
||||
resetDevices();
|
||||
}
|
||||
|
||||
Future loginSuccess({LoginEntity? loginEntity,bool byToken = false}) async {
|
||||
if(byToken){
|
||||
return;
|
||||
}
|
||||
await StoreService.to.saveLogInInfo(loginEntity!);
|
||||
}
|
||||
// Future loginSuccess({LoginEntity? loginEntity,bool byToken = false}) async {
|
||||
// if(byToken){
|
||||
// return;
|
||||
// }
|
||||
// await StoreService.to.saveLogInInfo(loginEntity!);
|
||||
// }
|
||||
|
||||
}
|
||||
@ -4,6 +4,8 @@ import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
// typedef ScanResultCallBack = Function(List<DiscoveredDevice> devices);
|
||||
typedef ScanResultCallBack = void Function(List<DiscoveredDevice> devices);
|
||||
/// 这个类负责开启和关闭蓝牙扫描器并输出扫描结果
|
||||
class BleScanner extends GetxController {
|
||||
BleScanner({
|
||||
@ -35,29 +37,30 @@ class BleScanner extends GetxController {
|
||||
final _devices = <DiscoveredDevice>[];
|
||||
|
||||
/// 开始扫描蓝牙设备
|
||||
void startScan(List<Uuid> serviceIds) {
|
||||
void startScan(ScanResultCallBack scanResultCallBack) {
|
||||
_logMessage('Start ble discovery');
|
||||
_devices.clear();
|
||||
_subscription?.cancel();
|
||||
_subscription = _ble.scanForDevices(withServices: serviceIds).listen((device) {
|
||||
print("11111111111111111:${device}");
|
||||
|
||||
final knownDeviceIndex = _devices.indexWhere((d) => d.id == device.id);
|
||||
|
||||
if (knownDeviceIndex >= 0) {
|
||||
_devices[knownDeviceIndex] = device;
|
||||
} else {
|
||||
// if (device.name.toLowerCase().contains((filter.name ?? "".toLowerCase()))) {
|
||||
// if (device.id.contains((filter.mac ?? ""))) {
|
||||
// if (device.rssi >= (filter.rssi ?? -100)) {
|
||||
_devices.add(device);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
_subscription = _ble.scanForDevices(withServices: []).listen((device) {
|
||||
// 判断名字为空的直接剃掉
|
||||
if(device.name.isEmpty){
|
||||
return;
|
||||
}
|
||||
_pushState();
|
||||
|
||||
if (((device.serviceUuids.isNotEmpty ? device.serviceUuids[0] : "").toString().contains("758824")) && (device.rssi >= -100)) {
|
||||
print("11111111111111111:${device}");
|
||||
final knownDeviceIndex = _devices.indexWhere((d) => d.id == device.id);
|
||||
|
||||
if (knownDeviceIndex >= 0) {
|
||||
_devices[knownDeviceIndex] = device;
|
||||
} else {
|
||||
_devices.add(device);
|
||||
}
|
||||
scanResultCallBack(_devices);
|
||||
}
|
||||
// _pushState();
|
||||
}, onError: (Object e) => _logMessage('Device scan fails with error: $e'));
|
||||
_pushState();
|
||||
// _pushState();
|
||||
}
|
||||
|
||||
/// 更新扫描结果
|
||||
|
||||
38
star_lock/lib/tools/storage.dart
Normal file
38
star_lock/lib/tools/storage.dart
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 持久话数据
|
||||
* */
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class Storage{
|
||||
///存数据
|
||||
static Future<void> setData(key, value) async {
|
||||
SharedPreferences sp = await SharedPreferences.getInstance();
|
||||
if (value is int) {
|
||||
await sp.setInt(key, value);
|
||||
} else if (value is bool) {
|
||||
await sp.setBool(key, value);
|
||||
} else if (value is double) {
|
||||
await sp.setDouble(key, value);
|
||||
} else if (value is String) {
|
||||
await sp.setString(key, value);
|
||||
} else if (value is List<String>) {
|
||||
await sp.setStringList(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
///取数据
|
||||
///
|
||||
static Future<T?> getData<T>(key) async {
|
||||
SharedPreferences sp = await SharedPreferences.getInstance();
|
||||
switch(T){
|
||||
case int: return (sp.getInt(key) ?? 0) as T;
|
||||
case bool: return (sp.getBool(key) ?? false) as T;
|
||||
case double: return (sp.getDouble(key) ?? 0.0) as T;
|
||||
case String: return (sp.getString(key) ?? '') as T;
|
||||
case List: return (sp.getStringList(key) ?? []) as T;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,5 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginData.dart';
|
||||
|
||||
import '../login/login/entity/LoginEntity.dart';
|
||||
|
||||
@ -9,7 +12,7 @@ class StoreService<T> extends GetxService {
|
||||
static StoreService get to => Get.find<StoreService>();
|
||||
Future<StoreService<T>> init() async {
|
||||
await GetStorage.init();
|
||||
await resetUserInfo();
|
||||
// await resetUserInfo();
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -18,42 +21,12 @@ class StoreService<T> extends GetxService {
|
||||
Future remove(String? key) => box.remove(key!);
|
||||
bool hasData(String? key) => box.hasData(key!);
|
||||
|
||||
|
||||
final String _loginUserInfoKey = 'LOGIN_USER_INFO';
|
||||
final String _deviceUUID = 'DEVICE_ID';
|
||||
final String _languageCode = 'LANGUAGE_CODE';
|
||||
final String _userAccount = 'USER_ACCOUNT';
|
||||
|
||||
|
||||
LoginEntity? _loginEntity;
|
||||
// LoginEntity get loginEntity => _loginEntity!;
|
||||
Future resetUserInfo() async{
|
||||
if(hasData(_loginUserInfoKey)){
|
||||
_loginEntity = LoginEntity.fromJson(box.read(_loginUserInfoKey));
|
||||
}
|
||||
}
|
||||
Future removeUserInfo() => remove(_loginUserInfoKey);
|
||||
|
||||
Future saveLogInInfo(LoginEntity entity) async {
|
||||
_loginEntity = LoginEntity.fromJson(entity.toJson());
|
||||
save(_loginUserInfoKey, entity.toJson());
|
||||
if(_loginEntity != null && _loginEntity!.content != null && _loginEntity!.content!.email != null && _loginEntity!.content!.email!.isNotEmpty) {
|
||||
save(_userAccount, _loginEntity?.content?.email);
|
||||
}
|
||||
}
|
||||
|
||||
// String getDeviceId() => hasData(_deviceUUID!) ? read(_deviceUUID!): "";
|
||||
Object? getDeviceId() => hasData(_deviceUUID) ? read(_deviceUUID): "";
|
||||
Future saveDeviceId(String uuid) => save(_deviceUUID, uuid);
|
||||
|
||||
// String getLanguageCode() => hasData(_languageCode) ? read(_languageCode): "";
|
||||
Object? getLanguageCode() => hasData(_languageCode) ? read(_languageCode): "";
|
||||
Future saveLanguageCode(String code) => save(_languageCode, code);
|
||||
|
||||
bool get hadToken => _loginEntity !=null && _loginEntity!.content!.token!.isNotEmpty;
|
||||
String? get userToken => hadToken ? _loginEntity!.content!.token : "";
|
||||
|
||||
// String getLastUserAccount() => hasData(_userAccount) ? read(_userAccount): "";
|
||||
void removeLastUserAccount() => remove(_userAccount);
|
||||
|
||||
// String get localUserAccount => getLastUserAccount();
|
||||
|
||||
}
|
||||
|
||||
116
star_lock/lib/tools/toast.dart
Normal file
116
star_lock/lib/tools/toast.dart
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
* 土司提示
|
||||
* author:付
|
||||
* */
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart' as ToastPlugins;
|
||||
|
||||
class Toast{
|
||||
/// 土司提示
|
||||
/// msg: 提示的信息
|
||||
/// gravity:显示的位置
|
||||
static show({required String msg,ToastPlugins.ToastGravity? gravity}){
|
||||
ToastPlugins.Fluttertoast.showToast(
|
||||
msg: msg,
|
||||
toastLength: ToastPlugins.Toast.LENGTH_SHORT,
|
||||
gravity: gravity??ToastPlugins.ToastGravity.CENTER,
|
||||
timeInSecForIosWeb: 1,
|
||||
backgroundColor: Colors.black,
|
||||
textColor: Colors.white,
|
||||
fontSize: 16.0
|
||||
);
|
||||
}
|
||||
|
||||
/// 显示模态弹窗
|
||||
/// context: 上下文
|
||||
/// title:标题
|
||||
/// content:内容
|
||||
/// confirmText:确认按钮文案
|
||||
/// confirmTextColor:确认按钮颜色 默认颜色 const Color(0xFFEE4A42)
|
||||
/// cancelText:取消按钮文案
|
||||
/// showCancel:是否显示取消按钮
|
||||
/// success: 确认按钮回调函数
|
||||
/// fail: 取消按钮回调函数
|
||||
static showModal({
|
||||
required BuildContext context,
|
||||
required String title,
|
||||
required String content,
|
||||
required String confirmText,
|
||||
required Function success,
|
||||
Color? confirmTextColor,
|
||||
String? cancelText,
|
||||
bool? showCancel,
|
||||
Function? fail
|
||||
}){
|
||||
confirmTextColor ??= const Color(0xFFE37549);
|
||||
showCancel ??= true;
|
||||
cancelText ??= '取消';
|
||||
showDialog(context: context, builder: (cxt){
|
||||
return AlertDialog(
|
||||
buttonPadding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
||||
contentPadding: EdgeInsets.fromLTRB( 55.w, 45.w, 55.w, 70.w),
|
||||
title: Text(title,textAlign: TextAlign.center,style: TextStyle(
|
||||
fontSize: 32.sp,
|
||||
color: const Color(0xff26313B),
|
||||
fontWeight:FontWeight.w400
|
||||
)),
|
||||
content: Text(content,style: TextStyle(
|
||||
fontSize: 28.sp,
|
||||
color: const Color(0xff666666),
|
||||
fontWeight:FontWeight.w400
|
||||
)),
|
||||
actions: <Widget>[
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
width: 1.w,//宽度
|
||||
color: const Color(0xFFEEEEEE), //边框颜色
|
||||
),
|
||||
)
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
showCancel==true?Expanded(child: GestureDetector(
|
||||
child: Container(
|
||||
height: 90.w,
|
||||
alignment: Alignment.center,
|
||||
child: Text(cancelText!,textAlign: TextAlign.center,style: TextStyle(
|
||||
fontSize: 28.sp
|
||||
)),
|
||||
),
|
||||
onTap: (){
|
||||
Navigator.of(cxt).pop();
|
||||
if(fail!=null){
|
||||
fail();
|
||||
}
|
||||
},
|
||||
)):const SizedBox(width: 0,height: 0),
|
||||
showCancel==true?Container(width: 1.w,height: 60.w,color: const Color(0xffEEEEEE)):const SizedBox(width: 0,height: 0),
|
||||
Expanded(child: GestureDetector(
|
||||
child: Container(
|
||||
height: 90.w,
|
||||
alignment: Alignment.center,
|
||||
child: Text(confirmText,textAlign: TextAlign.center,style: TextStyle(
|
||||
fontSize: 28.sp,
|
||||
color: confirmTextColor
|
||||
)),
|
||||
),
|
||||
onTap: (){
|
||||
Navigator.of(cxt).pop();
|
||||
if(success!=null){
|
||||
success();
|
||||
}
|
||||
},
|
||||
)),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -40,12 +40,15 @@ dependencies:
|
||||
|
||||
# 常用工具类
|
||||
flustars: ^2.0.1
|
||||
# 提示
|
||||
fluttertoast: ^8.2.2
|
||||
# 状态管理
|
||||
get: ^4.6.5
|
||||
# 获取设备信息
|
||||
device_info_plus: ^8.0.0
|
||||
# 本地储存
|
||||
get_storage: ^2.0.3
|
||||
shared_preferences: ^2.0.15
|
||||
# 获取唯一设备码
|
||||
uuid: ^3.0.6
|
||||
# 屏幕适配
|
||||
@ -77,6 +80,7 @@ dependencies:
|
||||
flutter_easyloading: ^3.0.5
|
||||
#图形验证码
|
||||
aj_captcha_flutter: ^0.0.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user