更新编译脚本、优化初始化ServerStatus、更改为英文

This commit is contained in:
LollipopKit
2021-10-24 20:48:54 +08:00
parent 554173bda5
commit 07dbab3e09
7 changed files with 38 additions and 28 deletions

View File

@@ -29,8 +29,6 @@
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UISupportedInterfaceOrientations~ipad</key> <key>UISupportedInterfaceOrientations~ipad</key>
<array> <array>

View File

@@ -28,7 +28,7 @@ class ServerProvider extends BusyProvider {
usedPercent: 0) usedPercent: 0)
], ],
sysVer: '', sysVer: '',
uptime: '', uptime: 'Connecting...',
tcp: TcpStatus(maxConn: 0, active: 0, passive: 0, fail: 0)); tcp: TcpStatus(maxConn: 0, active: 0, passive: 0, fail: 0));
Future<void> loadLocalData() async { Future<void> loadLocalData() async {

View File

@@ -3,7 +3,8 @@
class BuildData { class BuildData {
static const String name = "ToolBox"; static const String name = "ToolBox";
static const int build = 15; static const int build = 15;
static const String engine = "Flutter 2.5.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision ffb2ecea52 (2 weeks ago) • 2021-09-17 15:26:33 -0400\nEngine • revision b3af521a05\nTools • Dart 2.14.2\n"; static const String engine =
"Flutter 2.5.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision ffb2ecea52 (2 weeks ago) • 2021-09-17 15:26:33 -0400\nEngine • revision b3af521a05\nTools • Dart 2.14.2\n";
static const String buildAt = "2021-10-02 19:52:07.676336"; static const String buildAt = "2021-10-02 19:52:07.676336";
static const int modifications = 71; static const int modifications = 71;
} }

View File

@@ -88,7 +88,7 @@ class _ConvertPageState extends State<ConvertPage>
case 3: case 3:
return Uri.decodeFull(text); return Uri.decodeFull(text);
default: default:
return '未知编码'; return 'Unknown';
} }
} }

View File

@@ -24,7 +24,7 @@ class _MyHomePageState extends State<MyHomePage>
AutomaticKeepAliveClientMixin, AutomaticKeepAliveClientMixin,
SingleTickerProviderStateMixin, SingleTickerProviderStateMixin,
AfterLayoutMixin { AfterLayoutMixin {
final List<String> _tabs = ['服务器', '编/解码']; final List<String> _tabs = ['Servers', 'En/Decode'];
late final TabController _tabController; late final TabController _tabController;
@override @override
@@ -65,7 +65,7 @@ class _MyHomePageState extends State<MyHomePage>
UserAccountsDrawerHeader( UserAccountsDrawerHeader(
accountName: const Text('ToolBox'), accountName: const Text('ToolBox'),
accountEmail: Text(_buildVersionStr()), accountEmail: Text(_buildVersionStr()),
currentAccountPicture: _buildIcon(const Color(0x00083963)), currentAccountPicture: _buildIcon(),
), ),
// const ListTile( // const ListTile(
// leading: Icon(Icons.settings), // leading: Icon(Icons.settings),
@@ -73,10 +73,10 @@ class _MyHomePageState extends State<MyHomePage>
// ), // ),
AboutListTile( AboutListTile(
icon: const Icon(Icons.text_snippet), icon: const Icon(Icons.text_snippet),
child: const Text('开源证书'), child: const Text('Open source licenses'),
applicationName: BuildData.name, applicationName: BuildData.name,
applicationVersion: _buildVersionStr(), applicationVersion: _buildVersionStr(),
applicationIcon: _buildIcon(Colors.transparent), applicationIcon: _buildIcon(),
aboutBoxChildren: const [ aboutBoxChildren: const [
Text('''\nMade with Love. Text('''\nMade with Love.
\nAll rights reserved.'''), \nAll rights reserved.'''),
@@ -87,10 +87,21 @@ class _MyHomePageState extends State<MyHomePage>
); );
} }
Widget _buildIcon(Color c) { Widget _buildIcon() {
return CircleAvatar( return ConstrainedBox(
child: Image.asset('assets/app_icon.jpg'), constraints: const BoxConstraints(maxHeight: 60, maxWidth: 60),
backgroundColor: c, child: Stack(
children: [
Center(
child: Container(
color: Colors.white,
height: 37,
width: 37,
),
),
Image.asset('assets/app_icon.jpg'),
],
),
); );
} }

View File

@@ -83,13 +83,13 @@ class _ServerPageState extends State<ServerPage>
} }
void showAddServerDialog() { void showAddServerDialog() {
showRoundDialog(context, '新建服务器连接', _buildTextInputField(context), [ showRoundDialog(context, 'New', _buildTextInputField(context), [
TextButton( TextButton(
onPressed: () { onPressed: () {
clearTextField(); clearTextField();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: const Text('关闭')), child: const Text('Close')),
TextButton( TextButton(
onPressed: () { onPressed: () {
final authorization = keyController.text.isEmpty final authorization = keyController.text.isEmpty
@@ -107,7 +107,7 @@ class _ServerPageState extends State<ServerPage>
clearTextField(); clearTextField();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: const Text('连接')) child: const Text('Connect'))
]); ]);
} }
@@ -124,12 +124,12 @@ class _ServerPageState extends State<ServerPage>
TextField( TextField(
controller: nameController, controller: nameController,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
decoration: _buildDecoration('名称'), decoration: _buildDecoration('Name'),
), ),
TextField( TextField(
controller: ipController, controller: ipController,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
decoration: _buildDecoration('IP'), decoration: _buildDecoration('Host'),
), ),
TextField( TextField(
controller: portController, controller: portController,
@@ -139,19 +139,19 @@ class _ServerPageState extends State<ServerPage>
TextField( TextField(
controller: usernameController, controller: usernameController,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
decoration: _buildDecoration('用户名'), decoration: _buildDecoration('User'),
), ),
TextField( TextField(
controller: keyController, controller: keyController,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
decoration: _buildDecoration('密钥(可选)'), decoration: _buildDecoration('Key(Optional)'),
onSubmitted: (_) => {}, onSubmitted: (_) => {},
), ),
TextField( TextField(
controller: passwordController, controller: passwordController,
obscureText: true, obscureText: true,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
decoration: _buildDecoration('密码'), decoration: _buildDecoration('Pwd'),
onSubmitted: (_) => {}, onSubmitted: (_) => {},
), ),
], ],
@@ -186,7 +186,7 @@ class _ServerPageState extends State<ServerPage>
showRoundDialog( showRoundDialog(
context, context,
'修改服务器信息', 'Edit',
_buildTextInputField(context), _buildTextInputField(context),
[ [
TextButton( TextButton(
@@ -194,7 +194,7 @@ class _ServerPageState extends State<ServerPage>
clearTextField(); clearTextField();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: const Text('关闭')), child: const Text('Close')),
TextButton( TextButton(
onPressed: () { onPressed: () {
final authorization = keyController.text.isEmpty final authorization = keyController.text.isEmpty
@@ -214,7 +214,7 @@ class _ServerPageState extends State<ServerPage>
clearTextField(); clearTextField();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: const Text('保存')), child: const Text('Save')),
TextButton( TextButton(
onPressed: () { onPressed: () {
serverProvider.delServer(spi); serverProvider.delServer(spi);
@@ -222,7 +222,7 @@ class _ServerPageState extends State<ServerPage>
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
child: const Text( child: const Text(
'删除', 'Delete',
style: TextStyle(color: Colors.red), style: TextStyle(color: Colors.red),
)) ))
], ],

View File

@@ -67,8 +67,8 @@ Future<void> updateBuildData() async {
await writeStaicConfigFile(data, 'BuildData', path); await writeStaicConfigFile(data, 'BuildData', path);
} }
void flutterRun() { void flutterRun(String? mode) {
Process.start('flutter', ['run'], Process.start('flutter', ['run', mode == null ? '' : '--$mode'],
mode: ProcessStartMode.inheritStdio, runInShell: true); mode: ProcessStartMode.inheritStdio, runInShell: true);
} }
@@ -121,7 +121,7 @@ void main(List<String> args) async {
switch (command) { switch (command) {
case 'run': case 'run':
return flutterRun(); return flutterRun(args.length == 2 ? args[1] : null);
case 'build': case 'build':
if (args.length > 1) { if (args.length > 1) {
await updateBuildData(); await updateBuildData();