This commit is contained in:
Developer
2026-04-03 03:26:06 +08:00
parent 3063deb34c
commit cba04235c8
49 changed files with 3955 additions and 1421 deletions

View File

@@ -87,15 +87,17 @@ class _AppInfoPageState extends State<AppInfoPage> {
_isDeveloperMode = true;
});
_saveDeveloperMode(true);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('开发者模式激活'),
duration: Duration(seconds: 2),
),
);
}
_tapCount = 0;
final primaryColor = _themeController.currentThemeColor;
Get.snackbar(
'提示',
'开发者模式激活',
snackPosition: SnackPosition.BOTTOM,
colorText: primaryColor,
duration: const Duration(seconds: 2),
borderRadius: 8,
margin: const EdgeInsets.all(16),
);
}
}
@@ -125,11 +127,15 @@ class _AppInfoPageState extends State<AppInfoPage> {
IconButton(
icon: const Icon(Icons.bug_report, color: Colors.green),
onPressed: () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('调试信息已激活'),
duration: Duration(seconds: 2),
),
final primaryColor = _themeController.currentThemeColor;
Get.snackbar(
'提示',
'调试信息已激活',
snackPosition: SnackPosition.BOTTOM,
colorText: primaryColor,
duration: const Duration(seconds: 2),
borderRadius: 8,
margin: const EdgeInsets.all(16),
);
},
),
@@ -149,8 +155,6 @@ class _AppInfoPageState extends State<AppInfoPage> {
_buildDeviceInfoCard(context, isDark, primaryColor),
const SizedBox(height: 16),
_buildUpdateLogCard(isDark),
const SizedBox(height: 16),
_buildDesignStyleCard(isDark),
const SizedBox(height: 24),
_buildBottomIndicator(isDark),
],
@@ -251,7 +255,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
GestureDetector(
onTap: _onFrameworkTap,
child: const Text(
'框架 1.3',
'框架 1.4',
style: TextStyle(
fontSize: 12,
color: Colors.white,
@@ -270,16 +274,18 @@ class _AppInfoPageState extends State<AppInfoPage> {
: Colors.white.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(4),
),
child: Text(
'软件版本 ${AppConfig.appVersion}',
style: TextStyle(
fontSize: 10,
color: _isDeveloperMode
? Colors.green
: Colors.white,
fontWeight: _isDeveloperMode
? FontWeight.bold
: FontWeight.normal,
child: Obx(
() => Text(
'软件版本 ${AppConfig.appVersion}',
style: TextStyle(
fontSize: 10,
color: _isDeveloperMode
? Colors.green
: Colors.white,
fontWeight: _isDeveloperMode
? FontWeight.bold
: FontWeight.normal,
),
),
),
),
@@ -350,15 +356,15 @@ class _AppInfoPageState extends State<AppInfoPage> {
childAspectRatio: 2.2,
children: [
_buildTechStackItem(
'Flutter',
'跨平台UI框架',
'Dart',
'编程语言',
Icons.flutter_dash,
Colors.blue,
isDark,
),
_buildTechStackItem(
'Dart',
'编程语言',
'Getx',
'状态管理库',
Icons.code,
Colors.teal,
isDark,
@@ -456,19 +462,23 @@ class _AppInfoPageState extends State<AppInfoPage> {
),
),
Divider(height: 1, color: isDark ? Colors.grey[800] : null),
_buildCopyableItem(
context,
'版本号',
AppConfig.appVersion,
Icons.verified,
isDark,
Obx(
() => _buildCopyableItem(
context,
'版本号',
AppConfig.appVersion,
Icons.verified,
isDark,
),
),
_buildCopyableItem(
context,
'Builder version',
'26d03a26',
Icons.developer_mode,
isDark,
Obx(
() => _buildCopyableItem(
context,
'Builder version',
AppConfig.appVersionCode.toString(),
Icons.developer_mode,
isDark,
),
),
_buildInfoItem(
'打包时间',
@@ -542,6 +552,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
{'name': 'Cupertino Icons', 'license': 'MIT'},
{'name': 'Shared Preferences', 'license': 'BSD 3-Clause'},
{'name': 'Dio', 'license': 'MIT'},
{'name': 'GetX', 'license': 'MIT'},
{'name': 'Platform Info', 'license': 'MIT'},
{'name': 'flutter_udid', 'license': 'MIT'},
];
@@ -979,26 +990,27 @@ class _AppInfoPageState extends State<AppInfoPage> {
],
),
),
// Divider(height: 1, color: isDark ? Colors.grey[800] : null),
// Padding(
// padding: const EdgeInsets.all(16),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// _buildUpdateItem('版本 1.2.40', '2026-03-27', [
// '新增:主题个性化页面',
// '新增:设计风格卡片',
// '优化:界面布局和响应式设计',
// ], isDark),
// const SizedBox(height: 16),
// _buildUpdateItem('版本 1.2.39', '2026-03-27', [
// '修复:引导页滑动问题',
// '优化:左侧进度条位置',
// '新增:协议内容焦点功能',
// ], isDark),
// ],
// ),
// ),
Divider(height: 1, color: isDark ? Colors.grey[800] : null),
Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildUpdateItem('版本 1.4.1', '2026-04-03', [
'新增:从 pubspec.yaml 动态获取版本号',
'新增:响应式版本号显示',
'优化:解决 package_info_plus 依赖冲突',
'修复:版本号不显示的问题',
], isDark),
const SizedBox(height: 16),
_buildUpdateItem('版本 1.3.59', '2026-04-03', [
'修复:出处字段被时间提示语遮挡的问题',
'修复:时间提示语布局遮挡问题',
'优化:诗词卡片内容布局',
], isDark),
],
),
),
],
),
);
@@ -1417,20 +1429,15 @@ class _AppInfoPageState extends State<AppInfoPage> {
void _copyToClipboard(BuildContext context, String text) {
Clipboard.setData(ClipboardData(text: text));
final primaryColor = _themeController.currentThemeColor;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Row(
children: [
const Icon(Icons.check_circle, color: Colors.white, size: 20),
const SizedBox(width: 8),
Text('$text 已复制到剪贴板'),
],
),
backgroundColor: primaryColor,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
duration: const Duration(seconds: 2),
),
Get.snackbar(
'复制成功',
'$text 已复制到剪贴板',
snackPosition: SnackPosition.BOTTOM,
colorText: primaryColor,
duration: const Duration(seconds: 2),
borderRadius: 8,
margin: const EdgeInsets.all(16),
icon: Icon(Icons.check_circle, color: primaryColor, size: 20),
);
}

View File

@@ -150,10 +150,7 @@ class _EntirePageState extends State<EntirePage>
backgroundColor: AppColors.surface,
elevation: 0,
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios,
color: AppColors.primary,
),
icon: Icon(Icons.arrow_back_ios, color: AppColors.primary),
onPressed: () => Navigator.pop(context),
),
title: Text(
@@ -167,20 +164,14 @@ class _EntirePageState extends State<EntirePage>
centerTitle: true,
actions: [
IconButton(
icon: Icon(
Icons.info_outline,
color: AppColors.primary,
),
icon: Icon(Icons.info_outline, color: AppColors.primary),
onPressed: _showServerInfo,
tooltip: '服务器信息',
),
],
bottom: PreferredSize(
preferredSize: const Size.fromHeight(0.5),
child: Container(
height: 0.5,
color: AppColors.divider,
),
child: Container(height: 0.5, color: AppColors.divider),
),
);
}
@@ -417,10 +408,7 @@ class _EntirePageState extends State<EntirePage>
const SizedBox(height: 16),
Text(
_errorMessage ?? '加载失败',
style: TextStyle(
color: AppColors.tertiaryText,
fontSize: 14,
),
style: TextStyle(color: AppColors.tertiaryText, fontSize: 14),
textAlign: TextAlign.center,
),
const SizedBox(height: 24),
@@ -475,10 +463,7 @@ class _EntirePageState extends State<EntirePage>
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
AppColors.primary,
AppColors.primary.withValues(alpha: 0.8),
],
colors: [AppColors.primary, AppColors.primary.withValues(alpha: 0.8)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
@@ -590,13 +575,6 @@ class _EntirePageState extends State<EntirePage>
Widget _buildCountGrid(bool isDark) {
final counts = [
{
'label': '项目',
'value': _statsData?['count_category'] ?? 0,
'icon': Icons.category,
'color': AppColors.iosBlue,
'showIcon': true,
},
{
'label': '收录诗句',
'value': _statsData?['count_site'] ?? 0,
@@ -604,6 +582,31 @@ class _EntirePageState extends State<EntirePage>
'color': AppColors.iosGreen,
'showIcon': false,
},
{
'label': '诗词题目',
'value': _statsData?['count_article_category'] ?? 0,
'icon': Icons.folder,
'color': AppColors.iosPink,
'showIcon': false,
},
{
'label': '分类标签',
'value': _statsData?['count_tags'] ?? 0,
'icon': Icons.label,
'color': const Color(0xFF64D2FF),
'showIcon': false,
},
{
'label': '项目',
'value': _statsData?['count_category'] ?? 0,
'icon': Icons.category,
'color': AppColors.iosBlue,
'showIcon': true,
},
{
'label': '审核中',
'value': _statsData?['count_apply'] ?? 0,
@@ -625,13 +628,7 @@ class _EntirePageState extends State<EntirePage>
'color': AppColors.iosPurple,
'showIcon': true,
},
{
'label': '文章分类',
'value': _statsData?['count_article_category'] ?? 0,
'icon': Icons.folder,
'color': AppColors.iosPink,
'showIcon': true,
},
{
'label': '推送',
'value': _statsData?['count_notice'] ?? 0,
@@ -646,13 +643,6 @@ class _EntirePageState extends State<EntirePage>
'color': AppColors.iosRed,
'showIcon': true,
},
{
'label': '分类标签',
'value': _statsData?['count_tags'] ?? 0,
'icon': Icons.label,
'color': const Color(0xFF64D2FF),
'showIcon': false,
},
];
return GridView.builder(
@@ -739,10 +729,7 @@ class _EntirePageState extends State<EntirePage>
child: Center(
child: Text(
label,
style: TextStyle(
fontSize: 12,
color: AppColors.secondaryText,
),
style: TextStyle(fontSize: 12, color: AppColors.secondaryText),
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
@@ -974,11 +961,7 @@ class _EntirePageState extends State<EntirePage>
color: AppColors.primary.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(10),
),
child: Icon(
Icons.cake,
color: AppColors.primary,
size: 20,
),
child: Icon(Icons.cake, color: AppColors.primary, size: 20),
),
const SizedBox(width: 12),
Expanded(

View File

@@ -801,7 +801,7 @@ class _AppDataPageState extends State<AppDataPage> {
),
_buildDivider(),
_buildActionButton(
'🔧 原生清理数据',
'🔧 系统级清理数据',
'删除应用数据目录所有文件',
Icons.system_security_update_warning,
Colors.orange,

View File

@@ -3,6 +3,7 @@ import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../constants/app_constants.dart';
import '../../../services/get/theme_controller.dart';
import '../../../controllers/settings/suggestions.dart';
/// 时间: 2026-03-27
/// 功能: 权限管理页面
@@ -142,6 +143,8 @@ class _PermissionPageState extends State<PermissionPage> {
const SizedBox(height: 16),
_buildProjectSupplement(isDark),
const SizedBox(height: 24),
const SuggestionsCard(),
const SizedBox(height: 24),
_buildBottomTip(isDark),
],
),
@@ -674,14 +677,14 @@ class _PermissionPageState extends State<PermissionPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 4,
height: 4,
margin: const EdgeInsets.only(top: 8),
decoration: BoxDecoration(
color: _themeController.currentThemeColor,
borderRadius: BorderRadius.circular(2),
),
width: 4,
height: 4,
margin: const EdgeInsets.only(top: 8),
decoration: BoxDecoration(
color: _themeController.currentThemeColor,
borderRadius: BorderRadius.circular(2),
),
),
const SizedBox(width: 12),
Expanded(
child: Column(

View File

@@ -496,6 +496,8 @@ class HistoryPage extends StatelessWidget {
int index,
Map<String, dynamic> item,
) {
final themeController = Get.find<ThemeController>();
final primaryColor = themeController.currentThemeColor;
showCupertinoModalPopup(
context: context,
builder: (BuildContext context) => CupertinoActionSheet(
@@ -512,14 +514,14 @@ class HistoryPage extends StatelessWidget {
CupertinoActionSheetAction(
onPressed: () {
Get.back();
Get.snackbar('提示', '分享功能开发中...');
Get.snackbar('提示', '分享功能开发中...', colorText: primaryColor);
},
child: const Text('分享'),
),
CupertinoActionSheetAction(
onPressed: () {
Get.back();
Get.snackbar('提示', '查看详情功能开发中...');
Get.snackbar('提示', '查看详情功能开发中...', colorText: primaryColor);
},
child: const Text('查看详情'),
),

View File

@@ -933,11 +933,15 @@ class _PoetryLevelPageState extends State<PoetryLevelPage>
width: double.infinity,
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
color: isDark
? Colors.grey[800]
: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
color: Colors.black.withAlpha(
isDark ? 40 : 10,
),
blurRadius: 12,
offset: const Offset(0, 4),
),
@@ -953,10 +957,15 @@ class _PoetryLevelPageState extends State<PoetryLevelPage>
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.white,
Colors.grey[50]!,
],
colors: isDark
? [
Colors.grey[700]!,
Colors.grey[800]!,
]
: [
Colors.white,
Colors.grey[50]!,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
@@ -964,7 +973,7 @@ class _PoetryLevelPageState extends State<PoetryLevelPage>
BorderRadius.circular(12),
border: Border.all(
color: primaryColor.withAlpha(
50,
isDark ? 80 : 50,
),
width: 1,
),
@@ -988,18 +997,19 @@ class _PoetryLevelPageState extends State<PoetryLevelPage>
children: [
Icon(
Icons.arrow_back,
color: AppConstants
.primaryColor,
color: primaryColor,
size: 20,
),
const SizedBox(width: 8),
const Text(
Text(
'上一题',
style: TextStyle(
fontSize: 14,
fontWeight:
FontWeight.w500,
color: Colors.black87,
color: isDark
? Colors.white
: Colors.black87,
),
),
],
@@ -1013,10 +1023,15 @@ class _PoetryLevelPageState extends State<PoetryLevelPage>
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.white,
Colors.grey[50]!,
],
colors: isDark
? [
Colors.grey[700]!,
Colors.grey[800]!,
]
: [
Colors.white,
Colors.grey[50]!,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
@@ -1029,7 +1044,7 @@ class _PoetryLevelPageState extends State<PoetryLevelPage>
boxShadow: [
BoxShadow(
color: primaryColor.withAlpha(
30,
isDark ? 50 : 30,
),
blurRadius: 8,
offset: const Offset(0, 4),
@@ -1057,18 +1072,19 @@ class _PoetryLevelPageState extends State<PoetryLevelPage>
children: [
Icon(
Icons.lightbulb_outline,
color: AppConstants
.primaryColor,
color: primaryColor,
size: 20,
),
const SizedBox(width: 8),
const Text(
Text(
'提示',
style: TextStyle(
fontSize: 14,
fontWeight:
FontWeight.w600,
color: Colors.black87,
color: isDark
? Colors.white
: Colors.black87,
),
),
],
@@ -1093,9 +1109,9 @@ class _PoetryLevelPageState extends State<PoetryLevelPage>
BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: AppConstants
.primaryColor
.withAlpha(80),
color: primaryColor.withAlpha(
isDark ? 60 : 80,
),
blurRadius: 12,
offset: const Offset(0, 4),
),

View File

@@ -278,10 +278,12 @@ class PersonalCardState extends State<PersonalCard> {
HapticFeedback.lightImpact();
// 显示切换提示
final themeController = Get.find<ThemeController>();
Get.snackbar(
'头像切换',
'头像已切换为 ${_avatarEmojis[_currentAvatarIndex]}',
duration: const Duration(seconds: 1),
colorText: themeController.currentThemeColor,
);
}

View File

@@ -568,7 +568,7 @@ class ProfilePage extends StatelessWidget {
),
const SizedBox(height: 8),
Text(
'版本 ${AppConstants.appVersion}',
'版本 ${AppConfig.appVersion}',
style: TextStyle(
fontSize: 14,
color: isDark ? Colors.grey[400] : Colors.grey,

View File

@@ -51,6 +51,7 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
Future<void> _loadSettings() async {
final prefs = await SharedPreferences.getInstance();
await GlobalTipsManager().init();
await AudioManager().init(); // 确保 AudioManager 已初始化
if (mounted) {
setState(() {
_autoRefreshEnabled = prefs.getBool(_autoRefreshKey) ?? false;
@@ -62,6 +63,8 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
_hideSecondaryButtons =
prefs.getBool(_hideSecondaryButtonsKey) ?? false; // 加载隐藏次要按钮状态
});
// 同步到 AudioManager
AudioManager().setMuted(!_soundEnabled);
}
}
@@ -101,7 +104,7 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
final prefs = await SharedPreferences.getInstance();
await prefs.setBool(_soundEnabledKey, value);
// 更新 AudioManager 的静音状态
AudioManager().setMuted(!value);
await AudioManager().setMuted(!value);
if (mounted) {
setState(() {
_soundEnabled = value;
@@ -506,60 +509,53 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
final primaryColor = _themeController.currentThemeColor;
return Obx(() {
final currentIndex = _glassController.transparencyLevelIndex;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 8),
child: Row(
return Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 12),
child: Row(
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: primaryColor.withAlpha(10),
borderRadius: BorderRadius.circular(8),
),
child: Icon(Icons.opacity, color: primaryColor, size: 20),
),
const SizedBox(width: 12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: primaryColor.withAlpha(10),
borderRadius: BorderRadius.circular(8),
Text(
'高透级别',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
color: isDark ? Colors.white : Colors.black,
),
child: Icon(Icons.opacity, color: primaryColor, size: 20),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'高透级别',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
color: isDark ? Colors.white : Colors.black,
),
),
Text(
'当前: ${_glassController.transparencyLevelLabel}',
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
),
],
Text(
'当前: ${_glassController.transparencyLevelLabel}',
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey[600],
),
),
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
child: Row(
children: [
_buildLevelButton('', 0, currentIndex == 0, isDark),
const SizedBox(width: 8),
_buildLevelButton('', 1, currentIndex == 1, isDark),
const SizedBox(width: 8),
_buildLevelButton('', 2, currentIndex == 2, isDark),
],
const SizedBox(width: 12),
Expanded(
child: Row(
children: [
_buildLevelButton('', 0, currentIndex == 0, isDark),
const SizedBox(width: 8),
_buildLevelButton('', 1, currentIndex == 1, isDark),
const SizedBox(width: 8),
_buildLevelButton('', 2, currentIndex == 2, isDark),
],
),
),
),
],
],
),
);
});
}

View File

@@ -212,30 +212,18 @@ class LearnUsPage extends StatelessWidget {
),
),
const SizedBox(height: 12),
Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF3A3A3A) : Colors.grey[50],
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: isDark
? Colors.grey[700]!.withAlpha(20)
: Colors.grey.withAlpha(20),
),
),
child: Row(
children: [
Icon(Icons.link, size: 16, color: primaryColor),
const SizedBox(width: 8),
Expanded(
child: Text(
'https://poe.vogov.cn/app.html',
style: TextStyle(fontSize: 14, color: primaryColor),
),
),
],
),
_buildWebsiteItem(
'https://poe.vogov.cn/app.html',
'官方APP页',
isDark,
primaryColor,
),
const SizedBox(height: 12),
_buildWebsiteItem(
'https://poe.vogov.cn/',
'情景诗词在线版',
isDark,
primaryColor,
),
],
),
@@ -245,6 +233,71 @@ class LearnUsPage extends StatelessWidget {
);
}
Widget _buildWebsiteItem(
String url,
String label,
bool isDark,
Color primaryColor,
) {
return Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: isDark ? const Color(0xFF3A3A3A) : Colors.grey[50],
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: isDark
? Colors.grey[700]!.withAlpha(20)
: Colors.grey.withAlpha(20),
),
),
child: Row(
children: [
Icon(Icons.link, size: 16, color: primaryColor),
const SizedBox(width: 8),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: TextStyle(
fontSize: 12,
color: isDark ? Colors.grey[400] : Colors.grey,
),
),
Text(url, style: TextStyle(fontSize: 14, color: primaryColor)),
],
),
),
const SizedBox(width: 8),
GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: url));
Get.snackbar(
'复制成功',
'链接已复制到剪贴板',
duration: const Duration(seconds: 2),
colorText: primaryColor,
snackPosition: SnackPosition.BOTTOM,
borderRadius: 8,
margin: const EdgeInsets.all(16),
);
},
child: Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: primaryColor.withAlpha(10),
borderRadius: BorderRadius.circular(4),
),
child: Icon(Icons.content_copy, size: 16, color: primaryColor),
),
),
],
),
);
}
Widget _buildQQGroupCard(BuildContext context, bool isDark) {
final themeController = Get.find<ThemeController>();
final primaryColor = themeController.currentThemeColor;
@@ -352,20 +405,15 @@ class LearnUsPage extends StatelessWidget {
final primaryColor = themeController.currentThemeColor;
Clipboard.setData(const ClipboardData(text: '271129018'));
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Row(
children: [
Icon(Icons.check_circle, color: Colors.white, size: 20),
SizedBox(width: 8),
Text('QQ群号已复制到剪贴板'),
],
),
backgroundColor: primaryColor,
behavior: SnackBarBehavior.floating,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
duration: const Duration(seconds: 2),
),
Get.snackbar(
'复制成功',
'QQ群号已复制到剪贴板',
duration: const Duration(seconds: 2),
colorText: primaryColor,
snackPosition: SnackPosition.BOTTOM,
borderRadius: 8,
margin: const EdgeInsets.all(16),
icon: Icon(Icons.check_circle, color: primaryColor, size: 20),
);
}
@@ -572,14 +620,21 @@ class LearnUsPage extends StatelessWidget {
const SizedBox(width: 8),
GestureDetector(
onTap: () {
final themeController =
Get.find<ThemeController>();
final primaryColor =
themeController.currentThemeColor;
Clipboard.setData(
const ClipboardData(text: '微风暴'),
);
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('已复制到剪贴板'),
duration: Duration(seconds: 2),
),
Get.snackbar(
'复制成功',
'已复制到剪贴板',
duration: const Duration(seconds: 2),
colorText: primaryColor,
snackPosition: SnackPosition.BOTTOM,
borderRadius: 8,
margin: const EdgeInsets.all(16),
);
},
child: Icon(
@@ -734,6 +789,8 @@ class LearnUsPage extends StatelessWidget {
}
Widget _buildIcpCard(BuildContext context, bool isDark) {
final themeController = Get.find<ThemeController>();
final primaryColor = themeController.currentThemeColor;
return Container(
decoration: BoxDecoration(
color: isDark ? const Color(0xFF2A2A2A) : Colors.white,
@@ -794,6 +851,7 @@ class LearnUsPage extends StatelessWidget {
'复制成功',
'备案号已复制到剪贴板',
duration: const Duration(seconds: 1),
colorText: primaryColor,
);
},
child: Row(

View File

@@ -85,14 +85,12 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
) ??
[];
if (existingData.length >= 500) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('缓存已达上限500条请先清空缓存'),
backgroundColor: Colors.red,
),
);
}
final themeController = Get.find<ThemeController>();
Get.snackbar(
'提示',
'缓存已达上限500条请先清空缓存',
colorText: themeController.currentThemeColor,
);
return;
}
@@ -100,23 +98,24 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
if (_selectedCount == 100) {
final isUserPlanJoined = await _checkUserPlanStatus();
if (!isUserPlanJoined) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('100条下载需要加入用户体验计划'),
backgroundColor: Colors.orange,
action: SnackBarAction(
label: '去加入',
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => const UserPlanPage()),
);
},
),
final themeController = Get.find<ThemeController>();
Get.snackbar(
'提示',
'100条下载需要加入用户体验计划',
colorText: themeController.currentThemeColor,
mainButton: TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (_) => const UserPlanPage()),
);
},
child: Text(
'去加入',
style: TextStyle(color: themeController.currentThemeColor),
),
);
}
),
);
return;
}
}
@@ -149,14 +148,12 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
// 取消时保存已下载的数据
if (_downloadedCount > 0) {
await prefs.setStringList(dataKey, currentData);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('已保存 $_downloadedCount 条数据'),
backgroundColor: _themeController.currentThemeColor,
),
);
}
final themeController = Get.find<ThemeController>();
Get.snackbar(
'提示',
'已保存 $_downloadedCount 条数据',
colorText: themeController.currentThemeColor,
);
}
return;
}
@@ -240,17 +237,15 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
// 检查总缓存数量
if (currentData.length > 500) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('缓存将超过500条上限请先清空缓存'),
backgroundColor: Colors.red,
),
);
setState(() {
_isLoading = false;
});
}
final themeController = Get.find<ThemeController>();
Get.snackbar(
'提示',
'缓存将超过500条上限请先清空缓存',
colorText: themeController.currentThemeColor,
);
setState(() {
_isLoading = false;
});
return;
}
@@ -260,13 +255,12 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
_cachedCount = currentData.length;
});
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
'成功缓存 ${_selectedType == DownloadType.poetry ? '诗词' : '答题'} $_cachedCount 条数据',
),
backgroundColor: _themeController.currentThemeColor,
),
final themeController = Get.find<ThemeController>();
final themeController2 = Get.find<ThemeController>();
Get.snackbar(
'成功',
'成功缓存 ${_selectedType == DownloadType.poetry ? '诗词' : '答题'} $_cachedCount 条数据',
colorText: themeController2.currentThemeColor,
);
}
} catch (e) {
@@ -275,8 +269,11 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
_status = '下载失败: $e';
});
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text('下载失败: $e'), backgroundColor: Colors.red),
final themeController = Get.find<ThemeController>();
Get.snackbar(
'错误',
'下载失败: $e',
colorText: themeController.currentThemeColor,
);
}
} finally {
@@ -297,14 +294,12 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
final quizCount = (prefs.getStringList('offline_quiz_data') ?? []).length;
if (poetryCount == 0 && quizCount == 0) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('暂无缓存数据'),
backgroundColor: Colors.orange,
),
);
}
final themeController = Get.find<ThemeController>();
Get.snackbar(
'提示',
'暂无缓存数据',
colorText: themeController.currentThemeColor,
);
return;
}
@@ -367,14 +362,12 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
final prefs = await SharedPreferences.getInstance();
await prefs.remove(key);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('已清空$typeName离线数据'),
backgroundColor: _themeController.currentThemeColor,
),
);
}
final themeController = Get.find<ThemeController>();
Get.snackbar(
'成功',
'已清空$typeName离线数据',
colorText: themeController.currentThemeColor,
);
// 更新对应的计数
if (key == 'offline_poetry_data') {
@@ -399,14 +392,12 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
await prefs.remove('offline_poetry_data');
await prefs.remove('offline_quiz_data');
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: const Text('已清空所有离线数据'),
backgroundColor: _themeController.currentThemeColor,
),
);
}
final themeController = Get.find<ThemeController>();
Get.snackbar(
'成功',
'已清空所有离线数据',
colorText: themeController.currentThemeColor,
);
setState(() {
_poetryCount = 0;
@@ -455,55 +446,47 @@ class _OfflineDataPageState extends State<OfflineDataPage> {
if (data['status'] == 'success') {
_displayServerInfoDialog(data);
} else {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('服务器返回错误状态: ${data['status']}'),
backgroundColor: Colors.red,
duration: const Duration(seconds: 3),
),
);
}
}
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('解析服务器数据失败: $e'),
backgroundColor: Colors.red,
duration: const Duration(seconds: 3),
),
final themeController = Get.find<ThemeController>();
Get.snackbar(
'错误',
'服务器返回错误状态: ${data['status']}',
colorText: themeController.currentThemeColor,
duration: const Duration(seconds: 3),
);
}
}
} else {
if (mounted) {
final errorMsg =
'获取服务器信息失败\n'
'状态码: ${response.statusCode}\n'
'消息: ${response.message}';
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(errorMsg),
backgroundColor: Colors.red,
duration: const Duration(seconds: 5),
),
} catch (e) {
final themeController = Get.find<ThemeController>();
Get.snackbar(
'错误',
'解析服务器数据失败: $e',
colorText: themeController.currentThemeColor,
duration: const Duration(seconds: 3),
);
}
} else {
final errorMsg =
'获取服务器信息失败\n'
'状态码: ${response.statusCode}\n'
'消息: ${response.message}';
final themeController = Get.find<ThemeController>();
Get.snackbar(
'错误',
errorMsg,
colorText: themeController.currentThemeColor,
duration: const Duration(seconds: 5),
);
}
} catch (e) {
if (!mounted) return;
Navigator.of(context).pop();
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('获取服务器信息异常: $e'),
backgroundColor: Colors.red,
duration: const Duration(seconds: 5),
),
);
}
final themeController = Get.find<ThemeController>();
Get.snackbar(
'错误',
'获取服务器信息异常: $e',
colorText: themeController.currentThemeColor,
duration: const Duration(seconds: 5),
);
}
}

View File

@@ -23,6 +23,7 @@ class _AppDiyPageState extends State<AppDiyPage> {
bool _showGuideOnStartup = true;
int _cardSizeIndex = 1; // 0: 小, 1: 中, 2: 大
bool _enableSystemNavigation = false;
bool _showDevNotice = true; // 是否显示开发中提示对话框
// 滚动控制
final ScrollController _scrollController = ScrollController();
@@ -50,12 +51,16 @@ class _AppDiyPageState extends State<AppDiyPage> {
_startScrolling();
// 延迟显示开发中提示对话框
WidgetsBinding.instance.addPostFrameCallback((_) {
_showDevNoticeDialog();
if (_showDevNotice) {
_showDevNoticeDialog();
}
});
}
// 显示开发中提示对话框
void _showDevNoticeDialog() {
bool doNotShowAgain = false;
showDialog(
context: context,
barrierDismissible: false,
@@ -63,81 +68,119 @@ class _AppDiyPageState extends State<AppDiyPage> {
final primaryColor = _themeController.currentThemeColor;
final isDark = _themeController.isDarkMode;
return AlertDialog(
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
title: Row(
children: [
Icon(Icons.construction, color: primaryColor),
const SizedBox(width: 8),
Text(
'开发中',
style: TextStyle(color: isDark ? Colors.white : Colors.black),
return StatefulBuilder(
builder: (context, setState) {
return AlertDialog(
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
],
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'个性化设置开发中',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: isDark ? Colors.white : Colors.black,
title: Row(
children: [
Icon(Icons.construction, color: primaryColor),
const SizedBox(width: 8),
Text(
'开发中',
style: TextStyle(
color: isDark ? Colors.white : Colors.black,
),
),
],
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'个性化设置开发中',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: isDark ? Colors.white : Colors.black,
),
),
const SizedBox(height: 12),
Text(
'• ✅ 深色模式(已支持)',
style: TextStyle(
color: isDark ? Colors.grey[300] : Colors.black87,
),
),
Text(
'• ✅ 主题色彩(已支持)',
style: TextStyle(
color: isDark ? Colors.grey[300] : Colors.black87,
),
),
Text(
'• ⏳ 其他设置仅当前页面生效',
style: TextStyle(
color: isDark ? Colors.grey[300] : Colors.black87,
),
),
Text(
'• ⏳ 后续版本将陆续支持',
style: TextStyle(
color: isDark ? Colors.grey[300] : Colors.black87,
),
),
const SizedBox(height: 12),
Text(
'感谢您的耐心等待!',
style: TextStyle(
color: isDark ? Colors.grey[400] : Colors.grey[600],
fontSize: 12,
),
),
],
),
actions: [
Row(
children: [
Checkbox(
value: doNotShowAgain,
onChanged: (value) {
setState(() {
doNotShowAgain = value ?? false;
});
},
activeColor: primaryColor,
),
Text(
'不再提醒',
style: TextStyle(
color: isDark ? Colors.grey[300] : Colors.black87,
fontSize: 14,
),
),
const Spacer(),
ElevatedButton(
onPressed: () async {
if (doNotShowAgain) {
await _themeController.prefs?.setBool(
'showDevNotice',
false,
);
setState(() {
_showDevNotice = false;
});
}
Navigator.of(context).pop();
},
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: const Text('我知道了'),
),
],
),
),
const SizedBox(height: 12),
Text(
'• ✅ 深色模式(已支持)',
style: TextStyle(
color: isDark ? Colors.grey[300] : Colors.black87,
),
),
Text(
'• ✅ 主题色彩(已支持)',
style: TextStyle(
color: isDark ? Colors.grey[300] : Colors.black87,
),
),
Text(
'• ⏳ 其他设置仅当前页面生效',
style: TextStyle(
color: isDark ? Colors.grey[300] : Colors.black87,
),
),
Text(
'• ⏳ 后续版本将陆续支持',
style: TextStyle(
color: isDark ? Colors.grey[300] : Colors.black87,
),
),
const SizedBox(height: 12),
Text(
'感谢您的耐心等待!',
style: TextStyle(
color: isDark ? Colors.grey[400] : Colors.grey[600],
fontSize: 12,
),
),
],
),
actions: [
ElevatedButton(
onPressed: () => Navigator.of(context).pop(),
style: ElevatedButton.styleFrom(
backgroundColor: primaryColor,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: const Text('我知道了'),
),
],
],
);
},
);
},
);
@@ -187,6 +230,7 @@ class _AppDiyPageState extends State<AppDiyPage> {
_cardSizeIndex = _themeController.prefs?.getInt('cardSizeIndex') ?? 1;
_enableSystemNavigation =
_themeController.prefs?.getBool('enableSystemNavigation') ?? false;
_showDevNotice = _themeController.prefs?.getBool('showDevNotice') ?? true;
});
}
@@ -218,6 +262,16 @@ class _AppDiyPageState extends State<AppDiyPage> {
),
backgroundColor: isDark ? Colors.grey[900] : Colors.white,
elevation: 0,
actions: [
IconButton(
icon: Icon(
Icons.info_outline,
color: _themeController.currentThemeColor,
),
onPressed: () => _showDevNoticeDialog(),
tooltip: '显示开发中提示',
),
],
),
backgroundColor: isDark ? Colors.grey[900] : Colors.grey[50],
body: ListView(