app-starlock/lib/mine/addLock/lockAddFaq/lockAddFaq_page.dart

238 lines
7.8 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/addLock/lockAddFaq/lockAddFaq_logic.dart';
import '../../../app_settings/app_colors.dart';
import '../../../tools/titleAppBar.dart';
class LockAddFaqPage extends StatefulWidget {
const LockAddFaqPage({Key? key}) : super(key: key);
@override
State<LockAddFaqPage> createState() => _LockAddFaqPageState();
}
class _LockAddFaqPageState extends State<LockAddFaqPage> {
final LockAddFaqLogic logic = Get.put(LockAddFaqLogic());
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: TitleAppBar(
barTitle: '常见问题'.tr,
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: ListView(
padding: EdgeInsets.all(20.w),
children: [
// 问题1蓝牙未开启或未授权
_buildFaqItem(
icon: Icons.bluetooth,
title: '蓝牙未开启或未授权'.tr,
description: '请确保手机蓝牙已开启并授权App使用蓝牙权限。'.tr,
solution: '检查手机设置中的蓝牙权限确保已授权给App。'.tr,
),
SizedBox(height: 20.h),
// 问题3锁电量过低
_buildFaqItem(
icon: Icons.battery_alert,
title: '锁电量过低'.tr,
description: '锁电量过低可能导致无法正常连接和添加。'.tr,
solution: '请更换电池后重试。'.tr,
),
SizedBox(height: 20.h),
// 问题5锁已被其他用户添加
_buildFaqItem(
icon: Icons.person_off,
title: '锁已被其他用户添加'.tr,
description: '如果锁已被其他用户添加,需要先解除绑定。'.tr,
solution: '请联系锁的管理员解除绑定,或使用管理员权限重置锁。'.tr,
),
SizedBox(height: 30.h),
// 问题6使用小程序
_buildFaqItem(
icon: Icons.phone_android,
title: '使用小程序'.tr,
description: '如果App无法正常添加锁可以尝试使用小程序版本。'.tr,
solution: '打开微信搜索“星星锁Lite”小程序尝试通过小程序添加锁。'.tr,
),
// 尝试升级按钮
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(horizontal: 20.w),
child: ElevatedButton.icon(
onPressed: logic.startOtaUpgrade,
icon: const Icon(Icons.system_update_alt, color: Colors.white),
label: Text(
'尝试升级固件'.tr,
style: TextStyle(
color: Colors.white,
2025-07-15 10:39:08 +08:00
fontSize: 20.sp, // 保持与项目一致
fontWeight: FontWeight.w500,
),
),
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.mainColor,
padding: EdgeInsets.symmetric(vertical: 15.h),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25.w),
),
elevation: 2,
),
),
),
SizedBox(height: 20.h),
// 升级说明
Container(
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: Colors.orange[50],
borderRadius: BorderRadius.circular(12.w),
border: Border.all(color: Colors.orange[200]!),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Icon(Icons.info_outline,
color: Colors.orange[700], size: 20.w),
SizedBox(width: 8.w),
Text(
'升级说明'.tr,
style: TextStyle(
2025-07-15 10:39:08 +08:00
fontSize: 20.sp, // 调整为项目标准
fontWeight: FontWeight.w600,
color: Colors.orange[700],
),
),
],
),
SizedBox(height: 8.h),
Text(
'如果以上方法都无法解决问题,可以尝试升级锁的固件。升级前请确保:'.tr,
style: TextStyle(
2025-07-15 10:39:08 +08:00
fontSize: 18.sp, // 调整为项目标准
color: Colors.orange[800],
),
),
SizedBox(height: 8.h),
Text(
'升级注意事项'.tr,
style: TextStyle(
2025-07-15 10:39:08 +08:00
fontSize: 16.sp, // 保持与项目一致
color: Colors.orange[800],
height: 1.4,
),
),
],
),
),
],
),
);
}
Widget _buildFaqItem({
required IconData icon,
required String title,
required String description,
required String solution,
}) {
return Container(
padding: EdgeInsets.all(16.w),
decoration: BoxDecoration(
color: Colors.grey[50],
borderRadius: BorderRadius.circular(12.w),
border: Border.all(color: Colors.grey[200]!),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 40.w,
height: 40.w,
decoration: BoxDecoration(
color: AppColors.mainColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(20.w),
),
child: Icon(
icon,
color: AppColors.mainColor,
2025-07-15 10:39:08 +08:00
size: 24.w,
),
),
SizedBox(width: 12.w),
Expanded(
child: Text(
title,
style: TextStyle(
2025-07-15 10:39:08 +08:00
fontSize: 22.sp, // 调整为项目标准
fontWeight: FontWeight.w600,
color: Colors.black87,
),
),
),
],
),
SizedBox(height: 12.h),
Text(
description,
style: TextStyle(
2025-07-15 10:39:08 +08:00
fontSize: 20.sp, // 调整为项目标准
color: Colors.black54,
height: 1.4,
),
),
SizedBox(height: 8.h),
Container(
padding: EdgeInsets.all(12.w),
decoration: BoxDecoration(
color: AppColors.mainColor.withOpacity(0.05),
borderRadius: BorderRadius.circular(8.w),
border: Border.all(color: AppColors.mainColor.withOpacity(0.2)),
),
child: Row(
2025-07-15 10:39:08 +08:00
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.lightbulb_outline,
color: AppColors.mainColor,
2025-07-15 10:39:08 +08:00
size: 20.w,
),
SizedBox(width: 8.w),
Expanded(
child: Text(
solution,
style: TextStyle(
2025-07-15 10:39:08 +08:00
fontSize: 18.sp, // 调整为项目标准
color: AppColors.mainColor,
fontWeight: FontWeight.w500,
height: 1.4,
),
),
),
],
),
),
],
),
);
}
}