184 lines
6.5 KiB
Dart
184 lines
6.5 KiB
Dart
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) {
|
|
// 判断是否为锁类型设备
|
|
final bool isLockType = logic.state.getLockType.value >= 1 &&
|
|
logic.state.getLockType.value <= 6;
|
|
final bool isAllDevices = logic.state.getLockType.value == 0;
|
|
|
|
// 根据设备类型设置文案
|
|
final String deviceType = isLockType ? '锁' : '设备';
|
|
final String title = isAllDevices ? '请确认设备已重置' : '请确认$deviceType已重置';
|
|
final String description = isAllDevices
|
|
? '添加设备前,请确保设备已重置为出厂状态。重置后的设备将清除所有用户数据。'
|
|
: '添加$deviceType前,请确保$deviceType已重置为出厂状态。重置后的$deviceType将清除所有用户数据,包括指纹、密码、卡片等信息。';
|
|
final String confirmButtonText =
|
|
isAllDevices ? '我已重置设备,继续添加' : '我已重置$deviceType,继续添加';
|
|
|
|
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(
|
|
title.tr,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: 24.sp, // 保持与项目一致
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.black87,
|
|
),
|
|
),
|
|
),
|
|
|
|
SizedBox(height: 30.h),
|
|
|
|
// 说明文字
|
|
Container(
|
|
width: 1.sw,
|
|
padding: EdgeInsets.symmetric(horizontal: 40.w),
|
|
child: Text(
|
|
description.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.blue[50],
|
|
borderRadius: BorderRadius.circular(12.w),
|
|
border: Border.all(
|
|
color: Colors.blue[200]!,
|
|
width: 1,
|
|
),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(
|
|
Icons.info_outline,
|
|
color: Colors.blue[700],
|
|
size: 24.w,
|
|
),
|
|
SizedBox(width: 12.w),
|
|
Expanded(
|
|
child: Text(
|
|
'重置方法请查阅设备说明书'.tr,
|
|
style: TextStyle(
|
|
fontSize: 20.sp, // 调整为项目标准
|
|
color: Colors.blue[700],
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
SizedBox(height: 60.h),
|
|
|
|
// 确认按钮
|
|
Container(
|
|
margin: EdgeInsets.symmetric(horizontal: 40.w),
|
|
child: SubmitBtn(
|
|
btnName: confirmButtonText.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: 22.sp,
|
|
color: Colors.grey[600],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
|
|
SizedBox(height: 40.h),
|
|
],
|
|
),
|
|
);
|
|
});
|
|
}
|
|
}
|