关怀模式
This commit is contained in:
@@ -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(),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
/// 时间: 2026-03-29
|
||||
/// 功能: 填写投票凭证弹窗组件
|
||||
/// 介绍: 提供投票功能的用户凭证填写功能
|
||||
/// 最新变化: 支持动态主题色设置
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../constants/app_constants.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../models/colors/app_colors.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
import '../../../utils/http/vote_api.dart';
|
||||
|
||||
class LoginRegisterDialog extends StatefulWidget {
|
||||
@@ -16,6 +19,7 @@ class LoginRegisterDialog extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LoginRegisterDialogState extends State<LoginRegisterDialog> {
|
||||
final ThemeController _themeController = Get.find<ThemeController>();
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final _usernameController = TextEditingController();
|
||||
bool _isLoading = false;
|
||||
@@ -63,9 +67,9 @@ class _LoginRegisterDialogState extends State<LoginRegisterDialog> {
|
||||
Navigator.pop(context);
|
||||
widget.onLoginSuccess?.call();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('验证成功'),
|
||||
backgroundColor: AppConstants.successColor,
|
||||
SnackBar(
|
||||
content: const Text('验证成功'),
|
||||
backgroundColor: AppColors.success,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -80,9 +84,9 @@ class _LoginRegisterDialogState extends State<LoginRegisterDialog> {
|
||||
Navigator.pop(context);
|
||||
widget.onLoginSuccess?.call();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('注册并验证成功'),
|
||||
backgroundColor: AppConstants.successColor,
|
||||
SnackBar(
|
||||
content: const Text('注册并验证成功'),
|
||||
backgroundColor: AppColors.success,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -92,7 +96,7 @@ class _LoginRegisterDialogState extends State<LoginRegisterDialog> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(e.toString().replaceAll('Exception: ', '')),
|
||||
backgroundColor: AppConstants.errorColor,
|
||||
backgroundColor: AppColors.error,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -107,80 +111,101 @@ class _LoginRegisterDialogState extends State<LoginRegisterDialog> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
'填写 投票凭证',
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
// const SizedBox(height: 8),
|
||||
// 副标题
|
||||
const Text(
|
||||
'微信号或手机号或邮箱作为投票凭证,\n任何人都可以填写,限时开放投票,\n投票凭证仅用于投票,不会泄露隐私.\n结束后删除会所有凭证,仅保留投票结果',
|
||||
style: TextStyle(fontSize: 14, color: Colors.grey),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
return Obx(() {
|
||||
final isDark = _themeController.isDarkMode;
|
||||
return Dialog(
|
||||
backgroundColor: AppColors.surface,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: _usernameController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: '点击填写',
|
||||
hintText: '手机号/邮箱/微信号',
|
||||
border: OutlineInputBorder(),
|
||||
prefixIcon: Icon(Icons.person),
|
||||
Text(
|
||||
'填写 投票凭证',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.primaryText,
|
||||
),
|
||||
validator: _validateUsername,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: _isLoading ? null : _submit,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppConstants.primaryColor,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: _isLoading
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.white,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const Text('验证', style: TextStyle(fontSize: 16)),
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.close, color: AppColors.tertiaryText),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
Text(
|
||||
'微信号或手机号或邮箱作为投票凭证,\n任何人都可以填写,限时开放投票,\n投票凭证仅用于投票,不会泄露隐私.\n结束后删除会所有凭证,仅保留投票结果',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.secondaryText,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: _usernameController,
|
||||
style: TextStyle(color: AppColors.primaryText),
|
||||
decoration: InputDecoration(
|
||||
labelText: '点击填写',
|
||||
hintText: '手机号/邮箱/微信号',
|
||||
labelStyle: TextStyle(color: AppColors.secondaryText),
|
||||
hintStyle: TextStyle(color: AppColors.tertiaryText),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColors.divider),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColors.divider),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: AppColors.primary),
|
||||
),
|
||||
prefixIcon: Icon(Icons.person, color: AppColors.primary),
|
||||
),
|
||||
validator: _validateUsername,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: _isLoading ? null : _submit,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primary,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: _isLoading
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.white,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const Text('验证', style: TextStyle(fontSize: 16)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../constants/app_constants.dart';
|
||||
import '../../../models/colors/app_colors.dart';
|
||||
import '../../../services/isweb/wakelock_service.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
import '../guide/beginner_page.dart';
|
||||
@@ -91,12 +91,13 @@ class PopMenu extends StatelessWidget {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('提示'),
|
||||
content: Text(errorMessage),
|
||||
backgroundColor: AppColors.surface,
|
||||
title: Text('提示', style: TextStyle(color: AppColors.primaryText)),
|
||||
content: Text(errorMessage, style: TextStyle(color: AppColors.secondaryText)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('确定'),
|
||||
child: Text('确定', style: TextStyle(color: AppColors.primary)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -134,7 +135,7 @@ class PopMenu extends StatelessWidget {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
color: AppColors.surface,
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
@@ -162,7 +163,7 @@ class PopMenu extends StatelessWidget {
|
||||
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),
|
||||
),
|
||||
),
|
||||
@@ -208,16 +209,14 @@ class PopMenu extends StatelessWidget {
|
||||
IconData icon,
|
||||
VoidCallback? onTap,
|
||||
) {
|
||||
final isDark = _themeController.isDarkMode;
|
||||
|
||||
return ListTile(
|
||||
leading: Icon(
|
||||
icon,
|
||||
color: isDark ? Colors.white70 : AppConstants.primaryColor,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(color: isDark ? Colors.white70 : Colors.black87),
|
||||
style: TextStyle(color: AppColors.primaryText),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../constants/app_constants.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../../models/colors/app_colors.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
|
||||
class ServerInfoDialog {
|
||||
static Future<void> show(BuildContext context, {Map<String, dynamic>? data}) {
|
||||
@@ -13,236 +15,241 @@ class ServerInfoDialog {
|
||||
final latency = network?['latency'] as List<dynamic>?;
|
||||
final serverResponseTime = network?['server_response_time'];
|
||||
|
||||
final ThemeController themeController = Get.find<ThemeController>();
|
||||
|
||||
return showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 340),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor,
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
top: Radius.circular(16),
|
||||
return Obx(() {
|
||||
final isDark = themeController.isDarkMode;
|
||||
return Dialog(
|
||||
backgroundColor: AppColors.surface,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Container(
|
||||
constraints: const BoxConstraints(maxWidth: 340),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.primary,
|
||||
borderRadius: const BorderRadius.vertical(
|
||||
top: Radius.circular(16),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.cloud_outlined,
|
||||
color: Colors.white,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'广州 server-ls',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 2),
|
||||
Text(
|
||||
'服务器信息',
|
||||
style: TextStyle(
|
||||
color: Colors.white70,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildInfoCard(
|
||||
icon: Icons.schedule,
|
||||
iconColor: const Color(0xFF007AFF),
|
||||
title: '服务器时间',
|
||||
content: timestamp?['datetime'] ?? '--',
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoCard(
|
||||
icon: Icons.speed,
|
||||
iconColor: const Color(0xFF34C759),
|
||||
title: '服务器负载',
|
||||
content:
|
||||
'1分钟: ${_formatLoad(load?['1min'])}\n5分钟: ${_formatLoad(load?['5min'])}\n15分钟: ${_formatLoad(load?['15min'])}',
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoCard(
|
||||
icon: Icons.bolt,
|
||||
iconColor: const Color(0xFFFF9500),
|
||||
title: '服务器响应',
|
||||
content: '${serverResponseTime ?? '--'} ms',
|
||||
trailing: _buildResponseTimeIndicator(
|
||||
serverResponseTime,
|
||||
),
|
||||
),
|
||||
if (latency != null && latency.isNotEmpty) ...[
|
||||
const SizedBox(height: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF2F2F7),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.cloud_outlined,
|
||||
color: Colors.white,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.public,
|
||||
size: 16,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'网络延迟',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
color: Colors.grey[700],
|
||||
),
|
||||
),
|
||||
],
|
||||
const Text(
|
||||
'广州 server-ls',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
'服务器信息',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.7),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
...latency.map<Widget>((item) {
|
||||
final host = item['host'] as String?;
|
||||
final ip = item['ip'] as String?;
|
||||
final lat = item['latency'];
|
||||
final status = item['status'] as String?;
|
||||
final isOnline = status == 'online';
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
color: isOnline
|
||||
? const Color(0xFF34C759)
|
||||
: const Color(0xFFFF3B30),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
host ?? '--',
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
ip ?? '--',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Colors.grey[500],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: isOnline
|
||||
? const Color(
|
||||
0xFF34C759,
|
||||
).withValues(alpha: 0.1)
|
||||
: const Color(
|
||||
0xFFFF3B30,
|
||||
).withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(
|
||||
8,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
isOnline ? '$lat ms' : '离线',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isOnline
|
||||
? const Color(0xFF34C759)
|
||||
: const Color(0xFFFF3B30),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 20),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: const Color(0xFFF2F2F7),
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildInfoCard(
|
||||
icon: Icons.schedule,
|
||||
iconColor: AppColors.iosBlue,
|
||||
title: '服务器时间',
|
||||
content: timestamp?['datetime'] ?? '--',
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'关闭',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF007AFF),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoCard(
|
||||
icon: Icons.speed,
|
||||
iconColor: AppColors.iosGreen,
|
||||
title: '服务器负载',
|
||||
content:
|
||||
'1分钟: ${_formatLoad(load?['1min'])}\n5分钟: ${_formatLoad(load?['5min'])}\n15分钟: ${_formatLoad(load?['15min'])}',
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoCard(
|
||||
icon: Icons.bolt,
|
||||
iconColor: AppColors.iosOrange,
|
||||
title: '服务器响应',
|
||||
content: '${serverResponseTime ?? '--'} ms',
|
||||
trailing: _buildResponseTimeIndicator(
|
||||
serverResponseTime,
|
||||
),
|
||||
),
|
||||
if (latency != null && latency.isNotEmpty) ...[
|
||||
const SizedBox(height: 16),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.card,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.public,
|
||||
size: 16,
|
||||
color: AppColors.tertiaryText,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'网络延迟',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14,
|
||||
color: AppColors.secondaryText,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
...latency.map<Widget>((item) {
|
||||
final host = item['host'] as String?;
|
||||
final ip = item['ip'] as String?;
|
||||
final lat = item['latency'];
|
||||
final status = item['status'] as String?;
|
||||
final isOnline = status == 'online';
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
color: isOnline
|
||||
? AppColors.iosGreen
|
||||
: AppColors.iosRed,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
host ?? '--',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.primaryText,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
ip ?? '--',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: AppColors.tertiaryText,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: isOnline
|
||||
? AppColors.iosGreen
|
||||
.withValues(alpha: 0.1)
|
||||
: AppColors.iosRed
|
||||
.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(
|
||||
8,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
isOnline ? '$lat ms' : '离线',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isOnline
|
||||
? AppColors.iosGreen
|
||||
: AppColors.iosRed,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(20, 0, 20, 20),
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
style: TextButton.styleFrom(
|
||||
backgroundColor: AppColors.card,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'关闭',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -257,7 +264,7 @@ class ServerInfoDialog {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF2F2F7),
|
||||
color: AppColors.card,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
@@ -277,14 +284,18 @@ class ServerInfoDialog {
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[600]),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColors.tertiaryText,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
content,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.primaryText,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -327,16 +338,16 @@ class ServerInfoDialog {
|
||||
Color color;
|
||||
String label;
|
||||
if (time < 100) {
|
||||
color = const Color(0xFF34C759);
|
||||
color = AppColors.iosGreen;
|
||||
label = '极快';
|
||||
} else if (time < 300) {
|
||||
color = const Color(0xFF34C759);
|
||||
color = AppColors.iosGreen;
|
||||
label = '快速';
|
||||
} else if (time < 500) {
|
||||
color = const Color(0xFFFF9500);
|
||||
color = AppColors.iosOrange;
|
||||
label = '正常';
|
||||
} else {
|
||||
color = const Color(0xFFFF3B30);
|
||||
color = AppColors.iosRed;
|
||||
label = '较慢';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user