关怀模式

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

@@ -153,7 +153,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('已保存 $_downloadedCount 条数据'),
backgroundColor: AppConstants.primaryColor,
backgroundColor: _themeController.currentThemeColor,
),
);
}
@@ -265,7 +265,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
content: Text(
'成功缓存 ${_selectedType == DownloadType.poetry ? '诗词' : '答题'} $_cachedCount 条数据',
),
backgroundColor: AppConstants.primaryColor,
backgroundColor: _themeController.currentThemeColor,
),
);
}
@@ -371,7 +371,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('已清空$typeName离线数据'),
backgroundColor: AppConstants.primaryColor,
backgroundColor: _themeController.currentThemeColor,
),
);
}
@@ -401,9 +401,9 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('已清空所有离线数据'),
backgroundColor: AppConstants.primaryColor,
SnackBar(
content: const Text('已清空所有离线数据'),
backgroundColor: _themeController.currentThemeColor,
),
);
}
@@ -515,6 +515,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
Widget build(BuildContext context) {
return Obx(() {
final isDark = _themeController.isDarkMode;
final primaryColor = _themeController.currentThemeColor;
return Scaffold(
backgroundColor: isDark
? const Color(0xFF1A1A1A)
@@ -522,24 +523,18 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
appBar: AppBar(
title: Text(
'离线使用',
style: TextStyle(
color: AppConstants.primaryColor,
fontWeight: FontWeight.bold,
),
style: TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
),
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
elevation: 0,
centerTitle: true,
leading: IconButton(
icon: Icon(Icons.arrow_back, color: AppConstants.primaryColor),
icon: Icon(Icons.arrow_back, color: primaryColor),
onPressed: () => Navigator.of(context).pop(),
),
actions: [
IconButton(
icon: Icon(
Icons.cloud_outlined,
color: AppConstants.primaryColor,
),
icon: Icon(Icons.cloud_outlined, color: primaryColor),
onPressed: _showServerInfo,
tooltip: '服务器信息',
),
@@ -555,7 +550,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.05),
color: Colors.black.withAlpha(isDark ? 30 : 5),
blurRadius: 10,
offset: const Offset(0, 2),
),
@@ -565,11 +560,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
children: [
Row(
children: [
Icon(
Icons.download_done,
color: AppConstants.primaryColor,
size: 24,
),
Icon(Icons.download_done, color: primaryColor, size: 24),
const SizedBox(width: 12),
Text(
'缓存状态',
@@ -615,7 +606,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.05),
color: Colors.black.withAlpha(isDark ? 30 : 5),
blurRadius: 10,
offset: const Offset(0, 2),
),
@@ -626,11 +617,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
children: [
Row(
children: [
Icon(
Icons.category,
color: AppConstants.primaryColor,
size: 20,
),
Icon(Icons.category, color: primaryColor, size: 20),
const SizedBox(width: 8),
Text(
'下载类型',
@@ -663,7 +650,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: isDark ? 0.3 : 0.05),
color: Colors.black.withAlpha(isDark ? 30 : 5),
blurRadius: 10,
offset: const Offset(0, 2),
),
@@ -674,11 +661,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
children: [
Row(
children: [
Icon(
Icons.settings,
color: AppConstants.primaryColor,
size: 20,
),
Icon(Icons.settings, color: primaryColor, size: 20),
const SizedBox(width: 8),
Text(
'下载数量',
@@ -720,9 +703,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
? (_isCancelling ? null : _cancelDownload)
: _downloadOfflineData,
style: ElevatedButton.styleFrom(
backgroundColor: _isCancelling
? Colors.red
: AppConstants.primaryColor,
backgroundColor: _isCancelling ? Colors.red : primaryColor,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
@@ -804,9 +785,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
backgroundColor: isDark
? Colors.grey[700]
: Colors.grey[200],
valueColor: AlwaysStoppedAnimation<Color>(
AppConstants.primaryColor,
),
valueColor: AlwaysStoppedAnimation<Color>(primaryColor),
borderRadius: BorderRadius.circular(10),
),
const SizedBox(height: 8),
@@ -942,6 +921,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
Widget _buildTypeOption(DownloadType type, String label, bool isDark) {
final isSelected = _selectedType == type;
final primaryColor = _themeController.currentThemeColor;
return GestureDetector(
onTap: () {
setState(() {
@@ -954,12 +934,12 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
decoration: BoxDecoration(
color: isSelected
? AppConstants.primaryColor
? primaryColor
: (isDark ? Colors.grey[800] : Colors.grey[100]),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: isSelected
? AppConstants.primaryColor
? primaryColor
: (isDark ? Colors.grey[700]! : Colors.grey[300]!),
),
),
@@ -979,6 +959,7 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
Widget _buildCountOption(int count, bool isDark) {
final isSelected = _selectedCount == count;
final primaryColor = _themeController.currentThemeColor;
return Stack(
children: [
GestureDetector(
@@ -991,12 +972,12 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
decoration: BoxDecoration(
color: isSelected
? AppConstants.primaryColor
? primaryColor
: (isDark ? Colors.grey[800] : Colors.grey[100]),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: isSelected
? AppConstants.primaryColor
? primaryColor
: (isDark ? Colors.grey[700]! : Colors.grey[300]!),
),
),