关怀模式
This commit is contained in:
@@ -178,11 +178,12 @@ class AllListPageState extends State<AllListPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() {
|
||||
final isDark = _themeController.isDarkMode;
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
|
||||
if (_isLoading && _cards.isEmpty) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: isDark ? Colors.white : AppConstants.primaryColor,
|
||||
color: isDark ? Colors.white : themeColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -216,7 +217,7 @@ class AllListPageState extends State<AllListPage> {
|
||||
if (index == _cards.length) {
|
||||
return _buildBottomIndicator(isDark);
|
||||
}
|
||||
return _buildCard(_cards[index], isDark);
|
||||
return _buildCard(_cards[index], isDark, themeColor);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -285,25 +286,22 @@ class AllListPageState extends State<AllListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCard(UnifiedCard card, bool isDark) {
|
||||
Widget _buildCard(UnifiedCard card, bool isDark, Color themeColor) {
|
||||
switch (card.type) {
|
||||
case CardType.like:
|
||||
return _buildLikeCard(card.data as PoetryData, isDark);
|
||||
return _buildLikeCard(card.data as PoetryData, isDark, themeColor);
|
||||
case CardType.note:
|
||||
return _buildNoteCard(card.data as Map<String, dynamic>, isDark);
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildLikeCard(PoetryData poetry, bool isDark) {
|
||||
Widget _buildLikeCard(PoetryData poetry, bool isDark, Color themeColor) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 0),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.2),
|
||||
width: 1,
|
||||
),
|
||||
border: Border.all(color: themeColor.withValues(alpha: 0.2), width: 1),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: isDark
|
||||
@@ -340,7 +338,7 @@ class AllListPageState extends State<AllListPage> {
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.1),
|
||||
color: themeColor.withValues(alpha: 0.1),
|
||||
borderRadius: const BorderRadius.only(
|
||||
topRight: Radius.circular(10),
|
||||
bottomLeft: Radius.circular(10),
|
||||
@@ -349,17 +347,13 @@ class AllListPageState extends State<AllListPage> {
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.favorite,
|
||||
size: 12,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
Icon(Icons.favorite, size: 12, color: themeColor),
|
||||
const SizedBox(width: 3),
|
||||
Text(
|
||||
'点赞诗词',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -391,17 +385,10 @@ class AllListPageState extends State<AllListPage> {
|
||||
children: [
|
||||
TextButton.icon(
|
||||
onPressed: () => _showPoetryDetails(poetry),
|
||||
icon: Icon(
|
||||
Icons.visibility,
|
||||
size: 14,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
icon: Icon(Icons.visibility, size: 14, color: themeColor),
|
||||
label: Text(
|
||||
'查看详情',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
style: TextStyle(fontSize: 12, color: themeColor),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
|
||||
@@ -198,6 +198,8 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
|
||||
// 显示密码设置对话框
|
||||
Future<void> _showPasswordDialog() async {
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
final isDark = _themeController.isDarkMode;
|
||||
if (_password != null && _password!.isNotEmpty) {
|
||||
final action = await showDialog<String>(
|
||||
context: context,
|
||||
@@ -207,7 +209,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
),
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(Icons.lock, color: AppConstants.primaryColor, size: 24),
|
||||
Icon(Icons.lock, color: themeColor, size: 24),
|
||||
const SizedBox(width: 8),
|
||||
const Text('锁定设置'),
|
||||
],
|
||||
@@ -218,18 +220,22 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[100],
|
||||
color: isDark ? Colors.grey[800] : Colors.grey[100],
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.vpn_key, size: 16, color: Colors.grey[600]),
|
||||
Icon(
|
||||
Icons.vpn_key,
|
||||
size: 16,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'当前密码: $_password',
|
||||
style: TextStyle(
|
||||
color: Colors.grey[700],
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[700],
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
@@ -282,25 +288,21 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
horizontal: 16,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.1),
|
||||
color: themeColor.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.3),
|
||||
color: themeColor.withValues(alpha: 0.3),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.edit,
|
||||
color: AppConstants.primaryColor,
|
||||
size: 22,
|
||||
),
|
||||
Icon(Icons.edit, color: themeColor, size: 22),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
'修改密码',
|
||||
style: TextStyle(
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -555,6 +557,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() {
|
||||
final isDark = _themeController.isDarkMode;
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
return Scaffold(
|
||||
backgroundColor: isDark
|
||||
? const Color(0xFF1A1A1A)
|
||||
@@ -565,7 +568,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
color: isDark ? Colors.white70 : AppConstants.primaryColor,
|
||||
color: isDark ? Colors.white70 : themeColor,
|
||||
),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
@@ -590,7 +593,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
icon: Icon(
|
||||
_isLocked ? Icons.lock : Icons.lock_outline,
|
||||
color: _isLocked
|
||||
? AppConstants.primaryColor
|
||||
? themeColor
|
||||
: (isDark ? Colors.grey[400] : Colors.grey[600]),
|
||||
),
|
||||
onPressed: _showPasswordDialog,
|
||||
@@ -600,7 +603,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
icon: Icon(
|
||||
_isPinned ? Icons.push_pin : Icons.push_pin_outlined,
|
||||
color: _isPinned
|
||||
? AppConstants.primaryColor
|
||||
? themeColor
|
||||
: (isDark ? Colors.grey[400] : Colors.grey[600]),
|
||||
),
|
||||
onPressed: _togglePin,
|
||||
@@ -611,7 +614,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
body: _isLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: isDark ? Colors.white : AppConstants.primaryColor,
|
||||
color: isDark ? Colors.white : themeColor,
|
||||
),
|
||||
)
|
||||
: GestureDetector(
|
||||
@@ -621,7 +624,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
_buildStatusBar(isDark),
|
||||
_buildStatusBar(isDark, themeColor),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -629,9 +632,9 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildTitleInput(isDark),
|
||||
_buildTitleInput(isDark, themeColor),
|
||||
const SizedBox(height: 16),
|
||||
_buildContentInput(isDark),
|
||||
_buildContentInput(isDark, themeColor),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -643,7 +646,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildStatusBar(bool isDark) {
|
||||
Widget _buildStatusBar(bool isDark, Color themeColor) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
color: isDark ? const Color(0xFF2A2A2A) : Colors.grey[50],
|
||||
@@ -696,27 +699,15 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
),
|
||||
if (_isPinned) ...[
|
||||
const SizedBox(width: 16),
|
||||
Icon(Icons.push_pin, size: 14, color: AppConstants.primaryColor),
|
||||
Icon(Icons.push_pin, size: 14, color: themeColor),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'已置顶',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
Text('已置顶', style: TextStyle(fontSize: 12, color: themeColor)),
|
||||
],
|
||||
if (_isLocked) ...[
|
||||
const SizedBox(width: 16),
|
||||
Icon(Icons.lock, size: 14, color: AppConstants.primaryColor),
|
||||
Icon(Icons.lock, size: 14, color: themeColor),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'已锁定',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
Text('已锁定', style: TextStyle(fontSize: 12, color: themeColor)),
|
||||
],
|
||||
],
|
||||
),
|
||||
@@ -776,7 +767,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTitleInput(bool isDark) {
|
||||
Widget _buildTitleInput(bool isDark, Color themeColor) {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -786,7 +777,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: _titleFocusNode.hasFocus
|
||||
? AppConstants.primaryColor.withValues(alpha: 0.5)
|
||||
? themeColor.withValues(alpha: 0.5)
|
||||
: (isDark
|
||||
? Colors.grey[700]!
|
||||
: Colors.grey.withValues(alpha: 0.2)),
|
||||
@@ -859,11 +850,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
child: Row(
|
||||
children: [
|
||||
if (category == _category)
|
||||
Icon(
|
||||
Icons.check,
|
||||
size: 16,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
Icon(Icons.check, size: 16, color: themeColor),
|
||||
if (category == _category) const SizedBox(width: 8),
|
||||
Text(
|
||||
category,
|
||||
@@ -884,11 +871,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
if (!_categoryOptions.contains(_category) &&
|
||||
_category != null &&
|
||||
_category!.isNotEmpty)
|
||||
Icon(
|
||||
Icons.check,
|
||||
size: 16,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
Icon(Icons.check, size: 16, color: themeColor),
|
||||
if (!_categoryOptions.contains(_category) &&
|
||||
_category != null &&
|
||||
_category!.isNotEmpty)
|
||||
@@ -917,18 +900,11 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.folder_outlined,
|
||||
size: 18,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
Icon(Icons.folder_outlined, size: 18, color: themeColor),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
_category ?? '分类',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
style: TextStyle(fontSize: 14, color: themeColor),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_drop_down,
|
||||
@@ -944,7 +920,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildContentInput(bool isDark) {
|
||||
Widget _buildContentInput(bool isDark, Color themeColor) {
|
||||
return Container(
|
||||
constraints: const BoxConstraints(minHeight: 300),
|
||||
decoration: BoxDecoration(
|
||||
@@ -952,7 +928,7 @@ class _CollectNotesPageState extends State<CollectNotesPage> {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: _contentFocusNode.hasFocus
|
||||
? AppConstants.primaryColor.withValues(alpha: 0.5)
|
||||
? themeColor.withValues(alpha: 0.5)
|
||||
: (isDark
|
||||
? Colors.grey[700]!
|
||||
: Colors.grey.withValues(alpha: 0.2)),
|
||||
|
||||
@@ -100,6 +100,7 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
try {
|
||||
// 从SQLite获取完整数据
|
||||
final likedList = await HistoryController.getLikedHistory();
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
|
||||
// 查找对应的诗词数据,优先使用存储的完整数据
|
||||
Map<String, dynamic> poetryData;
|
||||
@@ -136,7 +137,9 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
width: 40,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[300],
|
||||
color: _themeController.isDarkMode
|
||||
? Colors.grey[700]
|
||||
: Colors.grey[300],
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
@@ -146,17 +149,16 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.article,
|
||||
color: AppConstants.primaryColor,
|
||||
size: 24,
|
||||
),
|
||||
Icon(Icons.article, color: themeColor, size: 24),
|
||||
const SizedBox(width: 8),
|
||||
const Text(
|
||||
Text(
|
||||
'诗词详情',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: _themeController.isDarkMode
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
@@ -174,7 +176,9 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.more_horiz,
|
||||
color: Colors.grey[600],
|
||||
color: _themeController.isDarkMode
|
||||
? Colors.grey[400]
|
||||
: Colors.grey[600],
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
@@ -184,7 +188,9 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
IconButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
icon: const Icon(Icons.close),
|
||||
color: Colors.grey[600],
|
||||
color: _themeController.isDarkMode
|
||||
? Colors.grey[400]
|
||||
: Colors.grey[600],
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -202,7 +208,7 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
'精选诗句',
|
||||
poetryData['name'] ?? poetry.name,
|
||||
Icons.format_quote,
|
||||
AppConstants.primaryColor,
|
||||
themeColor,
|
||||
),
|
||||
|
||||
// 时间和标签 - 同一行
|
||||
@@ -277,7 +283,7 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
'译文/介绍',
|
||||
poetryData['introduce'],
|
||||
Icons.translate,
|
||||
AppConstants.primaryColor,
|
||||
themeColor,
|
||||
),
|
||||
|
||||
// 原文 - 单独一行
|
||||
@@ -319,6 +325,7 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
IconData icon,
|
||||
Color accentColor,
|
||||
) {
|
||||
final isDark = _themeController.isDarkMode;
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
@@ -361,9 +368,9 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Text(
|
||||
content,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.black87,
|
||||
color: isDark ? Colors.white : Colors.black87,
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
@@ -405,27 +412,26 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() {
|
||||
final isDark = _themeController.isDarkMode;
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
return Scaffold(
|
||||
backgroundColor: isDark ? const Color(0xFF1A1A1A) : Colors.grey[50],
|
||||
appBar: AppBar(
|
||||
title: const Text('点赞足迹'),
|
||||
backgroundColor: isDark
|
||||
? const Color(0xFF2A2A2A)
|
||||
: AppConstants.primaryColor,
|
||||
backgroundColor: isDark ? const Color(0xFF2A2A2A) : themeColor,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
),
|
||||
body: _buildBody(isDark),
|
||||
body: _buildBody(isDark, themeColor),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildBody(bool isDark) {
|
||||
Widget _buildBody(bool isDark, Color themeColor) {
|
||||
if (_isLoading) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
isDark ? Colors.white : AppConstants.primaryColor,
|
||||
isDark ? Colors.white : themeColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -453,7 +459,7 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
ElevatedButton(
|
||||
onPressed: _loadLikedPoetry,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppConstants.primaryColor,
|
||||
backgroundColor: themeColor,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
child: const Text('重试'),
|
||||
@@ -506,16 +512,14 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
Icon(
|
||||
Icons.refresh,
|
||||
size: 20,
|
||||
color: isDark ? Colors.white70 : AppConstants.primaryColor,
|
||||
color: isDark ? Colors.white70 : themeColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'下拉刷新列表',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark
|
||||
? Colors.white70
|
||||
: AppConstants.primaryColor,
|
||||
color: isDark ? Colors.white70 : themeColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -537,7 +541,7 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
itemCount: _likedPoetryList.length,
|
||||
itemBuilder: (context, index) {
|
||||
final poetry = _likedPoetryList[index];
|
||||
return _buildLikedPoetryCard(poetry, isDark);
|
||||
return _buildLikedPoetryCard(poetry, isDark, themeColor);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -546,7 +550,11 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLikedPoetryCard(PoetryData poetry, bool isDark) {
|
||||
Widget _buildLikedPoetryCard(
|
||||
PoetryData poetry,
|
||||
bool isDark,
|
||||
Color themeColor,
|
||||
) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -587,20 +595,20 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppConstants.primaryColor.withValues(alpha: 0.1),
|
||||
AppConstants.primaryColor.withValues(alpha: 0.05),
|
||||
themeColor.withValues(alpha: 0.1),
|
||||
themeColor.withValues(alpha: 0.05),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.2),
|
||||
color: themeColor.withValues(alpha: 0.2),
|
||||
width: 1,
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.1),
|
||||
color: themeColor.withValues(alpha: 0.1),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -611,11 +619,7 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.format_quote,
|
||||
color: AppConstants.primaryColor,
|
||||
size: 20,
|
||||
),
|
||||
Icon(Icons.format_quote, color: themeColor, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
@@ -623,7 +627,7 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -702,7 +706,7 @@ class _FootprintPageState extends State<FootprintPage>
|
||||
icon: const Icon(Icons.visibility, size: 18),
|
||||
label: const Text('查看详情'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppConstants.primaryColor,
|
||||
backgroundColor: themeColor,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(
|
||||
|
||||
@@ -14,6 +14,8 @@ import '../../../config/app_config.dart';
|
||||
import '../../../controllers/history_controller.dart';
|
||||
import '../../../utils/http/poetry_api.dart';
|
||||
import '../../../services/network_listener_service.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../home/set/home_components.dart';
|
||||
|
||||
/// 点赞诗词管理器
|
||||
@@ -295,6 +297,7 @@ class _LikedPoetryManagerState extends State<LikedPoetryManager>
|
||||
bool _isLoading = false;
|
||||
String _errorMessage = '';
|
||||
StreamSubscription<NetworkEvent>? _networkSubscription;
|
||||
final ThemeController _themeController = Get.find<ThemeController>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -393,14 +396,21 @@ class _LikedPoetryManagerState extends State<LikedPoetryManager>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _buildLikedPoetryList();
|
||||
return Obx(() {
|
||||
return _buildLikedPoetryList();
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildLikedPoetryList() {
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
final isDark = _themeController.isDarkMode;
|
||||
|
||||
if (_isLoading) {
|
||||
return const Center(
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(AppConstants.primaryColor),
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
isDark ? Colors.white : themeColor,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -420,7 +430,7 @@ class _LikedPoetryManagerState extends State<LikedPoetryManager>
|
||||
ElevatedButton(
|
||||
onPressed: _loadLikedPoetry,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppConstants.primaryColor,
|
||||
backgroundColor: themeColor,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
child: const Text('重试'),
|
||||
@@ -435,16 +445,26 @@ class _LikedPoetryManagerState extends State<LikedPoetryManager>
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.favorite_border, size: 64, color: Colors.grey[400]),
|
||||
Icon(
|
||||
Icons.favorite_border,
|
||||
size: 64,
|
||||
color: isDark ? Colors.grey[600] : Colors.grey[400],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'暂无点赞记录',
|
||||
style: TextStyle(fontSize: 16, color: Colors.grey[600]),
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'去主页点赞喜欢的诗词吧',
|
||||
style: TextStyle(fontSize: 14, color: Colors.grey[500]),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? Colors.grey[500] : Colors.grey[500],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -464,44 +484,61 @@ class _LikedPoetryManagerState extends State<LikedPoetryManager>
|
||||
itemCount: _likedPoetryList.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == _likedPoetryList.length) {
|
||||
return _buildBottomIndicator();
|
||||
return _buildBottomIndicator(isDark);
|
||||
}
|
||||
final poetry = _likedPoetryList[index];
|
||||
return _buildLikedPoetryCard(poetry);
|
||||
return _buildLikedPoetryCard(poetry, themeColor, isDark);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomIndicator() {
|
||||
Widget _buildBottomIndicator(bool isDark) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(width: 40, height: 1, color: Colors.grey[300]),
|
||||
Container(
|
||||
width: 40,
|
||||
height: 1,
|
||||
color: isDark ? Colors.grey[700] : Colors.grey[300],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Text(
|
||||
'到底了',
|
||||
style: TextStyle(fontSize: 12, color: Colors.grey[400]),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: isDark ? Colors.grey[500] : Colors.grey[400],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(width: 40, height: 1, color: Colors.grey[300]),
|
||||
Container(
|
||||
width: 40,
|
||||
height: 1,
|
||||
color: isDark ? Colors.grey[700] : Colors.grey[300],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLikedPoetryCard(PoetryData poetry) {
|
||||
Widget _buildLikedPoetryCard(
|
||||
PoetryData poetry,
|
||||
Color themeColor,
|
||||
bool isDark,
|
||||
) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.03),
|
||||
color: isDark
|
||||
? Colors.black.withValues(alpha: 0.3)
|
||||
: Colors.black.withValues(alpha: 0.03),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 1),
|
||||
),
|
||||
@@ -519,15 +556,15 @@ class _LikedPoetryManagerState extends State<LikedPoetryManager>
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppConstants.primaryColor.withValues(alpha: 0.1),
|
||||
AppConstants.primaryColor.withValues(alpha: 0.05),
|
||||
themeColor.withValues(alpha: 0.1),
|
||||
themeColor.withValues(alpha: 0.05),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
border: Border.all(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.2),
|
||||
color: themeColor.withValues(alpha: 0.2),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
@@ -537,18 +574,14 @@ class _LikedPoetryManagerState extends State<LikedPoetryManager>
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.format_quote,
|
||||
color: AppConstants.primaryColor,
|
||||
size: 14,
|
||||
),
|
||||
Icon(Icons.format_quote, color: themeColor, size: 14),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'精选诗句',
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -556,10 +589,10 @@ class _LikedPoetryManagerState extends State<LikedPoetryManager>
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
poetry.name,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.black87,
|
||||
color: isDark ? Colors.white : Colors.black87,
|
||||
height: 1.2,
|
||||
),
|
||||
),
|
||||
@@ -573,7 +606,10 @@ class _LikedPoetryManagerState extends State<LikedPoetryManager>
|
||||
padding: const EdgeInsets.fromLTRB(8, 4, 8, 2),
|
||||
child: Text(
|
||||
"出处:${poetry.url}",
|
||||
style: TextStyle(fontSize: 11, color: Colors.grey[600]),
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
),
|
||||
@@ -613,7 +649,7 @@ class _LikedPoetryManagerState extends State<LikedPoetryManager>
|
||||
icon: const Icon(Icons.visibility, size: 14),
|
||||
label: const Text('查看详情', style: TextStyle(fontSize: 12)),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppConstants.primaryColor,
|
||||
backgroundColor: themeColor,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
|
||||
@@ -78,17 +78,18 @@ class _LocalNotesListState extends State<LocalNotesList> {
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() {
|
||||
final isDark = _themeController.isDarkMode;
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
|
||||
if (_isLoadingNotes && _notes.isEmpty) {
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: isDark ? Colors.white : AppConstants.primaryColor,
|
||||
color: isDark ? Colors.white : themeColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (_notes.isEmpty) {
|
||||
return _buildEmptyNotes(isDark);
|
||||
return _buildEmptyNotes(isDark, themeColor);
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
@@ -107,7 +108,7 @@ class _LocalNotesListState extends State<LocalNotesList> {
|
||||
return _buildBottomIndicator(isDark);
|
||||
}
|
||||
final note = _notes[index];
|
||||
return _buildNoteCard(note, isDark);
|
||||
return _buildNoteCard(note, isDark, themeColor);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -145,7 +146,7 @@ class _LocalNotesListState extends State<LocalNotesList> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEmptyNotes(bool isDark) {
|
||||
Widget _buildEmptyNotes(bool isDark, Color themeColor) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -176,7 +177,7 @@ class _LocalNotesListState extends State<LocalNotesList> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNoteCard(Map<String, dynamic> note, bool isDark) {
|
||||
Widget _buildNoteCard(Map<String, dynamic> note, bool isDark, Color themeColor) {
|
||||
final title = note['title'] as String? ?? '';
|
||||
final content = note['content'] as String? ?? '';
|
||||
final timeStr = note['time'] as String? ?? '';
|
||||
@@ -272,7 +273,7 @@ class _LocalNotesListState extends State<LocalNotesList> {
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withValues(
|
||||
color: themeColor.withValues(
|
||||
alpha: 0.1,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
@@ -281,7 +282,7 @@ class _LocalNotesListState extends State<LocalNotesList> {
|
||||
category,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -292,7 +293,7 @@ class _LocalNotesListState extends State<LocalNotesList> {
|
||||
child: Icon(
|
||||
Icons.lock,
|
||||
size: 16,
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
@@ -305,7 +306,7 @@ class _LocalNotesListState extends State<LocalNotesList> {
|
||||
: Icons.push_pin_outlined,
|
||||
size: 16,
|
||||
color: isPinned
|
||||
? AppConstants.primaryColor
|
||||
? themeColor
|
||||
: (isDark
|
||||
? Colors.grey[500]
|
||||
: Colors.grey[400]),
|
||||
@@ -418,7 +419,7 @@ class _LocalNotesListState extends State<LocalNotesList> {
|
||||
Icon(
|
||||
Icons.lock,
|
||||
size: 28,
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Column(
|
||||
@@ -430,7 +431,7 @@ class _LocalNotesListState extends State<LocalNotesList> {
|
||||
'已锁定',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user