flutter: 关于 增加致谢等信息

This commit is contained in:
Calcitem 2020-11-22 23:36:17 +08:00
parent fe1f1d1816
commit 9d50ea2204
2 changed files with 83 additions and 18 deletions

View File

@ -18,13 +18,12 @@
*/ */
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:package_info/package_info.dart'; import 'package:package_info/package_info.dart';
import 'package:sanmill/common/config.dart'; import 'package:sanmill/common/config.dart';
import 'package:sanmill/services/audios.dart'; import 'package:sanmill/services/audios.dart';
import 'package:sanmill/services/player.dart'; import 'package:sanmill/services/player.dart';
import 'package:sanmill/style/colors.dart'; import 'package:sanmill/style/colors.dart';
import 'package:sanmill/style/toast.dart'; import 'package:url_launcher/url_launcher.dart';
import 'edit_page.dart'; import 'edit_page.dart';
@ -46,7 +45,7 @@ class _SettingsPageState extends State<SettingsPage> {
// //
final packageInfo = await PackageInfo.fromPlatform(); final packageInfo = await PackageInfo.fromPlatform();
setState(() { setState(() {
_version = 'Version ${packageInfo.version} (${packageInfo.buildNumber})'; _version = '${packageInfo.version} (${packageInfo.buildNumber})';
}); });
} }
@ -143,6 +142,14 @@ class _SettingsPageState extends State<SettingsPage> {
Player.shared.saveAndUpload(); Player.shared.saveAndUpload();
} }
_launchURL(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
showAbout() { showAbout() {
// //
showDialog( showDialog(
@ -155,21 +162,78 @@ class _SettingsPageState extends State<SettingsPage> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
SizedBox(height: 5), SizedBox(height: 5),
Text('版本', style: TextStyle(fontFamily: '')), Text('版本: $_version', style: TextStyle(fontFamily: '')),
Text('$_version', style: TextStyle(fontFamily: '')),
SizedBox(height: 15), SizedBox(height: 15),
Text('官网', style: TextStyle(fontFamily: '')), InkWell(
GestureDetector( child: Text('依照 GPLv3 协议发布',
onTap: () { style: TextStyle(
Clipboard.setData( fontFamily: '',
ClipboardData(text: 'http://www.calcitem.com'), color: Colors.blue,
); decoration: TextDecoration.underline)),
Toast.toast(context, msg: '网址已复制!'); onTap: () =>
}, _launchURL('https://www.gnu.org/licenses/gpl-3.0.html'),
child: Text(
"http://www.calcitem.com",
style: TextStyle(fontFamily: '', color: Colors.blue),
), ),
SizedBox(height: 15),
InkWell(
child: Text('官方网站',
style: TextStyle(
fontFamily: '',
color: Colors.blue,
decoration: TextDecoration.underline)),
onTap: () => _launchURL('https://github.com/calcitem/Sanmill'),
),
InkWell(
child: Text('新版变化',
style: TextStyle(
fontFamily: '',
color: Colors.blue,
decoration: TextDecoration.underline)),
onTap: () => _launchURL(
'https://github.com/calcitem/Sanmill/commits/master'),
),
InkWell(
child: Text('快速更新通道',
style: TextStyle(
fontFamily: '',
color: Colors.blue,
decoration: TextDecoration.underline)),
onTap: () => _launchURL(
'https://github.com/calcitem/Sanmill/actions?query=workflow%3AFlutter+is%3Asuccess'),
),
SizedBox(height: 15),
InkWell(
child: Text('致谢'),
),
InkWell(
child: Text('直棋 离不开以下人员的无私贡献,感激不尽!\n'
'代码贡献者: Calcitem\n'
'开源库: '
'所基于的开源库太多,难以罗列,在这里仅列出主要的几项,同时也感谢其他默默无闻为开源事业做出贡献的人们:'),
),
InkWell(
child: Text('Stockfish - UCI chess engine',
style: TextStyle(
fontFamily: '',
color: Colors.blue,
decoration: TextDecoration.underline)),
onTap: () =>
_launchURL('https://github.com/official-stockfish/Stockfish'),
),
InkWell(
child: Text('ChessRoad (棋路) by He Zhaoyun',
style: TextStyle(
fontFamily: '',
color: Colors.blue,
decoration: TextDecoration.underline)),
onTap: () => _launchURL('https://github.com/hezhaoyun/chessroad'),
),
InkWell(
child: Text('NineChess (九联棋) by liuweilhy',
style: TextStyle(
fontFamily: '',
color: Colors.blue,
decoration: TextDecoration.underline)),
onTap: () => _launchURL('https://github.com/liuweilhy/NineChess'),
), ),
], ],
), ),

View File

@ -1,7 +1,7 @@
name: sanmill name: sanmill
description: A new Flutter project. description: A new Flutter project.
version: 1.0.0+1 version: 0.10.2+1
environment: environment:
sdk: ">=2.1.0 <3.0.0" sdk: ">=2.1.0 <3.0.0"
@ -14,6 +14,7 @@ dependencies:
path_provider: ^1.6.1 path_provider: ^1.6.1
package_info: ^0.4.0+16 package_info: ^0.4.0+16
uuid: ^2.0.4 uuid: ^2.0.4
url_launcher: ^5.7.10
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: