关怀模式

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,9 +1,11 @@
import 'dart:io' as io;
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../constants/app_constants.dart';
import '../../../utils/http/http_client.dart';
import '../../../services/get/theme_controller.dart';
import 'tougao.dart';
/// 时间: 2026-03-30
@@ -24,6 +26,7 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
final _urlController = TextEditingController();
final _keywordsController = TextEditingController();
final _introduceController = TextEditingController();
final ThemeController _themeController = Get.find<ThemeController>();
List<Map<String, dynamic>> _categories = [];
String? _selectedCategory;
@@ -356,26 +359,28 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
@override
Widget build(BuildContext context) {
final isDark = _themeController.isDarkMode;
final primaryColor = _themeController.currentThemeColor;
return Scaffold(
backgroundColor: const Color(0xFFF5F5F5),
backgroundColor: isDark
? const Color(0xFF1A1A1A)
: const Color(0xFFF5F5F5),
appBar: AppBar(
title: const Text(
title: Text(
'📝 诗词投稿',
style: TextStyle(
color: AppConstants.primaryColor,
fontWeight: FontWeight.bold,
),
style: TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
),
backgroundColor: Colors.white,
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
elevation: 0,
centerTitle: true,
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: AppConstants.primaryColor),
icon: Icon(Icons.arrow_back, color: primaryColor),
onPressed: () => Navigator.of(context).pop(),
),
actions: [
IconButton(
icon: const Icon(Icons.history, color: AppConstants.primaryColor),
icon: Icon(Icons.history, color: primaryColor),
tooltip: '投稿记录',
onPressed: () {
Navigator.push(
@@ -405,14 +410,14 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
}
Widget _buildHeaderCard() {
final isDark = _themeController.isDarkMode;
final primaryColor = _themeController.currentThemeColor;
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppConstants.primaryColor.withAlpha(30),
AppConstants.primaryColor.withAlpha(10),
],
colors: [primaryColor.withAlpha(30), primaryColor.withAlpha(10)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
@@ -423,28 +428,31 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.white,
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
borderRadius: BorderRadius.circular(12),
),
child: const Icon(
Icons.edit_note,
color: AppConstants.primaryColor,
size: 32,
),
child: Icon(Icons.edit_note, color: primaryColor, size: 32),
),
const SizedBox(width: 16),
const Expanded(
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'收录经典诗词',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: isDark ? Colors.white : Colors.black87,
),
),
SizedBox(height: 4),
const SizedBox(height: 4),
Text(
'支持原创和古诗,传承中华文化',
style: TextStyle(fontSize: 14, color: Colors.grey),
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.grey[400] : Colors.grey,
),
),
],
),
@@ -455,13 +463,15 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
}
Widget _buildFormCard() {
final isDark = _themeController.isDarkMode;
return Container(
decoration: BoxDecoration(
color: Colors.white,
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
color: Colors.black.withAlpha(isDark ? 30 : 10),
blurRadius: 10,
offset: const Offset(0, 2),
),
@@ -493,13 +503,19 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
}
Widget _buildSectionHeader(String title) {
final isDark = _themeController.isDarkMode;
return Padding(
padding: const EdgeInsets.all(16),
child: Row(
children: [
Text(
title,
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: isDark ? Colors.white : Colors.black87,
),
),
],
),
@@ -507,14 +523,20 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
}
Widget _buildNameField() {
final isDark = _themeController.isDarkMode;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
const Text(
Text(
'参考语句',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: isDark ? Colors.white : Colors.black87,
),
),
const Text(' *', style: TextStyle(color: AppConstants.errorColor)),
const Spacer(),
@@ -531,7 +553,22 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
controller: _nameController,
decoration: InputDecoration(
hintText: '如:纤云弄巧,飞星传恨',
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
hintStyle: TextStyle(
color: isDark ? Colors.grey[500] : Colors.grey[400],
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: isDark ? Colors.grey[600]! : Colors.grey[300]!,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: _themeController.currentThemeColor,
width: 2,
),
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
@@ -545,6 +582,7 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
)
: null,
),
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
validator: (value) {
if (value == null || value.trim().isEmpty) {
return '请输入参考语句';
@@ -594,8 +632,15 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
),
TextButton.icon(
onPressed: _isCheckingName ? null : _checkName,
icon: const Icon(Icons.search, size: 18),
label: const Text('检测是否存在'),
icon: Icon(
Icons.search,
size: 18,
color: _themeController.currentThemeColor,
),
label: Text(
'检测是否存在',
style: TextStyle(color: _themeController.currentThemeColor),
),
),
],
),
@@ -642,16 +687,22 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
}
Widget _buildCategoryField() {
final isDark = _themeController.isDarkMode;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(
Row(
children: [
Text(
'分类',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: isDark ? Colors.white : Colors.black87,
),
),
Text(' *', style: TextStyle(color: AppConstants.errorColor)),
const Text(' *', style: TextStyle(color: AppConstants.errorColor)),
],
),
const SizedBox(height: 8),
@@ -659,7 +710,22 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
value: _selectedCategory,
decoration: InputDecoration(
hintText: '请选择分类',
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
hintStyle: TextStyle(
color: isDark ? Colors.grey[500] : Colors.grey[400],
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: isDark ? Colors.grey[600]! : Colors.grey[300]!,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: _themeController.currentThemeColor,
width: 2,
),
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
@@ -668,12 +734,17 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
items: _categories.map((cat) {
return DropdownMenuItem(
value: cat['catename'] as String,
child: Text(cat['catename'] as String),
child: Text(
cat['catename'] as String,
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
),
);
}).toList(),
onChanged: (value) {
setState(() => _selectedCategory = value);
},
dropdownColor: isDark ? const Color(0xFF333333) : Colors.white,
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
validator: (value) {
if (value == null || value.isEmpty) {
return '请选择分类';
@@ -686,16 +757,22 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
}
Widget _buildUrlField() {
final isDark = _themeController.isDarkMode;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(
Row(
children: [
Text(
'诗人和标题',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: isDark ? Colors.white : Colors.black87,
),
),
Text(' *', style: TextStyle(color: AppConstants.errorColor)),
const Text(' *', style: TextStyle(color: AppConstants.errorColor)),
],
),
const SizedBox(height: 8),
@@ -703,12 +780,28 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
controller: _urlController,
decoration: InputDecoration(
hintText: '如:李白 静夜思',
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
hintStyle: TextStyle(
color: isDark ? Colors.grey[500] : Colors.grey[400],
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: isDark ? Colors.grey[600]! : Colors.grey[300]!,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: _themeController.currentThemeColor,
width: 2,
),
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
),
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
validator: (value) {
if (value == null || value.trim().isEmpty) {
return '请输入诗人和标题';
@@ -721,16 +814,22 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
}
Widget _buildKeywordsField() {
final isDark = _themeController.isDarkMode;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(
Row(
children: [
Text(
'关键词',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: isDark ? Colors.white : Colors.black87,
),
),
Text(' *', style: TextStyle(color: AppConstants.errorColor)),
const Text(' *', style: TextStyle(color: AppConstants.errorColor)),
],
),
const SizedBox(height: 8),
@@ -738,12 +837,28 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
controller: _keywordsController,
decoration: InputDecoration(
hintText: '用逗号分隔,如:思乡,月亮,唐诗',
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
hintStyle: TextStyle(
color: isDark ? Colors.grey[500] : Colors.grey[400],
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: isDark ? Colors.grey[600]! : Colors.grey[300]!,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: _themeController.currentThemeColor,
width: 2,
),
),
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
),
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
validator: (value) {
if (value == null || value.trim().isEmpty) {
return '请输入关键词';
@@ -756,16 +871,22 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
}
Widget _buildIntroduceField() {
final isDark = _themeController.isDarkMode;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Row(
Row(
children: [
Text(
'诗词介绍',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: isDark ? Colors.white : Colors.black87,
),
),
Text(' *', style: TextStyle(color: AppConstants.errorColor)),
const Text(' *', style: TextStyle(color: AppConstants.errorColor)),
],
),
const SizedBox(height: 8),
@@ -774,9 +895,25 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
maxLines: 5,
decoration: InputDecoration(
hintText: '会说就多说几句...',
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
hintStyle: TextStyle(
color: isDark ? Colors.grey[500] : Colors.grey[400],
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: isDark ? Colors.grey[600]! : Colors.grey[300]!,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
borderSide: BorderSide(
color: _themeController.currentThemeColor,
width: 2,
),
),
contentPadding: const EdgeInsets.all(16),
),
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
validator: (value) {
if (value == null || value.trim().isEmpty) {
return '请输入诗词介绍';
@@ -789,19 +926,18 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
}
Widget _buildSubmitButton() {
final primaryColor = _themeController.currentThemeColor;
return Container(
height: 56,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppConstants.primaryColor,
AppConstants.primaryColor.withAlpha(200),
],
colors: [primaryColor, primaryColor.withAlpha(200)],
),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: AppConstants.primaryColor.withAlpha(50),
color: primaryColor.withAlpha(50),
blurRadius: 10,
offset: const Offset(0, 4),
),
@@ -845,10 +981,13 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
}
Widget _buildTipsCard() {
final isDark = _themeController.isDarkMode;
final primaryColor = _themeController.currentThemeColor;
return Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.blue[50],
color: isDark ? primaryColor.withAlpha(20) : primaryColor.withAlpha(10),
borderRadius: BorderRadius.circular(12),
),
child: Column(
@@ -856,14 +995,14 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
children: [
Row(
children: [
Icon(Icons.lightbulb_outline, color: Colors.blue[700], size: 20),
Icon(Icons.lightbulb_outline, color: primaryColor, size: 20),
const SizedBox(width: 8),
Text(
'投稿提示',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.blue[700],
color: primaryColor,
),
),
],
@@ -873,7 +1012,7 @@ class _ManuscriptPageState extends State<ManuscriptPage> {
'• 支持原创诗词和经典古诗\n• 相似度超过80%将无法提交\n• 提交后等待审核通过\n• 平台信息自动识别:${_getPlatform()}',
style: TextStyle(
fontSize: 13,
color: Colors.blue[700],
color: isDark ? Colors.grey[300] : primaryColor,
height: 1.5,
),
),

View File

@@ -145,7 +145,7 @@ class _TougaoPageState extends State<TougaoPage> {
appBar: AppBar(
title: Text(
'投稿记录',
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
style: TextStyle(color: _themeController.currentThemeColor),
),
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
elevation: 0,
@@ -154,7 +154,7 @@ class _TougaoPageState extends State<TougaoPage> {
IconButton(
icon: Icon(
Icons.delete_sweep_outlined,
color: isDark ? Colors.white : Colors.black87,
color: _themeController.currentThemeColor,
),
onPressed: _clearAllRecords,
tooltip: '清空记录',
@@ -230,14 +230,16 @@ class _TougaoPageState extends State<TougaoPage> {
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: AppConstants.primaryColor.withValues(alpha: 0.2),
color: _themeController.currentThemeColor.withValues(
alpha: 0.2,
),
borderRadius: BorderRadius.circular(8),
),
child: Text(
record.catename,
style: TextStyle(
fontSize: 12,
color: AppConstants.primaryColor,
color: _themeController.currentThemeColor,
fontWeight: FontWeight.w500,
),
),

View File

@@ -158,7 +158,7 @@ class _VotePageState extends State<VotePage> {
),
backgroundColor: isDark
? const Color(0xFF2A2A2A)
: AppConstants.primaryColor,
: _themeController.currentThemeColor,
elevation: 0,
actions: [
if (_isLoggedIn)
@@ -216,7 +216,7 @@ class _VotePageState extends State<VotePage> {
onPressed: _loadVoteList,
style: ElevatedButton.styleFrom(
backgroundColor:
AppConstants.primaryColor,
_themeController.currentThemeColor,
),
child: const Text('刷新'),
),
@@ -321,14 +321,14 @@ class _VotePageState extends State<VotePage> {
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: AppConstants.primaryColor.withValues(alpha: 0.1),
color: _themeController.currentThemeColor.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
),
child: Icon(
vote.isSingleChoice
? Icons.radio_button_checked
: Icons.check_box,
color: AppConstants.primaryColor,
color: _themeController.currentThemeColor,
size: 20,
),
),
@@ -805,7 +805,7 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
),
backgroundColor: isDark
? const Color(0xFF2A2A2A)
: AppConstants.primaryColor,
: _themeController.currentThemeColor,
elevation: 0,
),
body: _isLoading
@@ -821,10 +821,10 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppConstants.primaryColor.withValues(
_themeController.currentThemeColor.withValues(
alpha: isDark ? 0.3 : 0.1,
),
AppConstants.primaryColor.withValues(
_themeController.currentThemeColor.withValues(
alpha: isDark ? 0.15 : 0.05,
),
],
@@ -841,7 +841,7 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: AppConstants.primaryColor.withValues(
color: _themeController.currentThemeColor.withValues(
alpha: 0.15,
),
borderRadius: BorderRadius.circular(10),
@@ -850,7 +850,7 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
widget.vote.isSingleChoice
? Icons.radio_button_checked
: Icons.check_box,
color: AppConstants.primaryColor,
color: _themeController.currentThemeColor,
size: 24,
),
),
@@ -1134,13 +1134,13 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
decoration: BoxDecoration(
border: Border.all(
color: isSelected
? AppConstants.primaryColor
? _themeController.currentThemeColor
: (isDark ? Colors.grey[600]! : Colors.grey[300]!),
width: 2,
),
borderRadius: BorderRadius.circular(12),
color: isSelected
? AppConstants.primaryColor.withValues(alpha: 0.05)
? _themeController.currentThemeColor.withValues(alpha: 0.05)
: (isDark ? const Color(0xFF2A2A2A) : Colors.white),
),
child: InkWell(
@@ -1159,7 +1159,7 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
? Icons.check_box
: Icons.check_box_outline_blank),
color: isSelected
? AppConstants.primaryColor
? _themeController.currentThemeColor
: (isDark ? Colors.grey[400] : Colors.grey),
),
const SizedBox(width: 12),
@@ -1175,7 +1175,7 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
? FontWeight.bold
: FontWeight.normal,
color: isSelected
? AppConstants.primaryColor
? _themeController.currentThemeColor
: (isDark ? Colors.white : Colors.black),
),
),
@@ -1207,7 +1207,7 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
child: ElevatedButton(
onPressed: _isSubmitting ? null : _submitVote,
style: ElevatedButton.styleFrom(
backgroundColor: AppConstants.primaryColor,
backgroundColor: _themeController.currentThemeColor,
padding: const EdgeInsets.symmetric(vertical: 14),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
@@ -1309,7 +1309,7 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
icon: Icons.poll,
label: '总票数',
value: '${_voteResult!.totalVotes}',
color: AppConstants.primaryColor,
color: _themeController.currentThemeColor,
isDark: isDark,
),
Container(
@@ -1446,7 +1446,7 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
decoration: BoxDecoration(
color: isVoted
? AppConstants.successColor.withValues(alpha: 0.1)
: AppConstants.primaryColor.withValues(alpha: 0.1),
: _themeController.currentThemeColor.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(12),
),
child: Text(
@@ -1454,7 +1454,7 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
style: TextStyle(
color: isVoted
? AppConstants.successColor
: AppConstants.primaryColor,
: _themeController.currentThemeColor,
fontSize: 14,
fontWeight: FontWeight.bold,
),
@@ -1476,7 +1476,7 @@ class _VoteDetailPageState extends State<VoteDetailPage> {
valueColor: AlwaysStoppedAnimation<Color>(
isVoted
? AppConstants.successColor
: AppConstants.primaryColor,
: _themeController.currentThemeColor,
),
minHeight: 8,
),