深色模式、首页设置页面和功能优化

This commit is contained in:
Developer
2026-04-02 07:06:55 +08:00
parent f0a62ed68b
commit 954d173329
88 changed files with 12157 additions and 7578 deletions

View File

@@ -5,8 +5,10 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import '../../../constants/app_constants.dart';
import '../../../services/get/theme_controller.dart';
class BugListPage extends StatefulWidget {
const BugListPage({super.key});
@@ -16,6 +18,7 @@ class BugListPage extends StatefulWidget {
}
class _BugListPageState extends State<BugListPage> {
final ThemeController _themeController = Get.find<ThemeController>();
// 模拟bug数据
final List<Map<String, dynamic>> _bugs = [
{
@@ -178,7 +181,6 @@ class _BugListPageState extends State<BugListPage> {
];
final ScrollController _scrollController = ScrollController();
bool _isRefreshing = false;
// 切换bug展开状态
void _toggleBugExpanded(int bugId) {
@@ -268,57 +270,52 @@ class _BugListPageState extends State<BugListPage> {
}
Future<void> _refresh() async {
setState(() {
_isRefreshing = true;
});
// 模拟网络请求延迟
await Future.delayed(const Duration(seconds: 1));
setState(() {
_isRefreshing = false;
});
HapticFeedback.lightImpact();
}
@override
Widget build(BuildContext context) {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
),
child: Column(
children: [
// 顶部拖拽条和标题
_buildHeader(),
// bug列表
Expanded(
child: RefreshIndicator(
onRefresh: _refresh,
color: AppConstants.primaryColor,
child: ListView.builder(
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(),
padding: const EdgeInsets.all(16),
itemCount: _bugs.length + 1,
itemBuilder: (context, index) {
if (index == _bugs.length) {
return _buildFooter();
}
final bug = _bugs[index];
return _buildBugItem(bug);
},
return Obx(() {
final isDark = _themeController.isDarkMode;
return Container(
decoration: BoxDecoration(
color: isDark ? const Color(0xFF1A1A1A) : Colors.white,
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
),
child: Column(
children: [
// 顶部拖拽条和标题
_buildHeader(isDark),
// bug列表
Expanded(
child: RefreshIndicator(
onRefresh: _refresh,
color: AppConstants.primaryColor,
child: ListView.builder(
controller: _scrollController,
physics: const AlwaysScrollableScrollPhysics(),
padding: const EdgeInsets.all(16),
itemCount: _bugs.length + 1,
itemBuilder: (context, index) {
if (index == _bugs.length) {
return _buildFooter(isDark);
}
final bug = _bugs[index];
return _buildBugItem(bug, isDark);
},
),
),
),
),
],
),
);
],
),
);
});
}
Widget _buildHeader() {
Widget _buildHeader(bool isDark) {
return Column(
children: [
// 拖拽条
@@ -327,7 +324,7 @@ class _BugListPageState extends State<BugListPage> {
height: 4,
margin: const EdgeInsets.only(top: 8),
decoration: BoxDecoration(
color: Colors.grey[300],
color: isDark ? Colors.grey[600] : Colors.grey[300],
borderRadius: BorderRadius.circular(2),
),
),
@@ -354,17 +351,20 @@ class _BugListPageState extends State<BugListPage> {
),
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('关闭'),
child: Text(
'关闭',
style: TextStyle(color: isDark ? Colors.white : null),
),
),
],
),
),
const Divider(height: 1),
Divider(height: 1, color: isDark ? Colors.grey[700] : null),
],
);
}
Widget _buildFooter() {
Widget _buildFooter(bool isDark) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 24),
child: Column(
@@ -372,39 +372,55 @@ class _BugListPageState extends State<BugListPage> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(width: 40, height: 1, color: Colors.grey[300]),
Container(
width: 40,
height: 1,
color: isDark ? Colors.grey[600] : Colors.grey[300],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Text(
'已经到底了',
style: TextStyle(fontSize: 13, color: Colors.grey[500]),
style: TextStyle(
fontSize: 13,
color: isDark ? Colors.grey[400] : Colors.grey[500],
),
),
),
Container(width: 40, height: 1, color: Colors.grey[300]),
Container(
width: 40,
height: 1,
color: isDark ? Colors.grey[600] : Colors.grey[300],
),
],
),
const SizedBox(height: 8),
Text(
'${_bugs.length} 个已知问题',
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[500] : Colors.grey[400],
),
),
],
),
);
}
Widget _buildBugItem(Map<String, dynamic> bug) {
Widget _buildBugItem(Map<String, dynamic> bug, bool isDark) {
final bool isExpanded = bug['expanded'] ?? false;
return Container(
margin: const EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: Colors.white,
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
borderRadius: BorderRadius.circular(12),
border: Border.all(color: Colors.grey[200]!),
border: Border.all(
color: isDark ? Colors.grey[700]! : Colors.grey[200]!,
),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.05),
color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.05),
blurRadius: 5,
offset: const Offset(0, 2),
),
@@ -426,10 +442,10 @@ class _BugListPageState extends State<BugListPage> {
Expanded(
child: Text(
bug['title'] ?? '未知问题',
style: const TextStyle(
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black87,
color: isDark ? Colors.white : Colors.black87,
),
),
),
@@ -464,9 +480,9 @@ class _BugListPageState extends State<BugListPage> {
// 问题描述
Text(
bug['description'] ?? '暂无描述',
style: const TextStyle(
style: TextStyle(
fontSize: 14,
color: Colors.black54,
color: isDark ? Colors.grey[400] : Colors.black54,
height: 1.4,
),
),
@@ -506,11 +522,18 @@ class _BugListPageState extends State<BugListPage> {
),
),
const SizedBox(width: 12),
Icon(Icons.people, size: 14, color: Colors.grey[600]),
Icon(
Icons.people,
size: 14,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
const SizedBox(width: 4),
Text(
bug['affectedUsers'] ?? '未知用户',
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
),
],
),
@@ -585,11 +608,11 @@ class _BugListPageState extends State<BugListPage> {
),
// 解决方案区域(可展开/收起)
if (isExpanded) ...[
const Divider(height: 1),
Divider(height: 1, color: isDark ? Colors.grey[700] : null),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.grey[50],
color: isDark ? const Color(0xFF333333) : Colors.grey[50],
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
@@ -619,9 +642,9 @@ class _BugListPageState extends State<BugListPage> {
const SizedBox(height: 8),
Text(
bug['solution'] ?? '暂无解决方案',
style: const TextStyle(
style: TextStyle(
fontSize: 13,
color: Colors.black54,
color: isDark ? Colors.grey[400] : Colors.black54,
height: 1.4,
),
),
@@ -629,18 +652,32 @@ class _BugListPageState extends State<BugListPage> {
// 时间信息
Row(
children: [
Icon(Icons.schedule, size: 14, color: Colors.grey[600]),
Icon(
Icons.schedule,
size: 14,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
const SizedBox(width: 4),
Text(
'预计解决: ${bug['resolveTime'] ?? '待定'}',
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
),
const SizedBox(width: 16),
Icon(Icons.report, size: 14, color: Colors.grey[600]),
Icon(
Icons.report,
size: 14,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
const SizedBox(width: 4),
Text(
'报告时间: ${bug['reportTime'] ?? '未知'}',
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
),
],
),
@@ -650,11 +687,11 @@ class _BugListPageState extends State<BugListPage> {
],
// 复现步骤区域(可展开/收起)
if (bug['reproductionExpanded']) ...[
const Divider(height: 1),
Divider(height: 1, color: isDark ? Colors.grey[700] : null),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.grey[50],
color: isDark ? const Color(0xFF333333) : Colors.grey[50],
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
@@ -684,9 +721,9 @@ class _BugListPageState extends State<BugListPage> {
const SizedBox(height: 8),
Text(
bug['reproduction'] ?? '暂无复现步骤',
style: const TextStyle(
style: TextStyle(
fontSize: 13,
color: Colors.black54,
color: isDark ? Colors.grey[400] : Colors.black54,
height: 1.4,
),
),