关怀模式
This commit is contained in:
@@ -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,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user