feat: 添加锁前增加重置锁流程及提示
This commit is contained in:
parent
2ffbc72d09
commit
fa270b77e0
@ -41,6 +41,7 @@ import 'package:star_lock/main/lockDetail/palm/palmList/palmList_page.dart';
|
||||
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetailChangeDate/passwordKeyDetailChangeDate_page.dart';
|
||||
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_page.dart';
|
||||
import 'package:star_lock/mine/about/webviewShow_page.dart';
|
||||
import 'package:star_lock/mine/addLock/lockResetConfirm/lockResetConfirm_page.dart';
|
||||
import 'package:star_lock/mine/mine/safeVerify/safeVerify_page.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEmail/mineBindPhoneOrEmail_page.dart';
|
||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
||||
@ -514,6 +515,7 @@ abstract class Routers {
|
||||
static const String starChartPage = '/starChartPage'; //星图
|
||||
static const String starChartTalkView = '/starChartTalkView'; //星图对讲页面
|
||||
static const String h264WebView = '/h264WebView'; //星图对讲页面
|
||||
static const String lockResetConfirmPage = '/LockResetConfirmPage'; // 重置锁确认页面
|
||||
}
|
||||
|
||||
abstract class AppRouters {
|
||||
@ -1185,5 +1187,9 @@ abstract class AppRouters {
|
||||
GetPage<dynamic>(
|
||||
name: Routers.starChartTalkView, page: () => const TalkViewPage()),
|
||||
GetPage<dynamic>(name: Routers.h264WebView, page: () => H264WebView()),
|
||||
GetPage<dynamic>(
|
||||
name: Routers.lockResetConfirmPage,
|
||||
page: () => const LockResetConfirmPage(),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
@ -40,12 +39,8 @@ class _AddLockPageState extends State<AddLockPage> with BaseWidget {
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
// mainAxisAlignment: MainAxisAlignment.center,
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 100.h,
|
||||
),
|
||||
SizedBox(height: 100.h),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
@ -57,17 +52,13 @@ class _AddLockPageState extends State<AddLockPage> with BaseWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
),
|
||||
SizedBox(height: 120.h),
|
||||
Obx(() => Image.asset(
|
||||
logic.state.lockTypeImg.value,
|
||||
width: 278.w,
|
||||
height: 278.w,
|
||||
)),
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
),
|
||||
SizedBox(height: 120.h),
|
||||
Container(
|
||||
width: 1.sw,
|
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||
@ -78,14 +69,12 @@ class _AddLockPageState extends State<AddLockPage> with BaseWidget {
|
||||
'摸亮触摸屏,锁进入可添加状态,点击下一步'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp,fontWeight: FontWeight.w500),
|
||||
fontSize: 20.sp, fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 120.h,
|
||||
),
|
||||
SizedBox(height: 120.h),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20.w, right: 20.w),
|
||||
child: SubmitBtn(
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/mine/addLock/lockResetConfirm/lockResetConfirm_state.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
class LockResetConfirmLogic extends BaseGetXController {
|
||||
final LockResetConfirmState state = LockResetConfirmState();
|
||||
|
||||
// 确认锁已重置,继续添加流程
|
||||
void confirmLockReset() {
|
||||
// 跳转到添加锁页面,传递锁类型参数
|
||||
Get.toNamed(Routers.addLockPage, arguments: {
|
||||
'getLockType': state.getLockType.value,
|
||||
});
|
||||
}
|
||||
}
|
||||
207
lib/mine/addLock/lockResetConfirm/lockResetConfirm_page.dart
Normal file
207
lib/mine/addLock/lockResetConfirm/lockResetConfirm_page.dart
Normal file
@ -0,0 +1,207 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/addLock/lockResetConfirm/lockResetConfirm_logic.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
import '../../../baseWidget.dart';
|
||||
import '../../../tools/submitBtn.dart';
|
||||
import '../../../tools/titleAppBar.dart';
|
||||
|
||||
class LockResetConfirmPage extends StatefulWidget {
|
||||
const LockResetConfirmPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<LockResetConfirmPage> createState() => _LockResetConfirmPageState();
|
||||
}
|
||||
|
||||
class _LockResetConfirmPageState extends State<LockResetConfirmPage>
|
||||
with BaseWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<LockResetConfirmLogic>(
|
||||
init: LockResetConfirmLogic(),
|
||||
builder: (LockResetConfirmLogic logic) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: F.sw(
|
||||
skyCall: () => TitleAppBar(
|
||||
barTitle: '重置锁确认'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
),
|
||||
xhjCall: () => TitleAppBar(
|
||||
barTitle: '重置锁确认'.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: Colors.white,
|
||||
iconColor: AppColors.blackColor,
|
||||
titleColor: AppColors.blackColor,
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
SizedBox(height: 60.h),
|
||||
|
||||
// 重置锁图标
|
||||
Container(
|
||||
width: 120.w,
|
||||
height: 120.w,
|
||||
margin: EdgeInsets.symmetric(horizontal: 1.sw / 2 - 60.w),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.mainColor.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(60.w),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.refresh,
|
||||
size: 60.w,
|
||||
color: AppColors.mainColor,
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 40.h),
|
||||
|
||||
// 标题
|
||||
Container(
|
||||
width: 1.sw,
|
||||
padding: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
child: Text(
|
||||
'请确认锁已重置'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 30.h),
|
||||
|
||||
// 说明文字
|
||||
Container(
|
||||
width: 1.sw,
|
||||
padding: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
child: Text(
|
||||
'添加锁前,请确保锁已重置为出厂状态。重置后的锁将清除所有用户数据,包括指纹、密码、卡片等信息。'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp,
|
||||
color: Colors.black54,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 50.h),
|
||||
|
||||
// 重置步骤说明
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 30.w),
|
||||
padding: EdgeInsets.all(20.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[50],
|
||||
borderRadius: BorderRadius.circular(12.w),
|
||||
border: Border.all(
|
||||
color: Colors.grey[200]!,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'重置锁步骤:'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 15.h),
|
||||
_buildStepItem('1', '找到锁上的重置按钮或重置孔'.tr),
|
||||
_buildStepItem('2', '使用重置工具(如针或牙签)长按重置按钮'.tr),
|
||||
_buildStepItem('3', '听到"滴"声或看到指示灯闪烁'.tr),
|
||||
_buildStepItem('4', '等待锁完成重置,指示灯常亮或熄灭'.tr),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 60.h),
|
||||
|
||||
// 确认按钮
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
child: SubmitBtn(
|
||||
btnName: '我已重置锁,继续添加'.tr,
|
||||
borderRadius: 25.w,
|
||||
onClick: () {
|
||||
logic.confirmLockReset();
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 20.h),
|
||||
|
||||
// 取消按钮
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 40.w),
|
||||
child: TextButton(
|
||||
onPressed: Get.back,
|
||||
child: Text(
|
||||
'取消'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 20.sp,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 40.h),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildStepItem(String number, String text) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: 12.h),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 24.w,
|
||||
height: 24.w,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.mainColor,
|
||||
borderRadius: BorderRadius.circular(12.w),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
number,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16.sp,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12.w),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 16.sp,
|
||||
color: Colors.black87,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LockResetConfirmState {
|
||||
LockResetConfirmState() {
|
||||
// 从路由参数中获取锁类型信息
|
||||
final Map? map = Get.arguments;
|
||||
if (map is Map && map.isNotEmpty) {
|
||||
if (map['getLockType'] != null) {
|
||||
getLockType.value = map['getLockType'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RxInt getLockType = 1.obs; // 锁类型
|
||||
}
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
@ -13,16 +12,25 @@ import 'selectLockType_state.dart';
|
||||
class SelectLockTypeLogic extends BaseGetXController {
|
||||
SelectLockTypeState state = SelectLockTypeState();
|
||||
|
||||
void getServerDatetime() async{
|
||||
var entity = await ApiRepository.to.getServerDatetimeData(isUnShowLoading:true);
|
||||
if(entity.errorCode!.codeIsSuccessful){
|
||||
}
|
||||
void getServerDatetime() async {
|
||||
var entity =
|
||||
await ApiRepository.to.getServerDatetimeData(isUnShowLoading: true);
|
||||
if (entity.errorCode!.codeIsSuccessful) {}
|
||||
}
|
||||
|
||||
// 跳转到重置锁确认页面
|
||||
void goToLockResetConfirm(int lockType) {
|
||||
CommonDataManage().seletLockType = lockType;
|
||||
Get.toNamed(Routers.lockResetConfirmPage, arguments: {
|
||||
'getLockType': lockType,
|
||||
});
|
||||
}
|
||||
|
||||
//跳转到附近的锁页面先判断权限
|
||||
Future<void> getNearByLimits() async {
|
||||
if (!Platform.isIOS) {
|
||||
final bool locationRequest = await PermissionDialog.request(Permission.location);
|
||||
final bool locationRequest =
|
||||
await PermissionDialog.request(Permission.location);
|
||||
final bool bluetoothRequest = await PermissionDialog.requestBluetooth();
|
||||
if (!bluetoothRequest || !locationRequest) {
|
||||
return;
|
||||
@ -35,7 +43,6 @@ class SelectLockTypeLogic extends BaseGetXController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
getServerDatetime();
|
||||
}
|
||||
|
||||
@ -43,4 +50,4 @@ class SelectLockTypeLogic extends BaseGetXController {
|
||||
void onClose() {
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,37 +79,25 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
|
||||
List<Widget> getLockTypeList() {
|
||||
return <Widget>[
|
||||
lockTypeItem('images/lockType/lockType_doorLock.png', '门锁'.tr, () {
|
||||
CommonDataManage().seletLockType = 1;
|
||||
Get.toNamed(Routers.addLockPage,
|
||||
arguments: <String, int>{'getLockType': 1});
|
||||
logic.goToLockResetConfirm(1);
|
||||
}),
|
||||
// if (!F.isLite)
|
||||
lockTypeItem('images/lockType/lockType_NFCLock.png', 'NFC无源锁'.tr, () {
|
||||
CommonDataManage().seletLockType = 2;
|
||||
// Navigator.pushNamed(context, Routers.addLockPage);
|
||||
logic.getNearByLimits();
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_NFCLock.png', 'NFC无源锁'.tr, () {
|
||||
logic.goToLockResetConfirm(2);
|
||||
}),
|
||||
// if (!F.isLite)
|
||||
lockTypeItem('images/lockType/lockType_padlock.png', '挂锁'.tr, () {
|
||||
CommonDataManage().seletLockType = 3;
|
||||
// Navigator.pushNamed(context, Routers.addLockPage);
|
||||
logic.getNearByLimits();
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_padlock.png', '挂锁'.tr, () {
|
||||
logic.goToLockResetConfirm(3);
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_safeLock.png', '保险箱锁'.tr, () {
|
||||
CommonDataManage().seletLockType = 4;
|
||||
Navigator.pushNamed(context, Routers.addLockPage,
|
||||
arguments: <String, int>{'getLockType': 4});
|
||||
logic.goToLockResetConfirm(4);
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_parkingLock.png', '车位锁'.tr, () {
|
||||
CommonDataManage().seletLockType = 5;
|
||||
Navigator.pushNamed(context, Routers.addLockPage,
|
||||
arguments: <String, int>{'getLockType': 5});
|
||||
logic.goToLockResetConfirm(5);
|
||||
}),
|
||||
lockTypeItem('images/lockType/lockType_entranceGuardLock.png', '智能门禁'.tr,
|
||||
() {
|
||||
CommonDataManage().seletLockType = 6;
|
||||
Navigator.pushNamed(context, Routers.addLockPage,
|
||||
arguments: <String, int>{'getLockType': 6});
|
||||
logic.goToLockResetConfirm(6);
|
||||
}),
|
||||
|
||||
// lockTypeItem('images/lockType/lockType_bicycleLock.png',
|
||||
@ -124,7 +112,6 @@ class _SelectLockTypePageState extends State<SelectLockTypePage>
|
||||
// if (!F.isLite)
|
||||
lockTypeItem('images/lockType/lockType_camera.png', '网络摄像头'.tr, () {
|
||||
CommonDataManage().seletLockType = 8;
|
||||
// Navigator.pushNamed(context, Routers.gatewayListPage);
|
||||
logic.getNearByLimits();
|
||||
}),
|
||||
];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user