屏幕常亮

This commit is contained in:
Developer
2026-03-31 21:59:07 +08:00
parent c897f50817
commit b081f09895
11 changed files with 353 additions and 170 deletions

View File

@@ -140,7 +140,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Poes',
'情景诗词',
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
@@ -149,7 +149,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
),
const SizedBox(height: 6),
Text(
'情景诗词 · 应用信息',
'Poes · 应用信息',
style: TextStyle(
fontSize: 13,
color: Colors.white.withValues(alpha: 0.85),
@@ -178,9 +178,27 @@ class _AppInfoPageState extends State<AppInfoPage> {
),
const SizedBox(width: 6),
const Text(
'版本 1.2',
'框架 1.3',
style: TextStyle(fontSize: 12, color: Colors.white),
),
const SizedBox(width: 8),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 2,
),
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(4),
),
child: const Text(
'软件版本 1.5',
style: TextStyle(
fontSize: 10,
color: Colors.white,
),
),
),
],
),
),
@@ -231,10 +249,34 @@ class _AppInfoPageState extends State<AppInfoPage> {
),
),
const Divider(height: 1),
_buildInfoItem('Flutter', '跨平台UI框架', Icons.flutter_dash),
_buildInfoItem('Dart', '编程语言', Icons.code),
_buildInfoItem('shared_preferences', '本地存储', Icons.storage),
_buildInfoItem('flutter_udid', '设备唯一标识', Icons.perm_identity),
// 2x2 网格布局展示技术栈
Padding(
padding: const EdgeInsets.all(16),
child: GridView.count(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
crossAxisCount: 2,
mainAxisSpacing: 12,
crossAxisSpacing: 12,
childAspectRatio: 2.2,
children: [
_buildTechStackItem(
'Flutter',
'跨平台UI框架',
Icons.flutter_dash,
Colors.blue,
),
_buildTechStackItem('Dart', '编程语言', Icons.code, Colors.teal),
_buildTechStackItem('SP', '本地存储', Icons.storage, Colors.orange),
_buildTechStackItem(
'dio',
'网络处理',
Icons.network_check,
Colors.purple,
),
],
),
),
],
),
);
@@ -335,12 +377,12 @@ class _AppInfoPageState extends State<AppInfoPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'开源协议',
'开源框架',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
),
const SizedBox(height: 2),
Text(
'BSD 3-Clause License',
'Flutter SDK',
style: TextStyle(fontSize: 12, color: Colors.grey[500]),
),
],
@@ -823,6 +865,59 @@ class _AppInfoPageState extends State<AppInfoPage> {
);
}
// 2x2 网格技术栈项
Widget _buildTechStackItem(
String title,
String value,
IconData icon,
Color color,
) {
return Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: color.withAlpha(20),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: color.withAlpha(50), width: 1),
),
child: Row(
children: [
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: color.withAlpha(30),
borderRadius: BorderRadius.circular(8),
),
child: Icon(icon, size: 20, color: color),
),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
title,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: color,
),
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 2),
Text(
value,
style: TextStyle(fontSize: 11, color: Colors.grey[600]),
overflow: TextOverflow.ellipsis,
),
],
),
),
],
),
);
}
Widget _buildInfoItem(String title, String value, IconData icon) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:share_plus/share_plus.dart';
import '../../../constants/app_constants.dart';
import 'package:wakelock_plus/wakelock_plus.dart';
class PopMenu extends StatelessWidget {
final VoidCallback? onRefresh;
@@ -41,6 +42,46 @@ class PopMenu extends StatelessWidget {
}
}
static Future<void> toggleScreenWake(BuildContext context) async {
try {
// 检查当前状态
final bool isEnabled = await WakelockPlus.enabled;
// 切换状态
if (isEnabled) {
await WakelockPlus.disable();
if (context.mounted) {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('屏幕常亮已关闭')));
}
} else {
await WakelockPlus.enable();
if (context.mounted) {
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('屏幕常亮已开启')));
}
}
} catch (e) {
if (context.mounted) {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('提示'),
content: const Text('该设备不支持屏幕常亮功能'),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('确定'),
),
],
),
);
}
}
}
static void show(
BuildContext context, {
VoidCallback? onRefresh,
@@ -89,9 +130,9 @@ class PopMenu extends StatelessWidget {
}),
_buildBottomSheetItem(
context,
'扫描二维码',
Icons.qr_code_scanner,
onScanQr,
'屏幕常亮',
Icons.screen_lock_rotation,
() => toggleScreenWake(context),
),
_buildBottomSheetItem(context, '夜间模式', Icons.dark_mode, onDarkMode),
const SizedBox(height: 20),

View File

@@ -913,7 +913,7 @@ class _ProfilePageState extends State<ProfilePage>
context,
onRefresh: () => refreshData(),
onEdit: () => _showSnackBar('编辑资料'),
onScanQr: () => _showSnackBar('扫描二维码'),
onScanQr: () => _showSnackBar('了解软件功能'),
onDarkMode: () => _showSnackBar('夜间模式'),
onSettings: () {
Future.delayed(const Duration(milliseconds: 100), () {

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../constants/app_constants.dart';
import '../../../utils/audio_manager.dart';
@@ -395,6 +396,7 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
Text('1. 长按桌面空白处'),
Text('2. 选择「情景诗词」卡片'),
Text('3. 添加后点击桌面卡片即可设置'),
Text('4. 后续版本支持在应用内设置卡片'),
SizedBox(height: 12),
Text(
'注意:该页面设置对鸿蒙设备不生效',
@@ -404,8 +406,12 @@ class _AppFunSettingsPageState extends State<AppFunSettingsPage> {
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('取消'),
onPressed: () {
Navigator.of(context).pop();
// 返回桌面
SystemNavigator.pop();
},
child: const Text('前往桌面'),
),
ElevatedButton(
onPressed: () {

View File

@@ -422,7 +422,7 @@ class LearnUsPage extends StatelessWidget {
),
const SizedBox(height: 4),
Text(
'专注诗词文化传播',
'专注文字文化领域',
style: TextStyle(fontSize: 13, color: Colors.grey[600]),
),
],
@@ -431,6 +431,53 @@ class LearnUsPage extends StatelessWidget {
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
children: [
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Colors.blue.withValues(alpha: 0.1),
Colors.blue.withValues(alpha: 0.05),
],
),
borderRadius: BorderRadius.circular(8),
),
child: const Center(
child: Icon(Icons.email, color: Colors.blue, size: 20),
),
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'商务合作&侵权申诉&联系我们',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
const SizedBox(height: 2),
const Text(
'2821981550@qq.com',
style: TextStyle(
fontSize: 13,
color: Colors.blue,
decoration: TextDecoration.underline,
),
),
],
),
),
],
),
),
],
),
);

View File

@@ -60,6 +60,58 @@ class _AppDiyPageState extends State<AppDiyPage> {
super.initState();
_loadSettings();
_startScrolling();
// 延迟显示开发中提示对话框
WidgetsBinding.instance.addPostFrameCallback((_) {
_showDevNoticeDialog();
});
}
// 显示开发中提示对话框
void _showDevNoticeDialog() {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return AlertDialog(
title: Row(
children: [
Icon(Icons.construction, color: AppConstants.primaryColor),
const SizedBox(width: 8),
const Text('开发中'),
],
),
content: const Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'个性化设置开发中',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
SizedBox(height: 12),
Text('• 当前设置仅当前页面生效'),
Text('• 后续版本将陆续支持'),
Text('• 可提前预览主题风格设置'),
SizedBox(height: 12),
Text(
'感谢您的耐心等待!',
style: TextStyle(color: Colors.grey, fontSize: 12),
),
],
),
actions: [
ElevatedButton(
onPressed: () => Navigator.of(context).pop(),
style: ElevatedButton.styleFrom(
backgroundColor: AppConstants.primaryColor,
foregroundColor: Colors.white,
),
child: const Text('我知道了'),
),
],
);
},
);
}
@override
@@ -217,6 +269,13 @@ class _AppDiyPageState extends State<AppDiyPage> {
});
}, icon: Icons.navigation),
_buildSwitchItem('转场动画', _enableAnimation, (value) {
setState(() {
// _enableAnimation = value;
_saveSettings();
});
}, icon: Icons.track_changes),
// 设计风格
_buildSection('设计风格'),
_buildDesignStyleCard(),