diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 9bdf4a0d..73add010 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -354,7 +354,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
- CURRENT_PROJECT_VERSION = 123;
+ CURRENT_PROJECT_VERSION = 125;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -362,7 +362,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.0.123;
+ MARKETING_VERSION = 1.0.125;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -484,7 +484,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
- CURRENT_PROJECT_VERSION = 123;
+ CURRENT_PROJECT_VERSION = 125;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -492,7 +492,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.0.123;
+ MARKETING_VERSION = 1.0.125;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -508,7 +508,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
- CURRENT_PROJECT_VERSION = 123;
+ CURRENT_PROJECT_VERSION = 125;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
@@ -516,7 +516,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.0.123;
+ MARKETING_VERSION = 1.0.125;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index f0214fc3..fefe5b8e 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -41,5 +41,10 @@
UIViewControllerBasedStatusBarAppearance
+ CFBundleLocalizations
+
+ en
+ zh
+
\ No newline at end of file
diff --git a/lib/app.dart b/lib/app.dart
index 971ece48..f96463cb 100644
--- a/lib/app.dart
+++ b/lib/app.dart
@@ -33,10 +33,10 @@ class MyApp extends StatelessWidget {
final textStyle = TextStyle(color: primaryColor);
return MaterialApp(
localizationsDelegates: const [
- S.delegate,
- GlobalMaterialLocalizations.delegate,
- GlobalWidgetsLocalizations.delegate,
- GlobalCupertinoLocalizations.delegate,
+ S.delegate,
+ GlobalMaterialLocalizations.delegate,
+ GlobalWidgetsLocalizations.delegate,
+ GlobalCupertinoLocalizations.delegate,
],
supportedLocales: S.delegate.supportedLocales,
title: BuildData.name,
diff --git a/lib/data/provider/server.dart b/lib/data/provider/server.dart
index 7101f505..6af96668 100644
--- a/lib/data/provider/server.dart
+++ b/lib/data/provider/server.dart
@@ -30,7 +30,8 @@ List loadIndentity(String key) {
}
const seperator = 'A====A';
-const shellCmd = "cat /proc/net/dev && date +%s \necho $seperator \n "
+const shellCmd = "export LANG=en_US.utf-8 \necho '$seperator' \n"
+ "cat /proc/net/dev && date +%s \necho $seperator \n "
"cat /etc/os-release | grep PRETTY_NAME \necho $seperator \n"
"cat /proc/stat | grep cpu \necho $seperator \n"
"uptime \necho $seperator \n"
@@ -40,6 +41,7 @@ const shellCmd = "cat /proc/net/dev && date +%s \necho $seperator \n "
"cat /sys/class/thermal/thermal_zone*/type \necho $seperator \n"
"cat /sys/class/thermal/thermal_zone*/temp";
const shellPath = '.serverbox.sh';
+const memPrefix = 'Mem:';
final cpuTempReg = RegExp('(x86_pkg_temp|cpu_thermal)');
class ServerProvider extends BusyProvider {
@@ -192,6 +194,7 @@ class ServerProvider extends BusyProvider {
if (si.client == null) return;
final raw = await si.client!.run("sh $shellPath").string;
final lines = raw.split(seperator).map((e) => e.trim()).toList();
+ lines.removeAt(0);
try {
_getCPU(spi, lines[2], lines[7], lines[8]);
@@ -322,25 +325,22 @@ class ServerProvider extends BusyProvider {
}
void _getMem(ServerPrivateInfo spi, String raw) {
- const memPrefixies = ['Mem:', '内存:'];
final info = _servers.firstWhere((e) => e.info == spi);
for (var item in raw.split('\n')) {
var found = false;
- for (var memPrefix in memPrefixies) {
- if (item.contains(memPrefix)) {
- found = true;
- final split = item.replaceFirst(memPrefix, '').split(' ');
- split.removeWhere((e) => e == '');
- final memList = split.map((e) => int.parse(e)).toList();
- info.status.memory = Memory(
- total: memList[0],
- used: memList[1],
- free: memList[2],
- shared: memList[3],
- cache: memList[4],
- avail: memList[5]);
- break;
- }
+ if (item.contains(memPrefix)) {
+ found = true;
+ final split = item.replaceFirst(memPrefix, '').split(' ');
+ split.removeWhere((e) => e == '');
+ final memList = split.map((e) => int.parse(e)).toList();
+ info.status.memory = Memory(
+ total: memList[0],
+ used: memList[1],
+ free: memList[2],
+ shared: memList[3],
+ cache: memList[4],
+ avail: memList[5]);
+ break;
}
if (found) break;
}
diff --git a/lib/data/res/build_data.dart b/lib/data/res/build_data.dart
index 662e3653..b7e4eec0 100644
--- a/lib/data/res/build_data.dart
+++ b/lib/data/res/build_data.dart
@@ -2,9 +2,9 @@
class BuildData {
static const String name = "ServerBox";
- static const int build = 123;
+ static const int build = 125;
static const String engine =
"Flutter 2.10.5 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 5464c5bac7 (2 weeks ago) • 2022-04-18 09:55:37 -0700\nEngine • revision 57d3bac3dd\nTools • Dart 2.16.2 • DevTools 2.9.2\n";
- static const String buildAt = "2022-05-04 21:08:15.263486";
- static const int modifications = 0;
+ static const String buildAt = "2022-05-05 16:11:07.575227";
+ static const int modifications = 2;
}
diff --git a/lib/data/res/font_style.dart b/lib/data/res/font_style.dart
index 61227688..d8390486 100644
--- a/lib/data/res/font_style.dart
+++ b/lib/data/res/font_style.dart
@@ -1,3 +1,3 @@
import 'package:flutter/material.dart';
-const TextStyle size18 = TextStyle(fontSize: 18);
\ No newline at end of file
+const TextStyle size18 = TextStyle(fontSize: 18);
diff --git a/lib/view/page/home.dart b/lib/view/page/home.dart
index 211e1b94..7d3ca76f 100644
--- a/lib/view/page/home.dart
+++ b/lib/view/page/home.dart
@@ -247,8 +247,7 @@ class _MyHomePageState extends State
applicationIcon: _buildIcon(),
aboutBoxChildren: [
UrlText(
- text: s.madeWithLove(myGithub),
- replace: 'LollipopKit'),
+ text: s.madeWithLove(myGithub), replace: 'LollipopKit'),
UrlText(
text: s.aboutThanks(rainSunMeGithub),
replace: 'RainSunMe',
diff --git a/lib/view/page/ping.dart b/lib/view/page/ping.dart
index 7dbc7659..ef8bada0 100644
--- a/lib/view/page/ping.dart
+++ b/lib/view/page/ping.dart
@@ -75,7 +75,10 @@ class _PingPageState extends State
title: Text(result.serverName,
style: TextStyle(
fontSize: 18, fontWeight: FontWeight.bold, color: primaryColor)),
- subtitle: Text(_buildPingSummary(result, unknown, ms), style: summaryTextStyle,),
+ subtitle: Text(
+ _buildPingSummary(result, unknown, ms),
+ style: summaryTextStyle,
+ ),
trailing: Text(
s.pingAvg +
(result.statistic?.avg?.toStringAsFixed(2) ?? s.unknown) +
diff --git a/lib/view/page/private_key/edit.dart b/lib/view/page/private_key/edit.dart
index e410f5a1..0ce9b5fa 100644
--- a/lib/view/page/private_key/edit.dart
+++ b/lib/view/page/private_key/edit.dart
@@ -92,8 +92,7 @@ class _PrivateKeyEditPageState extends State
final key = keyController.text;
final pwd = pwdController.text;
if (name.isEmpty || key.isEmpty) {
- showSnackBar(
- context, Text(s.fieldMustNotEmpty));
+ showSnackBar(context, Text(s.fieldMustNotEmpty));
return;
}
FocusScope.of(context).unfocus();
diff --git a/lib/view/page/server/edit.dart b/lib/view/page/server/edit.dart
index a8e7521a..c4cb4104 100644
--- a/lib/view/page/server/edit.dart
+++ b/lib/view/page/server/edit.dart
@@ -60,26 +60,22 @@ class _ServerEditPageState extends State with AfterLayoutMixin {
widget.spi != null
? IconButton(
onPressed: () {
- showRoundDialog(
- context,
- 'Attention',
- Text(
- s.sureToDeleteServer(widget.spi!.name)),
- [
- TextButton(
- onPressed: () {
- _serverProvider.delServer(widget.spi!);
- Navigator.of(context).pop();
- Navigator.of(context).pop();
- },
- child: Text(
- s.ok,
- style: const TextStyle(color: Colors.red),
- )),
- TextButton(
- onPressed: () => Navigator.of(context).pop(),
- child: Text(s.cancel))
- ]);
+ showRoundDialog(context, 'Attention',
+ Text(s.sureToDeleteServer(widget.spi!.name)), [
+ TextButton(
+ onPressed: () {
+ _serverProvider.delServer(widget.spi!);
+ Navigator.of(context).pop();
+ Navigator.of(context).pop();
+ },
+ child: Text(
+ s.ok,
+ style: const TextStyle(color: Colors.red),
+ )),
+ TextButton(
+ onPressed: () => Navigator.of(context).pop(),
+ child: Text(s.cancel))
+ ]);
},
icon: const Icon(Icons.delete))
: const SizedBox()
@@ -93,8 +89,8 @@ class _ServerEditPageState extends State with AfterLayoutMixin {
TextField(
controller: nameController,
keyboardType: TextInputType.text,
- decoration:
- buildDecoration(s.name, icon: Icons.info, hint: s.exampleName),
+ decoration: buildDecoration(s.name,
+ icon: Icons.info, hint: s.exampleName),
),
TextField(
controller: ipController,
diff --git a/lib/view/page/snippet/edit.dart b/lib/view/page/snippet/edit.dart
index f7edcb71..e2b8e1e8 100644
--- a/lib/view/page/snippet/edit.dart
+++ b/lib/view/page/snippet/edit.dart
@@ -30,7 +30,7 @@ class _SnippetEditPageState extends State
super.initState();
_provider = locator();
}
-
+
@override
void didChangeDependencies() {
super.didChangeDependencies();
diff --git a/lib/view/page/snippet/list.dart b/lib/view/page/snippet/list.dart
index 9be6d2fd..47b5e92f 100644
--- a/lib/view/page/snippet/list.dart
+++ b/lib/view/page/snippet/list.dart
@@ -122,7 +122,7 @@ class _SnippetListPageState extends State {
TextButton(
onPressed: () async =>
await _import(_importFieldController.text.trim()),
- child: Text('GO'),
+ child: const Text('GO'),
)
]);
}
@@ -246,11 +246,9 @@ class _SnippetListPageState extends State {
]));
}), [
TextButton(
- onPressed: () async => run(context, snippet),
- child: Text(s.run)),
+ onPressed: () async => run(context, snippet), child: Text(s.run)),
TextButton(
- onPressed: () => Navigator.of(context).pop(),
- child: Text(s.cancel)),
+ onPressed: () => Navigator.of(context).pop(), child: Text(s.cancel)),
]);
}
@@ -261,8 +259,7 @@ class _SnippetListPageState extends State {
showRoundDialog(context, s.result,
Text(result, style: const TextStyle(fontSize: 13)), [
TextButton(
- onPressed: () => Navigator.of(context).pop(),
- child: Text(s.close))
+ onPressed: () => Navigator.of(context).pop(), child: Text(s.close))
]);
}
}