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/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:url_launcher/url_launcher.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 { class AboutPage extends StatelessWidget {
const AboutPage({super.key}); const AboutPage({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
TextStyle defaultStyle = const TextStyle(fontSize: 16.0); switch (Localizations.localeOf(context).toString()) {
TextStyle linkStyle = const TextStyle(color: Colors.blue); case 'en':
return Center( return Markdown(
child: SelectableText.rich( data: _enContent,
TextSpan( onTapLink: (text, href, title) {
style: defaultStyle, launchUrl(Uri.parse(href!));
children: <TextSpan>[ },
const TextSpan( );
text: '项目基于 n2n , 一款优秀的跨平台开源p2p VPN软件\n', case 'zh':
), return Markdown(
const TextSpan( data: _zhContent,
text: 'winui_n2n软件开源地址 ', onTapLink: (text, href, title) {
), launchUrl(Uri.parse(href!));
TextSpan( },
text: 'https://github.com/moemoequte/winui_n2n\n', );
style: linkStyle, }
recognizer: TapGestureRecognizer()
..onTap = () { return const SizedBox();
launchUrl(
Uri.parse('https://github.com/moemoequte/winui_n2n'));
},
),
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'));
},
),
const TextSpan(text: '邮箱 '),
TextSpan(
text: 'admin@cialloo.com',
style: linkStyle,
recognizer: TapGestureRecognizer()
..onTap = () {
launchUrl(Uri(
scheme: 'mailto',
path: 'admin@cialloo.com',
));
},
),
],
),
),
);
} }
} }