关怀模式

This commit is contained in:
Developer
2026-04-02 22:30:49 +08:00
parent 09fee0694c
commit 7872f2e78a
70 changed files with 4884 additions and 2752 deletions

View File

@@ -1,13 +1,13 @@
/// 时间: 2026-03-30
/// 功能: 已知bug列表页面
/// 介绍: 显示应用已知bug、解决方法和解决时间的底部弹窗页面
/// 最新变化: 新增bug列表页面支持下拉刷新和滚动查看
/// 最新变化: 新增bug列表页面支持下拉刷新和滚动查看, 支持动态主题色
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import '../../../constants/app_constants.dart';
import '../../../models/colors/app_colors.dart';
import '../../../services/get/theme_controller.dart';
class BugListPage extends StatefulWidget {
@@ -70,7 +70,7 @@ class _BugListPageState extends State<BugListPage> {
'description': '暂未适配横屏',
'severity': 'high',
'status': 'pending',
'solution': '增加重试机制和离线缓存功能',
'solution': '预计下个月适配横屏',
'reproduction': '1. 开启屏幕旋转,手机横屏',
'resolveTime': '适配中',
'reportTime': '2026-03-22',
@@ -108,7 +108,7 @@ class _BugListPageState extends State<BugListPage> {
},
{
'id': 7,
'title': '主页点击上一条 显示无上一条',
'title': '主页点击"上一条" 显示无上一条',
'description': '未读取到历史记录',
'severity': 'high',
'status': 'in_progress',
@@ -149,6 +149,20 @@ class _BugListPageState extends State<BugListPage> {
'expanded': false, // 解决方案展开状态
'reproductionExpanded': false, // 复现步骤展开状态
},
{
'id': 12,
'title': '显示错误的分享',
'description': '点击分享后,取消分享,依旧显示分享成功',
'severity': 'low',
'status': 'pending',
'solution': '全部触发',
'reproduction': '主页 点击分享 取消分享 显示分享成功',
'resolveTime': '暂无修复计划',
'reportTime': '2026-03-18',
'affectedUsers': '多数用户',
'expanded': false, // 解决方案展开状态
'reproductionExpanded': false, // 复现步骤展开状态
},
{
'id': 10,
@@ -156,7 +170,7 @@ class _BugListPageState extends State<BugListPage> {
'description': '未读取到历史记录',
'severity': 'low',
'status': '',
'solution': '用户短时间内多次刷新获取api数据导致服务器启动防止cc自我保护机制不会此ip下放数据',
'solution': '用户短时间内多次刷新获取api数据导致服务器启动防止cc自我保护机制不会此ip下放数据',
'reproduction': '天气频繁切换导致温度显示异常999',
'resolveTime': '下个版本',
'reportTime': '2026-03',
@@ -214,24 +228,22 @@ class _BugListPageState extends State<BugListPage> {
Color _getSeverityColor(String severity) {
switch (severity) {
case 'high':
return Colors.red;
return AppColors.iosRed;
case 'medium':
return Colors.orange;
return AppColors.iosOrange;
case 'low':
return Colors.green;
return AppColors.iosGreen;
default:
return Colors.grey;
return AppColors.iosGray;
}
}
String _getSeverityText(String severity) {
switch (severity) {
case 'high':
// 高优先级默认红色
return '';
case 'medium':
return '';
case 'low':
return '';
default:
@@ -242,17 +254,13 @@ class _BugListPageState extends State<BugListPage> {
Color _getStatusColor(String status) {
switch (status) {
case 'resolved':
// 已解决状态默认绿色
return Colors.green;
return AppColors.iosGreen;
case 'in_progress':
// 解决中状态默认蓝色
return Colors.blue;
return AppColors.iosBlue;
case 'pending':
// 待解决状态默认橙色
return Colors.orange;
return AppColors.iosOrange;
default:
return Colors.grey;
// 未知状态默认灰色
return AppColors.iosGray;
}
}
@@ -270,9 +278,7 @@ class _BugListPageState extends State<BugListPage> {
}
Future<void> _refresh() async {
// 模拟网络请求延迟
await Future.delayed(const Duration(seconds: 1));
HapticFeedback.lightImpact();
}
@@ -282,18 +288,16 @@ class _BugListPageState extends State<BugListPage> {
final isDark = _themeController.isDarkMode;
return Container(
decoration: BoxDecoration(
color: isDark ? const Color(0xFF1A1A1A) : Colors.white,
color: AppColors.background,
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
),
child: Column(
children: [
// 顶部拖拽条和标题
_buildHeader(isDark),
// bug列表
Expanded(
child: RefreshIndicator(
onRefresh: _refresh,
color: AppConstants.primaryColor,
color: AppColors.primary,
child: ListView.builder(
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(),
@@ -318,24 +322,22 @@ class _BugListPageState extends State<BugListPage> {
Widget _buildHeader(bool isDark) {
return Column(
children: [
// 拖拽条
Container(
width: 40,
height: 4,
margin: const EdgeInsets.only(top: 8),
decoration: BoxDecoration(
color: isDark ? Colors.grey[600] : Colors.grey[300],
color: AppColors.divider,
borderRadius: BorderRadius.circular(2),
),
),
// 标题栏
Container(
padding: const EdgeInsets.all(16),
child: Row(
children: [
Icon(
Icons.bug_report,
color: AppConstants.primaryColor,
color: AppColors.primary,
size: 24,
),
const SizedBox(width: 12),
@@ -345,7 +347,7 @@ class _BugListPageState extends State<BugListPage> {
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: AppConstants.primaryColor,
color: AppColors.primary,
),
),
),
@@ -353,13 +355,13 @@ class _BugListPageState extends State<BugListPage> {
onPressed: () => Navigator.pop(context),
child: Text(
'关闭',
style: TextStyle(color: isDark ? Colors.white : null),
style: TextStyle(color: AppColors.primaryText),
),
),
],
),
),
Divider(height: 1, color: isDark ? Colors.grey[700] : null),
Divider(height: 1, color: AppColors.divider),
],
);
}
@@ -375,7 +377,7 @@ class _BugListPageState extends State<BugListPage> {
Container(
width: 40,
height: 1,
color: isDark ? Colors.grey[600] : Colors.grey[300],
color: AppColors.divider,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
@@ -383,14 +385,14 @@ class _BugListPageState extends State<BugListPage> {
'已经到底了',
style: TextStyle(
fontSize: 13,
color: isDark ? Colors.grey[400] : Colors.grey[500],
color: AppColors.tertiaryText,
),
),
),
Container(
width: 40,
height: 1,
color: isDark ? Colors.grey[600] : Colors.grey[300],
color: AppColors.divider,
),
],
),
@@ -399,7 +401,7 @@ class _BugListPageState extends State<BugListPage> {
'${_bugs.length} 个已知问题',
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[500] : Colors.grey[400],
color: AppColors.tertiaryText,
),
),
],
@@ -413,10 +415,10 @@ class _BugListPageState extends State<BugListPage> {
return Container(
margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
color: AppColors.surface,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: isDark ? Colors.grey[700]! : Colors.grey[200]!,
color: AppColors.divider,
),
boxShadow: [
BoxShadow(
@@ -429,13 +431,11 @@ class _BugListPageState extends State<BugListPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 顶部信息行
Container(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// 标题和状态标签
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -445,7 +445,7 @@ class _BugListPageState extends State<BugListPage> {
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: isDark ? Colors.white : Colors.black87,
color: AppColors.primaryText,
),
),
),
@@ -477,17 +477,15 @@ class _BugListPageState extends State<BugListPage> {
],
),
const SizedBox(height: 8),
// 问题描述
Text(
bug['description'] ?? '暂无描述',
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.grey[400] : Colors.black54,
color: AppColors.secondaryText,
height: 1.4,
),
),
const SizedBox(height: 12),
// 严重程度和影响用户
Row(
children: [
Container(
@@ -525,20 +523,19 @@ class _BugListPageState extends State<BugListPage> {
Icon(
Icons.people,
size: 14,
color: isDark ? Colors.grey[400] : Colors.grey[600],
color: AppColors.secondaryText,
),
const SizedBox(width: 4),
Text(
bug['affectedUsers'] ?? '未知用户',
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[600],
color: AppColors.secondaryText,
),
),
],
),
const SizedBox(height: 12),
// 解决方案和复现步骤按钮
Row(
children: [
Expanded(
@@ -553,18 +550,14 @@ class _BugListPageState extends State<BugListPage> {
style: const TextStyle(fontSize: 14),
),
style: ElevatedButton.styleFrom(
backgroundColor: AppConstants.primaryColor.withValues(
alpha: 0.1,
),
foregroundColor: AppConstants.primaryColor,
backgroundColor: AppColors.primaryWithAlpha(25),
foregroundColor: AppColors.primary,
elevation: 0,
padding: const EdgeInsets.symmetric(vertical: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: AppConstants.primaryColor.withValues(
alpha: 0.3,
),
color: AppColors.primaryWithAlpha(76),
),
),
),
@@ -585,17 +578,14 @@ class _BugListPageState extends State<BugListPage> {
style: const TextStyle(fontSize: 14),
),
style: ElevatedButton.styleFrom(
backgroundColor: AppConstants.secondaryColor
.withValues(alpha: 0.1),
foregroundColor: const Color(0xFF018786), // 更深的青色
backgroundColor: AppColors.accentWithAlpha(25),
foregroundColor: AppColors.accent,
elevation: 0,
padding: const EdgeInsets.symmetric(vertical: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: const Color(
0xFF018786,
).withValues(alpha: 0.3),
color: AppColors.accentWithAlpha(76),
),
),
),
@@ -606,13 +596,12 @@ class _BugListPageState extends State<BugListPage> {
],
),
),
// 解决方案区域(可展开/收起)
if (isExpanded) ...[
Divider(height: 1, color: isDark ? Colors.grey[700] : null),
Divider(height: 1, color: AppColors.divider),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF333333) : Colors.grey[50],
color: AppColors.card,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
@@ -625,7 +614,7 @@ class _BugListPageState extends State<BugListPage> {
children: [
Icon(
Icons.lightbulb_outline,
color: AppConstants.primaryColor,
color: AppColors.primary,
size: 16,
),
const SizedBox(width: 8),
@@ -634,7 +623,7 @@ class _BugListPageState extends State<BugListPage> {
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: AppConstants.primaryColor,
color: AppColors.primary,
),
),
],
@@ -644,39 +633,38 @@ class _BugListPageState extends State<BugListPage> {
bug['solution'] ?? '暂无解决方案',
style: TextStyle(
fontSize: 13,
color: isDark ? Colors.grey[400] : Colors.black54,
color: AppColors.secondaryText,
height: 1.4,
),
),
const SizedBox(height: 12),
// 时间信息
Row(
children: [
Icon(
Icons.schedule,
size: 14,
color: isDark ? Colors.grey[400] : Colors.grey[600],
color: AppColors.secondaryText,
),
const SizedBox(width: 4),
Text(
'预计解决: ${bug['resolveTime'] ?? '待定'}',
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[600],
color: AppColors.secondaryText,
),
),
const SizedBox(width: 16),
Icon(
Icons.report,
size: 14,
color: isDark ? Colors.grey[400] : Colors.grey[600],
color: AppColors.secondaryText,
),
const SizedBox(width: 4),
Text(
'报告时间: ${bug['reportTime'] ?? '未知'}',
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[600],
color: AppColors.secondaryText,
),
),
],
@@ -685,13 +673,12 @@ class _BugListPageState extends State<BugListPage> {
),
),
],
// 复现步骤区域(可展开/收起)
if (bug['reproductionExpanded']) ...[
Divider(height: 1, color: isDark ? Colors.grey[700] : null),
Divider(height: 1, color: AppColors.divider),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF333333) : Colors.grey[50],
color: AppColors.card,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
@@ -704,7 +691,7 @@ class _BugListPageState extends State<BugListPage> {
children: [
Icon(
Icons.replay,
color: const Color(0xFF018786), // 更深的青色
color: AppColors.accent,
size: 16,
),
const SizedBox(width: 8),
@@ -713,7 +700,7 @@ class _BugListPageState extends State<BugListPage> {
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: const Color(0xFF018786), // 更深的青色
color: AppColors.accent,
),
),
],
@@ -723,7 +710,7 @@ class _BugListPageState extends State<BugListPage> {
bug['reproduction'] ?? '暂无复现步骤',
style: TextStyle(
fontSize: 13,
color: isDark ? Colors.grey[400] : Colors.black54,
color: AppColors.secondaryText,
height: 1.4,
),
),
@@ -742,9 +729,9 @@ void showBugListBottomSheet(BuildContext context) {
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
isScrollControlled: true, // 允许弹窗占据全屏高度
isScrollControlled: true,
builder: (context) => Container(
height: MediaQuery.of(context).size.height * 0.85, // 设置弹窗高度为屏幕的85%
height: MediaQuery.of(context).size.height * 0.85,
child: const BugListPage(),
),
);