关于页确定完成设置
This commit is contained in:
+17
-14
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class AboutPage extends StatelessWidget {
|
||||
@@ -29,7 +30,7 @@ class AboutPage extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// 🟢 Logo 图片(替换之前的 Icon)
|
||||
// Logo
|
||||
Container(
|
||||
width: 120,
|
||||
height: 120,
|
||||
@@ -49,7 +50,6 @@ class AboutPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// APP 名称
|
||||
const Text(
|
||||
'MEIZU Battery Healthy',
|
||||
style: TextStyle(
|
||||
@@ -59,7 +59,6 @@ class AboutPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// 版本号
|
||||
Text(
|
||||
'版本 1.7.0',
|
||||
style: TextStyle(
|
||||
@@ -70,7 +69,6 @@ class AboutPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// 分隔线
|
||||
Divider(
|
||||
color: Colors.grey.shade300,
|
||||
thickness: 0.5,
|
||||
@@ -78,7 +76,6 @@ class AboutPage extends StatelessWidget {
|
||||
endIndent: 40,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// 作者信息
|
||||
const Text(
|
||||
'专机专配 · 仅针对魅族独家开发',
|
||||
style: TextStyle(
|
||||
@@ -97,9 +94,9 @@ class AboutPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// Gitea 链接
|
||||
// 源码链接按钮
|
||||
InkWell(
|
||||
onTap: _launchUrl,
|
||||
onTap: () => _launchUrl(context), // 注意这里传入了 context
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -140,7 +137,6 @@ class AboutPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
// 底部版本信息
|
||||
Text(
|
||||
'Made with ❤️ in Flyme · 2026',
|
||||
style: TextStyle(
|
||||
@@ -156,18 +152,25 @@ class AboutPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _launchUrl() async {
|
||||
Future<void> _launchUrl(BuildContext context) 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');
|
||||
}
|
||||
// ✅ 直接尝试打开,不再检查 canLaunchUrl
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
} catch (e) {
|
||||
// 如果打开失败,复制链接并提示
|
||||
debugPrint('打开链接失败: $e');
|
||||
await Clipboard.setData(ClipboardData(text: url));
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('无法自动打开浏览器,链接已复制到剪贴板。'),
|
||||
duration: Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user