161 lines
5.1 KiB
Dart
161 lines
5.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
import '../theme/app_colors.dart';
|
|
|
|
class AboutPage extends StatelessWidget {
|
|
const AboutPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final c = context.colors;
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text(
|
|
'关于',
|
|
style: TextStyle(
|
|
fontFamily: 'HarmonyOS_Sans_SC',
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
backgroundColor: c.background,
|
|
elevation: 0,
|
|
foregroundColor: c.textPrimary,
|
|
iconTheme: IconThemeData(color: c.textPrimary),
|
|
),
|
|
body: Center(
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 40.0),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Container(
|
|
width: 120,
|
|
height: 120,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: c.surface,
|
|
),
|
|
child: ClipOval(
|
|
child: Image.asset(
|
|
'assets/logo.png',
|
|
width: 120,
|
|
height: 120,
|
|
fit: BoxFit.contain,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 24),
|
|
Text(
|
|
'MEIZU Battery Healthy',
|
|
style: TextStyle(
|
|
fontFamily: 'HarmonyOS_Sans_SC',
|
|
fontSize: 24,
|
|
fontWeight: FontWeight.w600,
|
|
color: c.textPrimary,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'版本 1.8.0',
|
|
style: TextStyle(
|
|
fontFamily: 'HarmonyOS_Sans_SC',
|
|
fontSize: 14,
|
|
color: c.textTertiary,
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Divider(
|
|
color: c.divider,
|
|
thickness: 0.5,
|
|
indent: 40,
|
|
endIndent: 40,
|
|
),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'专机专配 · 仅针对魅族独家开发',
|
|
style: TextStyle(
|
|
fontFamily: 'HarmonyOS_Sans_SC',
|
|
fontSize: 14,
|
|
color: c.textSecondary,
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
Text(
|
|
'通过读取 BMS 日志直接获取电池真实数据',
|
|
style: TextStyle(
|
|
fontFamily: 'HarmonyOS_Sans_SC',
|
|
fontSize: 13,
|
|
color: c.textTertiary,
|
|
),
|
|
),
|
|
const SizedBox(height: 24),
|
|
InkWell(
|
|
onTap: () => _launchUrl(context),
|
|
borderRadius: BorderRadius.circular(12),
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 20,
|
|
vertical: 12,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: c.surface,
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(Icons.code, size: 18, color: c.textPrimary),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
'查看源码 / 反馈',
|
|
style: TextStyle(
|
|
fontFamily: 'HarmonyOS_Sans_SC',
|
|
fontSize: 14,
|
|
color: c.textPrimary,
|
|
),
|
|
),
|
|
const SizedBox(width: 4),
|
|
Icon(Icons.open_in_new, size: 14, color: c.textTertiary),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 40),
|
|
Text(
|
|
'Made with ❤️ in Flyme · 2026',
|
|
style: TextStyle(
|
|
fontFamily: 'HarmonyOS_Sans_SC',
|
|
fontSize: 12,
|
|
color: c.textTertiary,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Future<void> _launchUrl(BuildContext context) async {
|
|
const url = 'https://git.whitetop.xyz/lxh2875931338/MEIZU-Battery-Healthy';
|
|
final uri = Uri.parse(url);
|
|
try {
|
|
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
|
} catch (e) {
|
|
debugPrint('打开链接失败: $e');
|
|
await Clipboard.setData(const ClipboardData(text: url));
|
|
if (context.mounted) {
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
const SnackBar(
|
|
content: Text('无法自动打开浏览器,链接已复制到剪贴板。'),
|
|
duration: Duration(seconds: 3),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|