关怀模式

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,14 @@
/// 时间: 2026-04-01
/// 功能: 全站统计页面
/// 介绍: 展示网站统计数据,包括收录数量、热度统计、热门内容等
/// 最新变化: 新建页面iOS风格设计
/// 最新变化: 支持动态主题色设置
library;
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 '../../../utils/http/http_client.dart';
import '../../../services/network_listener_service.dart';
import '../../../services/get/theme_controller.dart';
@@ -88,12 +89,16 @@ class _EntirePageState extends State<EntirePage>
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return const AlertDialog(
return AlertDialog(
backgroundColor: AppColors.surface,
content: Row(
children: [
CircularProgressIndicator(),
SizedBox(width: 16),
Text('正在检测网络状态...'),
CircularProgressIndicator(color: AppColors.primary),
const SizedBox(width: 16),
Text(
'正在检测网络状态...',
style: TextStyle(color: AppColors.primaryText),
),
],
),
);
@@ -132,9 +137,7 @@ class _EntirePageState extends State<EntirePage>
return AnnotatedRegion<SystemUiOverlayStyle>(
value: isDark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark,
child: Scaffold(
backgroundColor: isDark
? const Color(0xFF1A1A1A)
: const Color(0xFFF2F2F7),
backgroundColor: AppColors.background,
appBar: _buildAppBar(isDark),
body: _buildBody(isDark),
),
@@ -144,19 +147,19 @@ class _EntirePageState extends State<EntirePage>
PreferredSizeWidget _buildAppBar(bool isDark) {
return AppBar(
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
backgroundColor: AppColors.surface,
elevation: 0,
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios,
color: isDark ? Colors.white : AppConstants.primaryColor,
color: AppColors.primary,
),
onPressed: () => Navigator.pop(context),
),
title: Text(
'全站统计',
style: TextStyle(
color: isDark ? Colors.white : Colors.black,
color: AppColors.primaryText,
fontSize: 17,
fontWeight: FontWeight.w600,
),
@@ -166,7 +169,7 @@ class _EntirePageState extends State<EntirePage>
IconButton(
icon: Icon(
Icons.info_outline,
color: isDark ? Colors.white : AppConstants.primaryColor,
color: AppColors.primary,
),
onPressed: _showServerInfo,
tooltip: '服务器信息',
@@ -176,7 +179,7 @@ class _EntirePageState extends State<EntirePage>
preferredSize: const Size.fromHeight(0.5),
child: Container(
height: 0.5,
color: isDark ? Colors.grey[700] : const Color(0xFFE5E5EA),
color: AppColors.divider,
),
),
);
@@ -204,7 +207,7 @@ class _EntirePageState extends State<EntirePage>
width: width,
height: height,
decoration: BoxDecoration(
color: isDark ? Colors.grey[700] : const Color(0xFFE5E5EA),
color: isDark ? Colors.grey[700] : AppColors.iosLightGray,
borderRadius: BorderRadius.circular(radius),
),
);
@@ -235,7 +238,7 @@ class _EntirePageState extends State<EntirePage>
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: isDark ? Colors.grey[700] : const Color(0xFFE5E5EA),
color: isDark ? Colors.grey[700] : AppColors.iosLightGray,
borderRadius: BorderRadius.circular(12),
),
child: Column(
@@ -273,7 +276,7 @@ class _EntirePageState extends State<EntirePage>
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
color: AppColors.surface,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
@@ -320,7 +323,7 @@ class _EntirePageState extends State<EntirePage>
return Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF333333) : const Color(0xFFF2F2F7),
color: isDark ? AppColors.darkCard : AppColors.iosLightGray,
borderRadius: BorderRadius.circular(12),
),
child: Column(
@@ -362,7 +365,7 @@ class _EntirePageState extends State<EntirePage>
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
color: AppColors.surface,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
@@ -402,12 +405,12 @@ class _EntirePageState extends State<EntirePage>
width: 64,
height: 64,
decoration: BoxDecoration(
color: const Color(0xFFFF3B30).withValues(alpha: 0.1),
color: AppColors.error.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(32),
),
child: const Icon(
child: Icon(
Icons.error_outline,
color: Color(0xFFFF3B30),
color: AppColors.error,
size: 32,
),
),
@@ -415,7 +418,7 @@ class _EntirePageState extends State<EntirePage>
Text(
_errorMessage ?? '加载失败',
style: TextStyle(
color: isDark ? Colors.grey[400] : const Color(0xFF8E8E93),
color: AppColors.tertiaryText,
fontSize: 14,
),
textAlign: TextAlign.center,
@@ -424,7 +427,7 @@ class _EntirePageState extends State<EntirePage>
ElevatedButton(
onPressed: _loadStatsData,
style: ElevatedButton.styleFrom(
backgroundColor: AppConstants.primaryColor,
backgroundColor: AppColors.primary,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(
horizontal: 32,
@@ -446,7 +449,7 @@ class _EntirePageState extends State<EntirePage>
return FadeTransition(
opacity: _fadeAnimation,
child: RefreshIndicator(
color: AppConstants.primaryColor,
color: AppColors.primary,
onRefresh: _loadStatsData,
child: ListView(
padding: const EdgeInsets.all(16),
@@ -473,8 +476,8 @@ class _EntirePageState extends State<EntirePage>
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppConstants.primaryColor,
AppConstants.primaryColor.withValues(alpha: 0.8),
AppColors.primary,
AppColors.primary.withValues(alpha: 0.8),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
@@ -482,7 +485,7 @@ class _EntirePageState extends State<EntirePage>
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: AppConstants.primaryColor.withValues(alpha: 0.3),
color: AppColors.primary.withValues(alpha: 0.3),
blurRadius: 12,
offset: const Offset(0, 4),
),
@@ -591,56 +594,56 @@ class _EntirePageState extends State<EntirePage>
'label': '项目',
'value': _statsData?['count_category'] ?? 0,
'icon': Icons.category,
'color': const Color(0xFF007AFF),
'color': AppColors.iosBlue,
'showIcon': true,
},
{
'label': '收录诗句',
'value': _statsData?['count_site'] ?? 0,
'icon': Icons.article,
'color': const Color(0xFF34C759),
'color': AppColors.iosGreen,
'showIcon': false,
},
{
'label': '审核中',
'value': _statsData?['count_apply'] ?? 0,
'icon': Icons.pending,
'color': const Color(0xFFFF9500),
'color': AppColors.iosOrange,
'showIcon': true,
},
{
'label': '已拒审',
'value': _statsData?['count_apply_reject'] ?? 0,
'icon': Icons.block,
'color': const Color(0xFFFF3B30),
'color': AppColors.iosRed,
'showIcon': true,
},
{
'label': '每日一句',
'value': _statsData?['count_article'] ?? 0,
'icon': Icons.wb_sunny,
'color': const Color(0xFF5856D6),
'color': AppColors.iosPurple,
'showIcon': true,
},
{
'label': '文章分类',
'value': _statsData?['count_article_category'] ?? 0,
'icon': Icons.folder,
'color': const Color(0xFFAF52DE),
'color': AppColors.iosPink,
'showIcon': true,
},
{
'label': '推送',
'value': _statsData?['count_notice'] ?? 0,
'icon': Icons.campaign,
'color': const Color(0xFF32ADE6),
'color': AppColors.iosTeal,
'showIcon': true,
},
{
'label': '开发者',
'value': _statsData?['count_link'] ?? 0,
'icon': Icons.people,
'color': const Color(0xFFFF2D55),
'color': AppColors.iosRed,
'showIcon': true,
},
{
@@ -687,7 +690,7 @@ class _EntirePageState extends State<EntirePage>
return Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
color: AppColors.surface,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
@@ -699,7 +702,6 @@ class _EntirePageState extends State<EntirePage>
),
child: Column(
children: [
// 上行icon和数据比例2:1有icon时1:1无icon时数据占满
Expanded(
flex: 2,
child: Row(
@@ -723,7 +725,7 @@ class _EntirePageState extends State<EntirePage>
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
color: isDark ? Colors.white : Colors.black,
color: AppColors.primaryText,
),
textAlign: TextAlign.center,
),
@@ -732,7 +734,6 @@ class _EntirePageState extends State<EntirePage>
),
),
const SizedBox(height: 4),
// 下行:描述
Expanded(
flex: 1,
child: Center(
@@ -740,7 +741,7 @@ class _EntirePageState extends State<EntirePage>
label,
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : const Color(0xFF3C3C43),
color: AppColors.secondaryText,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -759,7 +760,7 @@ class _EntirePageState extends State<EntirePage>
'累计热度',
_statsData?['cumulative_hits']?.toString() ?? '0',
Icons.local_fire_department,
const Color(0xFFFF9500),
AppColors.iosOrange,
isDark,
),
const SizedBox(height: 12),
@@ -767,7 +768,7 @@ class _EntirePageState extends State<EntirePage>
'累计点赞',
_statsData?['cumulative_likes']?.toString() ?? '0',
Icons.favorite,
const Color(0xFFFF2D55),
AppColors.iosRed,
isDark,
),
], isDark);
@@ -783,7 +784,7 @@ class _EntirePageState extends State<EntirePage>
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
color: AppColors.surface,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
@@ -813,7 +814,7 @@ class _EntirePageState extends State<EntirePage>
label,
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.grey[400] : const Color(0xFF8E8E93),
color: AppColors.secondaryText,
),
),
const SizedBox(height: 4),
@@ -822,7 +823,7 @@ class _EntirePageState extends State<EntirePage>
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: isDark ? Colors.white : Colors.black,
color: AppColors.primaryText,
),
),
],
@@ -839,7 +840,7 @@ class _EntirePageState extends State<EntirePage>
'今日热门',
_statsData?['top_hits_day'],
Icons.today,
const Color(0xFFFF9500),
AppColors.iosOrange,
isDark,
),
const SizedBox(height: 12),
@@ -847,7 +848,7 @@ class _EntirePageState extends State<EntirePage>
'本月热门',
_statsData?['top_hits_month'],
Icons.calendar_month,
const Color(0xFF007AFF),
AppColors.iosBlue,
isDark,
),
const SizedBox(height: 12),
@@ -855,7 +856,7 @@ class _EntirePageState extends State<EntirePage>
'历史最热',
_statsData?['top_hits_total'],
Icons.history,
const Color(0xFF5856D6),
AppColors.iosPurple,
isDark,
),
const SizedBox(height: 12),
@@ -863,7 +864,7 @@ class _EntirePageState extends State<EntirePage>
'最高点赞',
_statsData?['top_like'],
Icons.thumb_up,
const Color(0xFF34C759),
AppColors.iosGreen,
isDark,
),
], isDark);
@@ -882,7 +883,7 @@ class _EntirePageState extends State<EntirePage>
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
color: AppColors.surface,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
@@ -914,7 +915,7 @@ class _EntirePageState extends State<EntirePage>
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: isDark ? Colors.white : Colors.black,
color: AppColors.primaryText,
),
),
const SizedBox(height: 8),
@@ -923,8 +924,8 @@ class _EntirePageState extends State<EntirePage>
style: TextStyle(
fontSize: 13,
color: hasData
? (isDark ? Colors.grey[400] : const Color(0xFF3C3C43))
: (isDark ? Colors.grey[500] : const Color(0xFF8E8E93)),
? AppColors.secondaryText
: AppColors.tertiaryText,
height: 1.5,
),
maxLines: 3,
@@ -954,7 +955,7 @@ class _EntirePageState extends State<EntirePage>
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
color: AppColors.surface,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
@@ -970,12 +971,12 @@ class _EntirePageState extends State<EntirePage>
width: 40,
height: 40,
decoration: BoxDecoration(
color: AppConstants.primaryColor.withValues(alpha: 0.1),
color: AppColors.primary.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(10),
),
child: const Icon(
child: Icon(
Icons.cake,
color: AppConstants.primaryColor,
color: AppColors.primary,
size: 20,
),
),
@@ -989,7 +990,7 @@ class _EntirePageState extends State<EntirePage>
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: isDark ? Colors.white : Colors.black,
color: AppColors.primaryText,
),
),
const SizedBox(height: 4),
@@ -999,9 +1000,7 @@ class _EntirePageState extends State<EntirePage>
buildTime,
style: TextStyle(
fontSize: 16,
color: isDark
? Colors.grey[400]
: const Color(0xFF3C3C43),
color: AppColors.secondaryText,
),
),
const SizedBox(width: 8),
@@ -1011,14 +1010,14 @@ class _EntirePageState extends State<EntirePage>
vertical: 2,
),
decoration: BoxDecoration(
color: AppConstants.primaryColor.withValues(alpha: 0.1),
color: AppColors.primary.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(10),
),
child: Text(
'已运行 $days',
style: const TextStyle(
style: TextStyle(
fontSize: 12,
color: AppConstants.primaryColor,
color: AppColors.primary,
fontWeight: FontWeight.w500,
),
),
@@ -1041,7 +1040,7 @@ class _EntirePageState extends State<EntirePage>
) {
return Container(
decoration: BoxDecoration(
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
color: AppColors.surface,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
@@ -1058,14 +1057,14 @@ class _EntirePageState extends State<EntirePage>
padding: const EdgeInsets.all(16),
child: Row(
children: [
Icon(icon, color: AppConstants.primaryColor, size: 20),
Icon(icon, color: AppColors.primary, size: 20),
const SizedBox(width: 8),
Text(
title,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: isDark ? Colors.white : Colors.black,
color: AppColors.primaryText,
),
),
],