准备测试关于页
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class AboutPage extends StatelessWidget {
|
||||
const AboutPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
appBar: AppBar(
|
||||
title: const Text(
|
||||
'关于',
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
foregroundColor: Theme.of(context).iconTheme.color,
|
||||
iconTheme: IconThemeData(color: Theme.of(context).iconTheme.color),
|
||||
),
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// 🟢 Logo 图片(替换之前的 Icon)
|
||||
Container(
|
||||
width: 120,
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: isDark
|
||||
? Colors.grey.shade800
|
||||
: const Color(0xFFF0F4F8),
|
||||
),
|
||||
child: ClipOval(
|
||||
child: Image.asset(
|
||||
'assets/logo.png',
|
||||
width: 120,
|
||||
height: 120,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// APP 名称
|
||||
const Text(
|
||||
'MEIZU Battery Healthy',
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// 版本号
|
||||
Text(
|
||||
'版本 1.7.0',
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontSize: 14,
|
||||
color: Colors.grey.shade500,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// 分隔线
|
||||
Divider(
|
||||
color: Colors.grey.shade300,
|
||||
thickness: 0.5,
|
||||
indent: 40,
|
||||
endIndent: 40,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// 作者信息
|
||||
const Text(
|
||||
'专机专配 · 仅针对魅族独家开发',
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontSize: 14,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'通过读取 BMS 日志直接获取电池真实数据',
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontSize: 13,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// Gitea 链接
|
||||
InkWell(
|
||||
onTap: _launchUrl,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 12,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark
|
||||
? Colors.grey.shade800
|
||||
: const Color(0xFFF0F4F8),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.code,
|
||||
size: 18,
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'查看源码 / 反馈',
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).iconTheme.color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Icon(
|
||||
Icons.open_in_new,
|
||||
size: 14,
|
||||
color: Colors.grey.shade500,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
// 底部版本信息
|
||||
Text(
|
||||
'Made with ❤️ in Flyme · 2026',
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontSize: 12,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _launchUrl() async {
|
||||
const url = 'https://git.whitetop.xyz/lxh2875931338/MEIZU-Battery-Healthy';
|
||||
final uri = Uri.parse(url);
|
||||
|
||||
try {
|
||||
if (await canLaunchUrl(uri)) {
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
} else {
|
||||
debugPrint('无法打开链接: $url');
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('打开链接失败: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import '../widgets/charge_entry.dart';
|
||||
import '../widgets/charge_detail_page.dart';
|
||||
import '../widgets/trend_chart.dart';
|
||||
import '../pages/changelog_page.dart';
|
||||
import '../pages/about_page.dart';
|
||||
|
||||
// --- 潘通色定义 ---
|
||||
const Color kHealthGreen = Color(0xFF00B140);
|
||||
@@ -668,23 +669,29 @@ class _BatteryHealthPageState extends State<BatteryHealthPage> {
|
||||
),
|
||||
);
|
||||
break;
|
||||
case 'dark_mode':
|
||||
case 'about': // 🟢 新增
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const AboutPage(),
|
||||
),
|
||||
);
|
||||
break;
|
||||
case 'about':
|
||||
case 'dark_mode':
|
||||
// 夜间模式切换逻辑(1.7.0 再实现)
|
||||
break;
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
const PopupMenuItem(value: 'changelog', child: Text('更新日志')),
|
||||
const PopupMenuItem(
|
||||
value: 'dark_mode',
|
||||
enabled: false,
|
||||
child: Text('深色模式(开发中)'),
|
||||
value: 'about', // 🟢 新增
|
||||
child: Text('关于'),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'about',
|
||||
enabled: false,
|
||||
child: Text('关于(开发中)'),
|
||||
value: 'dark_mode',
|
||||
enabled: false, // 暂时灰显
|
||||
child: Text('夜间模式(开发中)'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user