174 lines
5.6 KiB
Dart
174 lines
5.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.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
|
|
Container(
|
|
width: 120,
|
|
height: 120,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: isDark
|
|
? Colors.grey.shade800
|
|
: const Color(0xFFF0F4F8),
|
|
),
|
|
child: const Icon(
|
|
Icons.battery_charging_full,
|
|
size: 64,
|
|
color: Color(0xFF00B140),
|
|
),
|
|
),
|
|
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,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
/// 🟢 修复:url_launcher 的正确调用方式
|
|
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');
|
|
}
|
|
}
|
|
}
|