关怀模式
This commit is contained in:
@@ -304,7 +304,8 @@ class _ActiveSearchPageState extends State<ActiveSearchPage>
|
||||
),
|
||||
),
|
||||
selected: _field.isEmpty,
|
||||
selectedColor: AppConstants.primaryColor,
|
||||
selectedColor:
|
||||
_themeController.currentThemeColor,
|
||||
backgroundColor: isDark
|
||||
? Colors.grey[800]
|
||||
: Colors.grey[200],
|
||||
@@ -327,7 +328,8 @@ class _ActiveSearchPageState extends State<ActiveSearchPage>
|
||||
),
|
||||
),
|
||||
selected: _field == 'name',
|
||||
selectedColor: AppConstants.primaryColor,
|
||||
selectedColor:
|
||||
_themeController.currentThemeColor,
|
||||
backgroundColor: isDark
|
||||
? Colors.grey[800]
|
||||
: Colors.grey[200],
|
||||
@@ -350,7 +352,8 @@ class _ActiveSearchPageState extends State<ActiveSearchPage>
|
||||
),
|
||||
),
|
||||
selected: _field == 'keywords',
|
||||
selectedColor: AppConstants.primaryColor,
|
||||
selectedColor:
|
||||
_themeController.currentThemeColor,
|
||||
backgroundColor: isDark
|
||||
? Colors.grey[800]
|
||||
: Colors.grey[200],
|
||||
@@ -373,7 +376,8 @@ class _ActiveSearchPageState extends State<ActiveSearchPage>
|
||||
),
|
||||
),
|
||||
selected: _field == 'introduce',
|
||||
selectedColor: AppConstants.primaryColor,
|
||||
selectedColor:
|
||||
_themeController.currentThemeColor,
|
||||
backgroundColor: isDark
|
||||
? Colors.grey[800]
|
||||
: Colors.grey[200],
|
||||
@@ -402,7 +406,7 @@ class _ActiveSearchPageState extends State<ActiveSearchPage>
|
||||
),
|
||||
Expanded(
|
||||
child: RefreshIndicator(
|
||||
color: AppConstants.primaryColor,
|
||||
color: _themeController.currentThemeColor,
|
||||
onRefresh: () async {
|
||||
await _runSearch(reset: true);
|
||||
},
|
||||
@@ -426,7 +430,7 @@ class _ActiveSearchPageState extends State<ActiveSearchPage>
|
||||
);
|
||||
}
|
||||
},
|
||||
backgroundColor: AppConstants.primaryColor,
|
||||
backgroundColor: _themeController.currentThemeColor,
|
||||
foregroundColor: Colors.white,
|
||||
tooltip: '返回上一页',
|
||||
child: const Icon(Icons.arrow_back),
|
||||
|
||||
@@ -19,6 +19,7 @@ class CategoryPage extends StatelessWidget {
|
||||
|
||||
return Obx(() {
|
||||
final isDark = themeController.isDarkModeRx.value;
|
||||
final themeColor = themeController.currentThemeColor;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
@@ -41,11 +42,11 @@ class CategoryPage extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
labelColor: AppConstants.primaryColor,
|
||||
labelColor: themeColor,
|
||||
unselectedLabelColor: isDark
|
||||
? Colors.grey[400]
|
||||
: Colors.grey[600],
|
||||
indicatorColor: AppConstants.primaryColor,
|
||||
indicatorColor: themeColor,
|
||||
indicatorWeight: 3,
|
||||
labelStyle: const TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -71,11 +72,13 @@ class CategoryPage extends StatelessWidget {
|
||||
controller.sceneData,
|
||||
controller.tabCategories[0]['label'] as String,
|
||||
isDark,
|
||||
themeColor,
|
||||
),
|
||||
_buildCategoryList(
|
||||
controller.dynastyData,
|
||||
controller.tabCategories[1]['label'] as String,
|
||||
isDark,
|
||||
themeColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -90,6 +93,7 @@ class CategoryPage extends StatelessWidget {
|
||||
Map<String, List<String>> data,
|
||||
String categoryType,
|
||||
bool isDark,
|
||||
Color themeColor,
|
||||
) {
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
@@ -138,14 +142,14 @@ class CategoryPage extends StatelessWidget {
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withAlpha(26),
|
||||
color: themeColor.withAlpha(26),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
'${items.length}',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
@@ -157,7 +161,12 @@ class CategoryPage extends StatelessWidget {
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
children: items.map((item) {
|
||||
return _buildCategoryChip(item, categoryType, isDark);
|
||||
return _buildCategoryChip(
|
||||
item,
|
||||
categoryType,
|
||||
isDark,
|
||||
themeColor,
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
@@ -169,7 +178,12 @@ class CategoryPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCategoryChip(String label, String categoryType, bool isDark) {
|
||||
Widget _buildCategoryChip(
|
||||
String label,
|
||||
String categoryType,
|
||||
bool isDark,
|
||||
Color themeColor,
|
||||
) {
|
||||
final controller = Get.find<CategoryController>();
|
||||
|
||||
return GestureDetector(
|
||||
@@ -179,17 +193,14 @@ class CategoryPage extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withAlpha(26),
|
||||
color: themeColor.withAlpha(26),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: AppConstants.primaryColor.withAlpha(77),
|
||||
width: 1,
|
||||
),
|
||||
border: Border.all(color: themeColor.withAlpha(77), width: 1),
|
||||
),
|
||||
child: Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../constants/app_constants.dart';
|
||||
import '../../config/app_config.dart';
|
||||
import '../../utils/http/http_client.dart';
|
||||
@@ -6,6 +7,7 @@ import '../../models/poetry_model.dart';
|
||||
import '../../controllers/load/locally.dart';
|
||||
import '../../controllers/history_controller.dart';
|
||||
import '../../services/network_listener_service.dart';
|
||||
import '../../services/get/theme_controller.dart';
|
||||
|
||||
/// 时间: 2026-03-25
|
||||
/// 功能: 热门页面
|
||||
@@ -22,6 +24,7 @@ class PopularPage extends StatefulWidget {
|
||||
class _PopularPageState extends State<PopularPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
final ThemeController _themeController = Get.find<ThemeController>();
|
||||
final List<Map<String, dynamic>> _tabCategories = [
|
||||
{'label': '总榜', 'icon': Icons.bar_chart},
|
||||
{'label': '日榜', 'icon': Icons.today},
|
||||
@@ -53,58 +56,81 @@ class _PopularPageState extends State<PopularPage>
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
// 黑色分割线
|
||||
Container(height: 1, color: Colors.black.withValues(alpha: 0.1)),
|
||||
// Tab栏
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
tabs: _tabCategories
|
||||
.map(
|
||||
(category) => Tab(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(category['icon'], size: 16),
|
||||
const SizedBox(width: 6),
|
||||
Text(category['label']),
|
||||
],
|
||||
return Obx(() {
|
||||
final isDark = _themeController.isDarkModeRx.value;
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
// 分割线
|
||||
Container(
|
||||
height: 1,
|
||||
color: isDark ? Colors.grey[800] : Colors.black.withAlpha(10),
|
||||
),
|
||||
// Tab栏
|
||||
Container(
|
||||
color: isDark ? Colors.grey[900] : Colors.white,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
tabs: _tabCategories
|
||||
.map(
|
||||
(category) => Tab(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(category['icon'], size: 16),
|
||||
const SizedBox(width: 6),
|
||||
Text(category['label']),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
labelColor: AppConstants.primaryColor,
|
||||
unselectedLabelColor: Colors.grey[600],
|
||||
indicatorColor: AppConstants.primaryColor,
|
||||
indicatorWeight: 3,
|
||||
labelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
||||
)
|
||||
.toList(),
|
||||
labelColor: themeColor,
|
||||
unselectedLabelColor: isDark
|
||||
? Colors.grey[400]
|
||||
: Colors.grey[600],
|
||||
indicatorColor: themeColor,
|
||||
indicatorWeight: 3,
|
||||
labelStyle: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 内容区域
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: _tabCategories.map((category) {
|
||||
return _buildRankContent(category['label']);
|
||||
}).toList(),
|
||||
// 内容区域
|
||||
Expanded(
|
||||
child: Container(
|
||||
color: isDark ? const Color(0xFF121212) : Colors.grey[50],
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: _tabCategories.map((category) {
|
||||
return _buildRankContent(
|
||||
category['label'],
|
||||
isDark,
|
||||
themeColor,
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildRankContent(String category) {
|
||||
Widget _buildRankContent(String category, bool isDark, Color themeColor) {
|
||||
if (_loading) {
|
||||
return const Center(
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(height: 16),
|
||||
Text('正在加载排行榜...'),
|
||||
CircularProgressIndicator(color: themeColor),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'正在加载排行榜...',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[300] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -115,12 +141,25 @@ class _PopularPageState extends State<PopularPage>
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, size: 64, color: Colors.grey),
|
||||
Icon(
|
||||
Icons.error_outline,
|
||||
size: 64,
|
||||
color: isDark ? Colors.grey[500] : Colors.grey[400],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(_errorMessage, style: const TextStyle(color: Colors.grey)),
|
||||
Text(
|
||||
_errorMessage,
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: _loadRankList,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: themeColor,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
child: const Text('🔄 重试'),
|
||||
),
|
||||
],
|
||||
@@ -129,17 +168,29 @@ class _PopularPageState extends State<PopularPage>
|
||||
}
|
||||
|
||||
if (_rankList.isEmpty) {
|
||||
return const Center(
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.bar_chart, size: 64, color: Colors.grey),
|
||||
SizedBox(height: 16),
|
||||
Text('暂无排行数据', style: TextStyle(color: Colors.grey)),
|
||||
SizedBox(height: 8),
|
||||
Icon(
|
||||
Icons.bar_chart,
|
||||
size: 64,
|
||||
color: isDark ? Colors.grey[500] : Colors.grey[400],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'暂无排行数据',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'换个时间段试试吧',
|
||||
style: TextStyle(color: Colors.grey, fontSize: 12),
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[500] : Colors.grey[600],
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -147,6 +198,7 @@ class _PopularPageState extends State<PopularPage>
|
||||
}
|
||||
|
||||
return RefreshIndicator(
|
||||
color: themeColor,
|
||||
onRefresh: () async => await _loadRankList(forceRefresh: true),
|
||||
child: NotificationListener<ScrollNotification>(
|
||||
onNotification: (scrollNotification) {
|
||||
@@ -167,14 +219,24 @@ class _PopularPageState extends State<PopularPage>
|
||||
itemCount: _rankList.length + (_showBottomIndicator ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
if (index == _rankList.length) {
|
||||
return const Center(
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text('到底了', style: TextStyle(color: Colors.grey)),
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text(
|
||||
'到底了',
|
||||
style: TextStyle(
|
||||
color: isDark ? Colors.grey[500] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return _buildRankItem(_rankList[index], index + 1);
|
||||
return _buildRankItem(
|
||||
_rankList[index],
|
||||
index + 1,
|
||||
isDark,
|
||||
themeColor,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -223,19 +285,23 @@ class _PopularPageState extends State<PopularPage>
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildRankItem(PoetryModel poetry, int index) {
|
||||
Widget _buildRankItem(
|
||||
PoetryModel poetry,
|
||||
int index,
|
||||
bool isDark,
|
||||
Color themeColor,
|
||||
) {
|
||||
final rank = poetry.rank > 0 ? poetry.rank : index;
|
||||
final isTopThree = rank <= 3;
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
elevation: isTopThree ? 4 : 2,
|
||||
color: isDark ? Colors.grey[850] : Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: BorderSide(
|
||||
color: isTopThree
|
||||
? AppConstants.primaryColor
|
||||
: AppConstants.primaryColor.withValues(alpha: 0.2),
|
||||
color: isTopThree ? themeColor : themeColor.withAlpha(20),
|
||||
width: isTopThree ? 2 : 1,
|
||||
),
|
||||
),
|
||||
@@ -254,16 +320,12 @@ class _PopularPageState extends State<PopularPage>
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: isTopThree
|
||||
? AppConstants.primaryColor
|
||||
: AppConstants.primaryColor.withValues(alpha: 0.3),
|
||||
color: isTopThree ? themeColor : themeColor.withAlpha(30),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: isTopThree
|
||||
? null
|
||||
: Border.all(
|
||||
color: AppConstants.primaryColor.withValues(
|
||||
alpha: 0.2,
|
||||
),
|
||||
color: themeColor.withAlpha(20),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
@@ -273,9 +335,7 @@ class _PopularPageState extends State<PopularPage>
|
||||
style: TextStyle(
|
||||
color: isTopThree
|
||||
? Colors.white
|
||||
: AppConstants.primaryColor.withValues(
|
||||
alpha: 0.8,
|
||||
),
|
||||
: themeColor.withAlpha(80),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
@@ -292,8 +352,11 @@ class _PopularPageState extends State<PopularPage>
|
||||
// 标题
|
||||
Text(
|
||||
poetry.name,
|
||||
style: Theme.of(context).textTheme.titleMedium
|
||||
?.copyWith(fontWeight: FontWeight.bold),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: isDark ? Colors.white : Colors.black87,
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
@@ -310,16 +373,14 @@ class _PopularPageState extends State<PopularPage>
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withValues(
|
||||
alpha: 0.1,
|
||||
),
|
||||
color: themeColor.withAlpha(10),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
poetry.alias,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -331,7 +392,9 @@ class _PopularPageState extends State<PopularPage>
|
||||
poetry.url,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Colors.grey[600],
|
||||
color: isDark
|
||||
? Colors.grey[400]
|
||||
: Colors.grey[600],
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
@@ -347,21 +410,29 @@ class _PopularPageState extends State<PopularPage>
|
||||
'👁',
|
||||
poetry.hitsTotal.toString(),
|
||||
'总浏览',
|
||||
isDark,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
_buildStatItem('💖', poetry.like.toString(), '点赞'),
|
||||
_buildStatItem(
|
||||
'💖',
|
||||
poetry.like.toString(),
|
||||
'点赞',
|
||||
isDark,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
if (_tabController.index == 1)
|
||||
_buildStatItem(
|
||||
'📅',
|
||||
poetry.hitsDay.toString(),
|
||||
'今日',
|
||||
isDark,
|
||||
),
|
||||
if (_tabController.index == 2)
|
||||
_buildStatItem(
|
||||
'📊',
|
||||
poetry.hitsMonth.toString(),
|
||||
'本月',
|
||||
isDark,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -382,14 +453,14 @@ class _PopularPageState extends State<PopularPage>
|
||||
vertical: 6,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.orange[700],
|
||||
color: themeColor,
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(12),
|
||||
bottomRight: Radius.circular(12),
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.15),
|
||||
color: Colors.black.withAlpha(15),
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -424,7 +495,7 @@ class _PopularPageState extends State<PopularPage>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatItem(String icon, String value, String label) {
|
||||
Widget _buildStatItem(String icon, String value, String label, bool isDark) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -432,10 +503,20 @@ class _PopularPageState extends State<PopularPage>
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(fontSize: 12, fontWeight: FontWeight.w500),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isDark ? Colors.grey[300] : Colors.black87,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(label, style: TextStyle(fontSize: 10, color: Colors.grey[600])),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: isDark ? Colors.grey[500] : Colors.grey[600],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -70,9 +70,9 @@ class _RatePageState extends State<RatePage>
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
tabs: _tabs.map((tab) => Tab(text: tab)).toList(),
|
||||
labelColor: AppConstants.primaryColor,
|
||||
unselectedLabelColor: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
indicatorColor: AppConstants.primaryColor,
|
||||
labelColor: _themeController.currentThemeColor,
|
||||
unselectedLabelColor: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
indicatorColor: _themeController.currentThemeColor,
|
||||
indicatorWeight: 2,
|
||||
labelStyle: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
@@ -438,27 +438,29 @@ class _RatePageState extends State<RatePage>
|
||||
}
|
||||
|
||||
Color _getActivityColor(int value) {
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
if (value == 0) {
|
||||
return Colors.grey[100]!;
|
||||
} else if (value >= 1 && value <= 5) {
|
||||
return AppConstants.primaryColor.withAlpha(77);
|
||||
return themeColor.withAlpha(77);
|
||||
} else if (value >= 6 && value <= 20) {
|
||||
return AppConstants.primaryColor.withAlpha(128);
|
||||
return themeColor.withAlpha(128);
|
||||
} else if (value >= 21 && value <= 100) {
|
||||
return AppConstants.primaryColor.withAlpha(179);
|
||||
return themeColor.withAlpha(179);
|
||||
} else {
|
||||
return AppConstants.primaryColor;
|
||||
return themeColor;
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildSectionTitle(String title, bool isDark) {
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 4,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor,
|
||||
color: themeColor,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
@@ -497,9 +499,10 @@ class _RatePageState extends State<RatePage>
|
||||
}
|
||||
|
||||
Widget _buildStatItem(String label, String value, IconData icon, bool isDark) {
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
return Column(
|
||||
children: [
|
||||
Icon(icon, color: AppConstants.primaryColor, size: 24),
|
||||
Icon(icon, color: themeColor, size: 24),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
value,
|
||||
@@ -512,6 +515,7 @@ class _RatePageState extends State<RatePage>
|
||||
}
|
||||
|
||||
Widget _buildLegend(bool isDark) {
|
||||
final themeColor = _themeController.currentThemeColor;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -531,10 +535,10 @@ class _RatePageState extends State<RatePage>
|
||||
runSpacing: 8,
|
||||
children: [
|
||||
_buildLegendItem('无活跃', Colors.grey[100]!, isDark),
|
||||
_buildLegendItem('1-5', AppConstants.primaryColor.withAlpha(77), isDark),
|
||||
_buildLegendItem('6-20', AppConstants.primaryColor.withAlpha(128), isDark),
|
||||
_buildLegendItem('21-100', AppConstants.primaryColor.withAlpha(179), isDark),
|
||||
_buildLegendItem('100+', AppConstants.primaryColor, isDark),
|
||||
_buildLegendItem('1-5', themeColor.withAlpha(77), isDark),
|
||||
_buildLegendItem('6-20', themeColor.withAlpha(128), isDark),
|
||||
_buildLegendItem('21-100', themeColor.withAlpha(179), isDark),
|
||||
_buildLegendItem('100+', themeColor, isDark),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -231,7 +231,10 @@ class _CorrPageState extends State<CorrPage>
|
||||
backgroundColor: isDark ? Colors.grey[900] : Colors.white,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios, color: AppConstants.primaryColor),
|
||||
icon: Icon(
|
||||
Icons.arrow_back_ios,
|
||||
color: _themeController.currentThemeColor,
|
||||
),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
title: Column(
|
||||
@@ -298,7 +301,7 @@ class _CorrPageState extends State<CorrPage>
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: RefreshIndicator(
|
||||
key: const ValueKey('list'),
|
||||
color: AppConstants.primaryColor,
|
||||
color: _themeController.currentThemeColor,
|
||||
onRefresh: _loadData,
|
||||
child: ListView.builder(
|
||||
controller: _scrollController,
|
||||
@@ -428,7 +431,7 @@ class _CorrPageState extends State<CorrPage>
|
||||
ElevatedButton(
|
||||
onPressed: _loadData,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppConstants.primaryColor,
|
||||
backgroundColor: _themeController.currentThemeColor,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 32,
|
||||
@@ -486,7 +489,7 @@ class _CorrPageState extends State<CorrPage>
|
||||
height: 24,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
color: AppConstants.primaryColor,
|
||||
color: _themeController.currentThemeColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -544,14 +547,16 @@ class _CorrPageState extends State<CorrPage>
|
||||
vertical: 4,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withAlpha(26),
|
||||
color: _themeController.currentThemeColor.withAlpha(
|
||||
26,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Text(
|
||||
alias,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppConstants.primaryColor,
|
||||
color: _themeController.currentThemeColor,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -808,14 +813,18 @@ class _CorrPageState extends State<CorrPage>
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.note_add,
|
||||
color: AppConstants.primaryColor,
|
||||
color: _themeController.currentThemeColor,
|
||||
),
|
||||
label: Text(
|
||||
'创建笔记',
|
||||
style: TextStyle(color: AppConstants.primaryColor),
|
||||
style: TextStyle(
|
||||
color: _themeController.currentThemeColor,
|
||||
),
|
||||
),
|
||||
style: OutlinedButton.styleFrom(
|
||||
side: BorderSide(color: AppConstants.primaryColor),
|
||||
side: BorderSide(
|
||||
color: _themeController.currentThemeColor,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
),
|
||||
@@ -827,7 +836,7 @@ class _CorrPageState extends State<CorrPage>
|
||||
icon: const Icon(Icons.favorite, color: Colors.white),
|
||||
label: const Text('点赞'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppConstants.primaryColor,
|
||||
backgroundColor: _themeController.currentThemeColor,
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user