feat: l10n about page

This commit is contained in:
cialloo
2024-07-21 17:40:57 +08:00
committed by Cialloo
parent cf3426424d
commit df5d8c187a

View File

@@ -1,64 +1,42 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:url_launcher/url_launcher.dart';
const _enContent = '''
'''; // TODO
const _zhContent = '''
项目基于 n2n , 一款优秀的跨平台开源p2p VPN软件
winui_n2n软件开源地址 https://github.com/moemoequte/winui_n2n
分发和使用请遵循 GPL-3.0 license 开源协议
作者信息
网站 https://www.cialloo.com
邮箱 admin@cialloo.com
''';
class AboutPage extends StatelessWidget {
const AboutPage({super.key});
@override
Widget build(BuildContext context) {
TextStyle defaultStyle = const TextStyle(fontSize: 16.0);
TextStyle linkStyle = const TextStyle(color: Colors.blue);
return Center(
child: SelectableText.rich(
TextSpan(
style: defaultStyle,
children: <TextSpan>[
const TextSpan(
text: '项目基于 n2n , 一款优秀的跨平台开源p2p VPN软件\n',
),
const TextSpan(
text: 'winui_n2n软件开源地址 ',
),
TextSpan(
text: 'https://github.com/moemoequte/winui_n2n\n',
style: linkStyle,
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrl(
Uri.parse('https://github.com/moemoequte/winui_n2n'));
switch (Localizations.localeOf(context).toString()) {
case 'en':
return Markdown(
data: _enContent,
onTapLink: (text, href, title) {
launchUrl(Uri.parse(href!));
},
),
const TextSpan(
text: '分发和使用请遵循 GPL-3.0 license 开源协议\n\n',
),
const TextSpan(
text: '作者信息\n',
),
const TextSpan(text: '网站 '),
TextSpan(
text: 'https://www.cialloo.com\n',
style: linkStyle,
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrl(Uri.parse('https://www.cialloo.com'));
);
case 'zh':
return Markdown(
data: _zhContent,
onTapLink: (text, href, title) {
launchUrl(Uri.parse(href!));
},
),
const TextSpan(text: '邮箱 '),
TextSpan(
text: 'admin@cialloo.com',
style: linkStyle,
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrl(Uri(
scheme: 'mailto',
path: 'admin@cialloo.com',
));
},
),
],
),
),
);
}
return const SizedBox();
}
}