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 createState() => _LockResetConfirmPageState(); } class _LockResetConfirmPageState extends State with BaseWidget { @override Widget build(BuildContext context) { return GetBuilder( 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, ), ), ), ], ), ); } }