添加开锁动画,修改添加锁地图功能,地址信息非必填
This commit is contained in:
parent
1136402428
commit
08e6815d4a
BIN
star_lock/images/main/icon_main_openLockBtn_center.png
Normal file
BIN
star_lock/images/main/icon_main_openLockBtn_center.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 130 KiB |
BIN
star_lock/images/main/icon_main_openLockBtn_circle.png
Normal file
BIN
star_lock/images/main/icon_main_openLockBtn_circle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
star_lock/images/main/icon_main_openLockBtn_grey.png
Normal file
BIN
star_lock/images/main/icon_main_openLockBtn_grey.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
@ -98,6 +98,7 @@ import 'main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dar
|
||||
import 'main/lockDetail/passwordKey/passwordKeyList/passwordKeyList_page.dart';
|
||||
import 'main/lockDetail/passwordKey/passwordKeyManage/passwordKeyManage_page.dart';
|
||||
import 'main/lockMian/lockMain/lockMain_page.dart';
|
||||
import 'mine/addLock/addLockSeletCountry/addLockSeletCountry_page.dart';
|
||||
import 'mine/addLock/lockAddress/gaode/lockAddressGaoDe_page.dart';
|
||||
import 'mine/addLock/lockAddress/lockAddress/lockAddress_page.dart';
|
||||
import 'mine/addLock/nearbyLock/nearbyLock_page.dart';
|
||||
@ -335,6 +336,7 @@ abstract class Routers {
|
||||
static const webviewShowPage = '/webviewShowPage'; //网页
|
||||
static const demoModeLockDetailPage = '/DemoModeLockDetailPage'; // 演示模式锁详情页
|
||||
static const demoModeLockSetPage = '/DemoModeLockSetPage'; // 演示模式锁设置页
|
||||
static const addLockSeletCountryPage = '/AddLockSeletCountryPage'; // 演示模式锁设置页
|
||||
}
|
||||
|
||||
abstract class AppRouters {
|
||||
@ -830,5 +832,6 @@ abstract class AppRouters {
|
||||
GetPage(name: Routers.webviewShowPage, page: () => const WebviewShowPage()),
|
||||
GetPage(name: Routers.demoModeLockSetPage, page: () => const DemoModeLockSetPage()),
|
||||
GetPage(name: Routers.demoModeLockDetailPage, page: () => const DemoModeLockDetailPage()),
|
||||
GetPage(name: Routers.addLockSeletCountryPage, page: () => const AddLockSeletCountryPage()),
|
||||
];
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ class SenderAddFingerprintCommand extends SenderProtocol {
|
||||
subData.add(fingerNo!);
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(0xff);
|
||||
subData.add(useCountLimit!);
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
|
||||
@ -73,7 +73,7 @@ class SenderAddICCardCommand extends SenderProtocol {
|
||||
subData.add(cardNo!);
|
||||
|
||||
// UseCountLimit
|
||||
subData.add(0xff);
|
||||
subData.add(useCountLimit!);
|
||||
|
||||
// token
|
||||
subData.addAll(token!);
|
||||
|
||||
@ -21,8 +21,8 @@ import 'CheckingInInfoDataEntity.dart';
|
||||
import 'lockSet_state.dart';
|
||||
|
||||
typedef BlockSetStateCallback = void Function();
|
||||
typedef BlockSetCheckInCallback = void Function(
|
||||
CheckingInInfoDataEntity checkingInInfoDataEntity);
|
||||
typedef BlockSetCheckInCallback = void Function(CheckingInInfoDataEntity checkingInInfoDataEntity);
|
||||
typedef BlockDeletNumberCheckPasswordCallback = void Function();
|
||||
|
||||
class LockSetLogic extends BaseGetXController {
|
||||
final LockSetState state = LockSetState();
|
||||
@ -231,15 +231,34 @@ class LockSetLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 查询账户密码
|
||||
void checkLoginPassword() async {
|
||||
void checkLoginPassword(BlockDeletNumberCheckPasswordCallback blockDeletNumberCheckPasswordCallback) async {
|
||||
var entity = await ApiRepository.to.checkLoginPassword(
|
||||
password: state.passwordTF.text,
|
||||
);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if(state.getKeyInfosData.value.isLockOwner == 1){
|
||||
factoryDataResetAction();
|
||||
}else{
|
||||
deletKeyData();
|
||||
blockDeletNumberCheckPasswordCallback();
|
||||
if(state.currentDeviceUUid.value.isEmpty){
|
||||
Toast.show(msg: "未扫描到当前设备,请确保您在设备旁边、设备已开启、设备未被其他人连接");
|
||||
return;
|
||||
}
|
||||
if(state.currentDeviceUUid.value[31] == "1"){
|
||||
// 已配对
|
||||
if(state.getKeyInfosData.value.isLockOwner == 1){
|
||||
// 调用删除锁协议
|
||||
factoryDataResetAction();
|
||||
}else{
|
||||
// 调用删除钥匙协议
|
||||
deletUserAction();
|
||||
}
|
||||
}else if(state.currentDeviceUUid.value[31] == "0"){
|
||||
// 未配对
|
||||
if(state.getKeyInfosData.value.isLockOwner == 1){
|
||||
// 直接调用删除锁接口
|
||||
deletLockInfoData();
|
||||
}else{
|
||||
// 直接调用删除要是接口
|
||||
deletKeyData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -296,13 +315,21 @@ class LockSetLogic extends BaseGetXController {
|
||||
StreamSubscription? _passCurrentLockInformationEvent;
|
||||
void initLoadDataAction(BlockSetStateCallback blockSetStateCallback) {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_passCurrentLockInformationEvent =
|
||||
eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
|
||||
_passCurrentLockInformationEvent = eventBus.on<PassCurrentLockInformationEvent>().listen((event) {
|
||||
state.getKeyInfosData.value = event.keyInfo;
|
||||
blockSetStateCallback();
|
||||
});
|
||||
}
|
||||
|
||||
// Uuid删除当前锁时 有可能锁被初始化了 但后台没被初始化 当打开APP的时候扫描如果未被连接就传uuid过去 判断直接删除数据
|
||||
StreamSubscription? _scanAllDeviceFindCurrentDeviceConnectedEvent;
|
||||
void initLoadDataScanAllDeviceFindCurrentDeviceAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_scanAllDeviceFindCurrentDeviceConnectedEvent = eventBus.on<ScanAllDeviceFindCurrentDeviceConnectedEvent>().listen((event) {
|
||||
state.currentDeviceUUid.value = event.uuid;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
@ -310,6 +337,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
print("onReady()");
|
||||
|
||||
_initReplySubscription();
|
||||
initLoadDataScanAllDeviceFindCurrentDeviceAction();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -324,5 +352,6 @@ class LockSetLogic extends BaseGetXController {
|
||||
// TODO: implement onClose
|
||||
_replySubscription.cancel();
|
||||
_passCurrentLockInformationEvent!.cancel();
|
||||
_scanAllDeviceFindCurrentDeviceConnectedEvent!.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ -630,7 +630,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
Toast.show(msg: "请输入登录密码");
|
||||
return;
|
||||
}
|
||||
logic.checkLoginPassword();
|
||||
logic.checkLoginPassword((){
|
||||
Navigator.pop(context);
|
||||
});
|
||||
},
|
||||
cancelClick: () {
|
||||
Navigator.pop(context);
|
||||
|
||||
@ -8,6 +8,7 @@ class LockSetState {
|
||||
final getKeyInfosData = KeyInfos().obs;
|
||||
|
||||
var isAttendance = 1.obs;// 是否开启考勤
|
||||
var currentDeviceUUid = "".obs;// 当前设备的uuid
|
||||
var isLockPickingReminder = 1.obs;// 是否开启开锁提醒
|
||||
var passwordTF = TextEditingController();
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_editUser.dart';
|
||||
@ -23,6 +24,7 @@ import '../../../login/login/entity/LoginData.dart';
|
||||
import '../../../login/login/entity/LoginEntity.dart';
|
||||
import '../../../network/api_repository.dart';
|
||||
import '../../../tools/baseGetXController.dart';
|
||||
import '../../../tools/eventBusEventManage.dart';
|
||||
import '../../../tools/storage.dart';
|
||||
import 'lockDetail_state.dart';
|
||||
|
||||
@ -78,7 +80,10 @@ class LockDetailLogic extends BaseGetXController{
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
|
||||
state.lockState.value = 2;
|
||||
state.animationController.reset();
|
||||
state.animationController.forward();
|
||||
// state.animationController.isCompleted;
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
@ -434,11 +439,33 @@ class LockDetailLogic extends BaseGetXController{
|
||||
if (knownDeviceIndex >= 0) {
|
||||
BlueManage().connectDeviceMacAddress = v[knownDeviceIndex].id;
|
||||
connectBlue(v[knownDeviceIndex].id, state.keyInfos.value.bluetooth!.bluetoothDeviceName!);
|
||||
BlueManage().stopScan();
|
||||
eventBus.fire(ScanAllDeviceFindCurrentDeviceConnectedEvent(v[knownDeviceIndex].serviceUuids[0].toString()));
|
||||
// BlueManage().stopScan();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//开始连接
|
||||
startConnect() {
|
||||
state.lockState.value = 1;
|
||||
state.animationController.forward();
|
||||
openDoorAction();
|
||||
|
||||
Future.delayed(const Duration(seconds: 10), () {
|
||||
if(state.lockState.value == 1){
|
||||
stopConnect();
|
||||
state.lockState.value = 4;
|
||||
state.animationController.reset();
|
||||
state.animationController.forward();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//关闭连接
|
||||
stopConnect() {
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
@ -473,6 +500,7 @@ class LockDetailLogic extends BaseGetXController{
|
||||
// factoryDataResetAction();
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
|
||||
@ -31,7 +31,7 @@ class LockDetailPage extends StatefulWidget {
|
||||
State<LockDetailPage> createState() => _LockDetailPageState();
|
||||
}
|
||||
|
||||
class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
class _LockDetailPageState extends State<LockDetailPage> with TickerProviderStateMixin { // with RouteAware
|
||||
final logic = Get.put(LockDetailLogic());
|
||||
final state = Get.find<LockDetailLogic>().state;
|
||||
|
||||
@ -68,6 +68,8 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
// print("publicKeyData:$publicKeyData saveStrList:$saveStrList privateKeyData:$privateKeyData savePrivateKeyList:$savePrivateKeyList");
|
||||
|
||||
// logic.startScanAction();
|
||||
|
||||
listeningAnimations();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -124,29 +126,31 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
child: Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// logic.transferPermissionsAction();
|
||||
logic.openDoorAction();
|
||||
// logic.editLockUserAction();
|
||||
// logic.factoryDataResetAction();
|
||||
},
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_openLockBtn.png',
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
),
|
||||
)),
|
||||
// Visibility(
|
||||
// visible:
|
||||
// state.keyInfos.value.remoteEnable == 1 ? true : false,
|
||||
// child: Align(
|
||||
// alignment: const Alignment(0.6, 1),
|
||||
// child: Image.asset(
|
||||
// 'images/main/icon_main_remoteUnlocking.png',
|
||||
// width: 50.w,
|
||||
// height: 52.w,
|
||||
// ))),
|
||||
child:GestureDetector(
|
||||
child: Obx(() => Stack(
|
||||
children: [
|
||||
Image.asset(
|
||||
state.lockState.value == 4
|
||||
? 'images/main/icon_main_openLockBtn_grey.png'
|
||||
: 'images/main/icon_main_openLockBtn_center.png',
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
),
|
||||
(state.lockState.value == 1 || state.lockState.value == 3)
|
||||
? buildRotationTransition()
|
||||
: Positioned(
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_openLockBtn_circle.png',
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
)),
|
||||
],
|
||||
)),
|
||||
onTap: () {
|
||||
logic.startConnect();
|
||||
},
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -196,7 +200,7 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
width: 6.w,
|
||||
),
|
||||
Text(
|
||||
'超级管理员',
|
||||
state.keyInfos.value.isLockOwner == 1 ? '超级管理员' : (state.keyInfos.value.keyRight == 1 ? "授权管理员" : "普通用户"),
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp, color: AppColors.darkGrayTextColor),
|
||||
),
|
||||
@ -219,7 +223,7 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
Text(
|
||||
'网关设备',
|
||||
style:
|
||||
TextStyle(fontSize: 20.sp, color: AppColors.btnDisableColor),
|
||||
TextStyle(fontSize: 20.sp, color: state.keyInfos.value.remoteEnable == 1 ? AppColors.mainColor : AppColors.btnDisableColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -236,6 +240,24 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
);
|
||||
}
|
||||
|
||||
//旋转动画
|
||||
Widget buildRotationTransition() {
|
||||
return Positioned(
|
||||
child: RotationTransition(
|
||||
//设置动画的旋转中心
|
||||
alignment: Alignment.center,
|
||||
//动画控制器
|
||||
turns: state.animationController,
|
||||
//将要执行动画的子view
|
||||
child: Image.asset(
|
||||
'images/main/icon_main_openLockBtn_circle.png',
|
||||
width: 330.w,
|
||||
height: 330.w,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget bottomWidget() {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 40.h),
|
||||
@ -345,7 +367,7 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
bottomItem(
|
||||
'images/main/icon_main_set.png', TranslationLoader.lanKeys!.set!.tr,
|
||||
() {
|
||||
BlueManage().stopScan();
|
||||
// BlueManage().stopScan();
|
||||
Get.toNamed(Routers.lockSetPage, arguments: widget.keyInfo);
|
||||
}),
|
||||
];
|
||||
@ -381,20 +403,37 @@ class _LockDetailPageState extends State<LockDetailPage> with RouteAware {
|
||||
);
|
||||
}
|
||||
|
||||
listeningAnimations(){
|
||||
Future.delayed(Duration.zero, () {
|
||||
state.animationController = AnimationController(
|
||||
duration: const Duration(seconds: 30), vsync: this);
|
||||
state.animationController.repeat();
|
||||
//动画开始、结束、向前移动或向后移动时会调用StatusListener
|
||||
state.animationController.addStatusListener((status) {
|
||||
print("AnimationStatus:$status");
|
||||
if (status == AnimationStatus.completed) {
|
||||
state.animationController.forward();
|
||||
} else if (status == AnimationStatus.dismissed) {
|
||||
state.animationController.forward();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
// TODO: implement didChangeDependencies
|
||||
super.didChangeDependencies();
|
||||
|
||||
/// 路由订阅
|
||||
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||
// AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
/// 取消路由订阅
|
||||
AppRouteObserver().routeObserver.unsubscribe(this);
|
||||
// AppRouteObserver().routeObserver.unsubscribe(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,23 @@
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../lockMian/entity/lockInfoEntity.dart';
|
||||
|
||||
// enum RKConnectState {
|
||||
// NULL,
|
||||
// STOPPED, //已暂停连接 0
|
||||
// CONNECTING, //1 连接开锁中
|
||||
// CONNECTED, //2 已连接开锁成功
|
||||
// CHECKING, //检测可用性 3
|
||||
// CONNECTFAIL, //蓝牙连接失败 4
|
||||
// }
|
||||
|
||||
class LockDetailState {
|
||||
Rx<KeyInfos> keyInfos = KeyInfos().obs;
|
||||
|
||||
//过渡动画控制器
|
||||
late AnimationController animationController;
|
||||
var lockState = 0.obs;// 0未连接普通状态 1连接开锁中(展示动画) 2已连接开锁成功 3检测可用性 4连接失败
|
||||
}
|
||||
@ -208,7 +208,7 @@ class AddICCardLogic extends BaseGetXController{
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
cardNo:1,
|
||||
useCountLimit:1,
|
||||
useCountLimit:0xff,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
needAuthor:1,
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_addICCard.dart';
|
||||
import 'package:star_lock/blue/io_type.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
@ -33,6 +34,11 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
_replyAddFingerprintBegin(reply);
|
||||
}
|
||||
|
||||
// 添加卡片开始(重置锁里面所有卡)
|
||||
if((reply is SenderAddICCardReply) && (state.isDeletICCardData.value == true)) {
|
||||
_replyAddICCardBegin(reply);
|
||||
}
|
||||
|
||||
if(reply is SenderQueryingFingerprintStatusReply) {
|
||||
// 获取指纹状态
|
||||
_replyQueryingFingerprintStatus(reply);
|
||||
@ -48,12 +54,62 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _replyAddICCardBegin(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
print("_replyAddFingerprintStatus:$status");
|
||||
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType!.typeValue} 数据解析成功");
|
||||
state.isDeletFingerprintData.value = false;
|
||||
deletICCardData();
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 需要鉴权");
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
|
||||
IoSenderManage.senderAddICCardCommand(
|
||||
keyID:"1",
|
||||
userID:"DeleteAll!@#",
|
||||
cardNo:255,
|
||||
useCountLimit:0,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType!.typeValue} 用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType!.typeValue} 权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType!.typeValue} 失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 重置锁里面所有指纹
|
||||
Future<void> _replyAddFingerprintBegin(Reply reply) async {
|
||||
// var token = reply.data.sublist(2, 6);
|
||||
// var saveStrList = changeIntListToStringList(token);
|
||||
// print("_replyAddFingerprintReplyToken:$token");
|
||||
// Storage.setStringList(saveBlueToken, saveStrList);
|
||||
|
||||
int status = reply.data[2];
|
||||
print("status:$status");
|
||||
@ -79,13 +135,11 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
|
||||
IoSenderManage.senderAddFingerprintCommand(
|
||||
keyID:"1",
|
||||
userID:await Storage.getUid(),
|
||||
fingerNo:1,
|
||||
userID:"DeleteAll!@#",
|
||||
fingerNo:255,
|
||||
useCountLimit:0,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
// startTime:int.parse(state.startDate.value)~/1000,
|
||||
// endTime:int.parse(state.endDate.value)~/1000,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
@ -352,8 +406,36 @@ class OtherTypeKeyListLogic extends BaseGetXController{
|
||||
useCountLimit:0,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
// startTime:int.parse(state.startDate.value)~/1000,
|
||||
// endTime:int.parse(state.endDate.value)~/1000,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
token: getTokenList,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 重置所有卡片
|
||||
Future<void> senderAddICCard() async {
|
||||
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async {
|
||||
if (state == DeviceConnectionState.connected){
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
print("openDoorTokenPubToken:$getTokenList");
|
||||
|
||||
IoSenderManage.senderAddICCardCommand(
|
||||
keyID:"1",
|
||||
userID:"DeleteAll!@#",
|
||||
cardNo:255,
|
||||
useCountLimit:0,
|
||||
startTime:0x11223344,
|
||||
endTime:0x11223344,
|
||||
needAuthor:1,
|
||||
publicKey:publicKeyDataList,
|
||||
privateKey:getPrivateKeyList,
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -42,25 +43,7 @@ class _OtherTypeKeyListPageState extends State<OtherTypeKeyListPage> {
|
||||
onPressed: () async {
|
||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||
if(isDemoMode == false){
|
||||
switch (state.fromType.value) {
|
||||
case 0:
|
||||
// 卡
|
||||
state.isDeletICCardData.value = true;
|
||||
logic.deletICCardData();
|
||||
break;
|
||||
case 1:
|
||||
// 指纹
|
||||
// logic.deletAllFingerprintsData();
|
||||
state.isDeletFingerprintData.value = true;
|
||||
logic.senderAddFingerprint();
|
||||
break;
|
||||
case 2:
|
||||
// 遥控
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
showDeletAlertDialog(context);
|
||||
}else{
|
||||
// Get.toNamed(Routers.seletLockTypePage);
|
||||
Toast.show(msg: "演示模式");
|
||||
@ -291,4 +274,51 @@ class _OtherTypeKeyListPageState extends State<OtherTypeKeyListPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showDeletAlertDialog(
|
||||
BuildContext context,
|
||||
) {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text("提示"),
|
||||
content: const Text('重置后信息都会清除哦,确认要重置吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
switch (state.fromType.value) {
|
||||
case 0:
|
||||
// 卡
|
||||
state.isDeletICCardData.value = true;
|
||||
logic.senderAddICCard();
|
||||
break;
|
||||
case 1:
|
||||
// 指纹
|
||||
// logic.deletAllFingerprintsData();
|
||||
state.isDeletFingerprintData.value = true;
|
||||
logic.senderAddFingerprint();
|
||||
break;
|
||||
case 2:
|
||||
// 遥控
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import 'package:star_lock/mine/addLock/addLock/addLock_state.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../blue/blue_manage.dart';
|
||||
|
||||
class AddLockLogic extends BaseGetXController {
|
||||
final AddLockState state = AddLockState();
|
||||
|
||||
@ -8,6 +10,8 @@ class AddLockLogic extends BaseGetXController {
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
BlueManage().stopScan();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
|
||||
import '../../../tools/baseGetXController.dart';
|
||||
import 'addLockSeletCountry_state.dart';
|
||||
|
||||
class AddLockSeletCountryLogic extends BaseGetXController {
|
||||
AddLockSeletCountryState state = AddLockSeletCountryState();
|
||||
|
||||
}
|
||||
@ -0,0 +1,182 @@
|
||||
|
||||
import 'package:azlistview/azlistview.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../login/seletCountryRegion/common/countryRegionEntity.dart';
|
||||
import '../../../login/seletCountryRegion/common/utils.dart';
|
||||
import '../../../network/api_repository.dart';
|
||||
import '../../../tools/commonItem.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
import '../../../translations/trans_lib.dart';
|
||||
import 'addLockSeletCountry_logic.dart';
|
||||
|
||||
class AddLockSeletCountryPage extends StatefulWidget {
|
||||
const AddLockSeletCountryPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddLockSeletCountryPage> createState() => _AddLockSeletCountryPageState();
|
||||
}
|
||||
|
||||
class _AddLockSeletCountryPageState extends State<AddLockSeletCountryPage> {
|
||||
final logic = Get.put(AddLockSeletCountryLogic());
|
||||
final state = Get.find<AddLockSeletCountryLogic>().state;
|
||||
|
||||
List<CountryRegionModel> countriesList = [];
|
||||
int seletindex = 10000;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
SuspensionUtil.setShowSuspensionStatus(
|
||||
countriesList.cast<ISuspensionBean>());
|
||||
Future.delayed(const Duration(milliseconds: 20), () {
|
||||
getCountriesListRequest();
|
||||
});
|
||||
}
|
||||
|
||||
//请求国家/地区json文件
|
||||
Future<void> getCountriesListRequest() async {
|
||||
CountryRegionEntity entity = await ApiRepository.to.getCountryRegion('1');
|
||||
countriesList.clear();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
countriesList.addAll(entity.dataList!);
|
||||
_handleList(countriesList);
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> loadJsonFromAssets(String assetsPath) async {
|
||||
return await rootBundle.loadString(assetsPath);
|
||||
}
|
||||
|
||||
void _handleList(List<CountryRegionModel> list) {
|
||||
if (list.isEmpty) return;
|
||||
for (int i = 0, length = list.length; i < length; i++) {
|
||||
CountryRegionModel countryModel = list[i];
|
||||
String tag = countryModel.group!;
|
||||
if (RegExp('[A-Z]').hasMatch(tag)) {
|
||||
list[i].tagIndex = tag;
|
||||
} else {
|
||||
list[i].tagIndex = '#';
|
||||
}
|
||||
}
|
||||
// A-Z sort.
|
||||
SuspensionUtil.sortListBySuspensionTag(list);
|
||||
// show sus tag.
|
||||
SuspensionUtil.setShowSuspensionStatus(countriesList);
|
||||
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
appBar: TitleAppBar(
|
||||
barTitle:
|
||||
"请选择您的位置",
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: countriesList.length,
|
||||
itemBuilder: (c, index) {
|
||||
CountryRegionModel model = countriesList[index];
|
||||
return CommonItem(
|
||||
leftTitel: model.name,
|
||||
rightTitle: "",
|
||||
allHeight: 60.h,
|
||||
isHaveLine: true,
|
||||
isHaveRightWidget: true,
|
||||
action: (){
|
||||
setState(() {
|
||||
seletindex = index;
|
||||
});
|
||||
},
|
||||
rightWidget: Row(
|
||||
children: [
|
||||
Image.asset((seletindex == index) ? 'images/icon_round_selet.png' : 'images/icon_round_unSelet.png', width: 30.w, height: 30.w,),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 30.h, bottom: 30.h),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
"跳过",
|
||||
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
Get.toNamed(Routers.saveLockPage, arguments: {
|
||||
"addressInfo": {},
|
||||
"pwdTimestamp": state.pwdTimestamp.value,
|
||||
});
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.next!.tr,
|
||||
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
if(seletindex == 10000){
|
||||
Toast.show(msg: "请选择国家");
|
||||
return;
|
||||
}
|
||||
CountryRegionModel model = countriesList[seletindex];
|
||||
Get.toNamed(Routers.saveLockPage, arguments: {
|
||||
"addressInfo": {"country":model.name},
|
||||
"pwdTimestamp": state.pwdTimestamp.value,
|
||||
});
|
||||
// Navigator.pushNamed(context, Routers.saveLockPage);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
// body: AzListView(
|
||||
// data: countriesList,
|
||||
// itemCount: countriesList.length,
|
||||
// itemBuilder: (BuildContext context, int index) {
|
||||
// CountryRegionModel model = countriesList[index];
|
||||
// model.code = " ";
|
||||
// return Utils.getListItem(context, model, () {
|
||||
// Map<String, dynamic> resultMap = {};
|
||||
// resultMap['code'] = model.code;
|
||||
// resultMap['countryId'] = model.countryId.toString();
|
||||
// resultMap['countryName'] = model.name;
|
||||
// Navigator.pop(context, resultMap);
|
||||
// });
|
||||
// },
|
||||
// padding: EdgeInsets.zero,
|
||||
// susItemBuilder: (BuildContext context, int index) {
|
||||
// CountryRegionModel model = countriesList[index];
|
||||
// String tag = model.getSuspensionTag();
|
||||
// return Utils.getSusItem(context, tag);
|
||||
// },
|
||||
// // indexBarData: const ['★', ...kIndexBarData],
|
||||
// ),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class AddLockSeletCountryState{
|
||||
|
||||
var pwdTimestamp= 0.obs;
|
||||
AddLockSeletCountryState() {
|
||||
Map map = Get.arguments;
|
||||
pwdTimestamp.value = map["pwdTimestamp"];
|
||||
}
|
||||
}
|
||||
@ -99,111 +99,199 @@ class _LockAddressGaoDePageState extends State<LockAddressGaoDePage>{
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
backgroundColor: Colors.white,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: TranslationLoader.lanKeys!.lockAddress!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.next!.tr,
|
||||
style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
if(addressInfo!.isEmpty){
|
||||
Toast.show(msg:"还未获取到位置信息哦,请耐心等待一下!");
|
||||
return;
|
||||
}
|
||||
Get.toNamed(Routers.saveLockPage, arguments: {
|
||||
"addressInfo": addressInfo,
|
||||
"pwdTimestamp": state.pwdTimestamp.value,
|
||||
});
|
||||
// Navigator.pushNamed(context, Routers.saveLockPage);
|
||||
},
|
||||
),
|
||||
],
|
||||
// actionsList: [
|
||||
// TextButton(
|
||||
// child: Text(
|
||||
// TranslationLoader.lanKeys!.next!.tr,
|
||||
// style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
// ),
|
||||
// onPressed: () {
|
||||
// if(addressInfo!.isEmpty){
|
||||
// Toast.show(msg:"还未获取到位置信息哦,请耐心等待一下!");
|
||||
// return;
|
||||
// }
|
||||
// Get.toNamed(Routers.saveLockPage, arguments: {
|
||||
// "addressInfo": addressInfo,
|
||||
// "pwdTimestamp": state.pwdTimestamp.value,
|
||||
// });
|
||||
// // Navigator.pushNamed(context, Routers.saveLockPage);
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
),
|
||||
body:
|
||||
addressInfo != null ?
|
||||
Container(
|
||||
width: 1.sw,
|
||||
// height: 1.sh,
|
||||
child: Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
// height: 1.sh - 40.h,
|
||||
// width: 1.sw,
|
||||
child:
|
||||
(addressInfo!["address"].toString().isNotEmpty) ?
|
||||
AMapWidget(
|
||||
apiKey: amapApiKeys,
|
||||
// 初始化地图中心
|
||||
initialCameraPosition: (
|
||||
CameraPosition(
|
||||
target: LatLng(double.parse(addressInfo!['latitude'].toString()), double.parse(addressInfo!['longitude'].toString())),
|
||||
zoom: 10.0,
|
||||
)
|
||||
),
|
||||
//定位小蓝点
|
||||
myLocationStyleOptions: MyLocationStyleOptions(
|
||||
true,
|
||||
),
|
||||
// 普通地图normal,卫星地图satellite,夜间视图night,导航视图 navi,公交视图bus,
|
||||
mapType: MapType.normal,
|
||||
// 缩放级别范围
|
||||
minMaxZoomPreference: const MinMaxZoomPreference(3, 20),
|
||||
// 隐私政策包含高德 必须填写
|
||||
privacyStatement: const AMapPrivacyStatement(hasAgree: true, hasContains: true, hasShow: true),
|
||||
// 地图创建成功时返回AMapController
|
||||
onMapCreated: (AMapController controller) {
|
||||
mapController = controller;
|
||||
},
|
||||
)
|
||||
: Container(),
|
||||
ListView(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 25.w, top: 40.h, bottom: 40.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("地理位置", style: TextStyle(fontSize: 50.sp)),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
left: 20.w, right: 20.w, bottom: 100.h,
|
||||
child: Container(
|
||||
// height: h(106),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.mainColor,
|
||||
borderRadius: BorderRadius.circular(15.w),
|
||||
),
|
||||
child:Column(
|
||||
children: [
|
||||
Container(
|
||||
// height: h(53),
|
||||
padding: EdgeInsets.only(top: 15.h, bottom: 15, left:15.w, right: 15.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset('images/main/icon_addUserShowAddress.png', width: 30.w, height: 30.w),
|
||||
SizedBox(width: 10.w),
|
||||
Expanded(
|
||||
child: Text(addressInfo!["address"].toString() ?? "", style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500, overflow: TextOverflow.clip))
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// Container(height: 1.h, color: const Color(0xFF021732),),
|
||||
// Container(
|
||||
// // height: h(52),
|
||||
// padding: EdgeInsets.only(top: 15.h, bottom: 15, left:15.w, right: 15.w),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Image.asset('images/main/icon_addUserAddressShowTime.png', width: 30.w, height: 30.w),
|
||||
// SizedBox(width: 10.w,),
|
||||
// Expanded(
|
||||
// child: Text(DateTool().getNowDateYMDHM(), style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),)
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 1.sw/5*4,
|
||||
width: 1.sw,
|
||||
child:
|
||||
(addressInfo!["address"].toString().isNotEmpty) ?
|
||||
AMapWidget(
|
||||
apiKey: amapApiKeys,
|
||||
// 初始化地图中心
|
||||
initialCameraPosition: (
|
||||
CameraPosition(
|
||||
target: LatLng(double.parse(addressInfo!['latitude'].toString()), double.parse(addressInfo!['longitude'].toString())),
|
||||
zoom: 10.0,
|
||||
)
|
||||
),),
|
||||
],
|
||||
),
|
||||
),
|
||||
//定位小蓝点
|
||||
myLocationStyleOptions: MyLocationStyleOptions(
|
||||
true,
|
||||
),
|
||||
// 普通地图normal,卫星地图satellite,夜间视图night,导航视图 navi,公交视图bus,
|
||||
mapType: MapType.normal,
|
||||
// 缩放级别范围
|
||||
minMaxZoomPreference: const MinMaxZoomPreference(3, 20),
|
||||
// 隐私政策包含高德 必须填写
|
||||
privacyStatement: const AMapPrivacyStatement(hasAgree: true, hasContains: true, hasShow: true),
|
||||
// 地图创建成功时返回AMapController
|
||||
onMapCreated: (AMapController controller) {
|
||||
mapController = controller;
|
||||
},
|
||||
) : Container(),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 25.w, top: 20.h, right: 25.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("检查以确保以下地址是正确的", style: TextStyle(fontSize: 24.sp)),
|
||||
],
|
||||
),
|
||||
),
|
||||
// SizedBox(height: 20.h),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 25.w, top: 20.h, right: 25.w),
|
||||
// decoration: BoxDecoration(
|
||||
// color: AppColors.mainColor,
|
||||
// borderRadius: BorderRadius.circular(15.w),
|
||||
// ),
|
||||
child:Column(
|
||||
children: [
|
||||
Container(
|
||||
// height: h(53),
|
||||
// padding: EdgeInsets.only(top: 15.h, bottom: 15, left:15.w, right: 15.w),
|
||||
child: Row(
|
||||
children: [
|
||||
// Image.asset('images/main/icon_addUserShowAddress.png', width: 30.w, height: 30.w),
|
||||
// SizedBox(width: 10.w),
|
||||
Expanded(
|
||||
child: Text(addressInfo!["address"].toString() ?? "", style: const TextStyle(color: Colors.grey, fontSize: 16, fontWeight: FontWeight.w500, overflow: TextOverflow.clip))
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
Container(height: 1.h, color: AppColors.mainColor,),
|
||||
// Container(
|
||||
// // height: h(52),
|
||||
// padding: EdgeInsets.only(top: 15.h, bottom: 15, left:15.w, right: 15.w),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Image.asset('images/main/icon_addUserAddressShowTime.png', width: 30.w, height: 30.w),
|
||||
// SizedBox(width: 10.w,),
|
||||
// Expanded(
|
||||
// child: Text(DateTool().getNowDateYMDHM(), style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),)
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
)
|
||||
),
|
||||
SizedBox(height:200.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
"跳过",
|
||||
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
Get.toNamed(Routers.addLockSeletCountryPage, arguments: {
|
||||
"addressInfo": {},
|
||||
"pwdTimestamp": state.pwdTimestamp.value,
|
||||
});
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text(
|
||||
TranslationLoader.lanKeys!.next!.tr,
|
||||
style: TextStyle(color: Colors.black, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
if(addressInfo!.isEmpty){
|
||||
Toast.show(msg:"还未获取到位置信息哦,请耐心等待一下!");
|
||||
return;
|
||||
}
|
||||
Get.toNamed(Routers.saveLockPage, arguments: {
|
||||
"addressInfo": addressInfo,
|
||||
"pwdTimestamp": state.pwdTimestamp.value,
|
||||
});
|
||||
// Navigator.pushNamed(context, Routers.saveLockPage);
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
// Positioned(
|
||||
// left: 20.w, right: 20.w, bottom: 100.h,
|
||||
// child: Container(
|
||||
// // height: h(106),
|
||||
// decoration: BoxDecoration(
|
||||
// color: AppColors.mainColor,
|
||||
// borderRadius: BorderRadius.circular(15.w),
|
||||
// ),
|
||||
// child:Column(
|
||||
// children: [
|
||||
// Container(
|
||||
// // height: h(53),
|
||||
// padding: EdgeInsets.only(top: 15.h, bottom: 15, left:15.w, right: 15.w),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Image.asset('images/main/icon_addUserShowAddress.png', width: 30.w, height: 30.w),
|
||||
// SizedBox(width: 10.w),
|
||||
// Expanded(
|
||||
// child: Text(addressInfo!["address"].toString() ?? "", style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500, overflow: TextOverflow.clip))
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// // Container(height: 1.h, color: const Color(0xFF021732),),
|
||||
// // Container(
|
||||
// // // height: h(52),
|
||||
// // padding: EdgeInsets.only(top: 15.h, bottom: 15, left:15.w, right: 15.w),
|
||||
// // child: Row(
|
||||
// // children: [
|
||||
// // Image.asset('images/main/icon_addUserAddressShowTime.png', width: 30.w, height: 30.w),
|
||||
// // SizedBox(width: 10.w,),
|
||||
// // Expanded(
|
||||
// // child: Text(DateTool().getNowDateYMDHM(), style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w500),)
|
||||
// // ),
|
||||
// // ],
|
||||
// // ),
|
||||
// // ),
|
||||
// ],
|
||||
// )
|
||||
// ),),
|
||||
],
|
||||
)
|
||||
: const Center(child: Text('地图加载中,请稍候。。。')),
|
||||
);
|
||||
|
||||
@ -29,7 +29,10 @@ class NearbyLockLogic extends BaseGetXController{
|
||||
// 点击连接设备
|
||||
void connect(String lockId, String deviceName){
|
||||
// BlueManage().stopScan();
|
||||
BlueManage().connect(lockId, deviceName, isFrist: true, isShowLoading: true);
|
||||
BlueManage().judgeReconnect(lockId, deviceName, (DeviceConnectionState state) async {
|
||||
IoSenderManage.getPublicKey(lockId: deviceName);
|
||||
}, isShowLoading: true);
|
||||
// BlueManage().connect(lockId, deviceName, isFrist: true, isShowLoading: true);
|
||||
}
|
||||
|
||||
// 获取解析后的数据
|
||||
@ -157,7 +160,7 @@ class NearbyLockLogic extends BaseGetXController{
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
_replySubscription.cancel();
|
||||
BlueManage().stopScan();
|
||||
// BlueManage().stopScan();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ class _NearbyLockPageState extends State<NearbyLockPage> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// 第33、34两位00 表示休眠, 01表示唤醒
|
||||
// 第32、33两位00 表示休眠, 01表示唤醒
|
||||
Text(discoveredDevice.name, style: TextStyle(fontSize: 20.sp, color: ((discoveredDevice.serviceUuids.isNotEmpty ? discoveredDevice.serviceUuids[0] : "").toString()[33] == "1") ? AppColors.blackColor : Colors.grey)),
|
||||
],
|
||||
),
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:event_bus/event_bus.dart';
|
||||
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
/// 创建EventBus
|
||||
EventBus eventBus = EventBus();
|
||||
@ -30,3 +31,10 @@ class ChickInAddStaffCardAndFingerprintBlockNumberEvent{
|
||||
String number;
|
||||
ChickInAddStaffCardAndFingerprintBlockNumberEvent(this.number);
|
||||
}
|
||||
|
||||
|
||||
/// Uuid删除当前锁时 有可能锁被初始化了 但后台没被初始化 当打开APP的时候扫描如果未被连接就传uuid过去 判断直接删除数据
|
||||
class ScanAllDeviceFindCurrentDeviceConnectedEvent{
|
||||
String uuid;
|
||||
ScanAllDeviceFindCurrentDeviceConnectedEvent(this.uuid);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user