mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
Fix get mem failed in chinese
This commit is contained in:
@@ -296,22 +296,27 @@ class ServerProvider extends BusyProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _getMem(ServerPrivateInfo spi, String raw) {
|
void _getMem(ServerPrivateInfo spi, String raw) {
|
||||||
|
const memPrefixies = ['Mem:', '内存:'];
|
||||||
final info = _servers.firstWhere((e) => e.info == spi);
|
final info = _servers.firstWhere((e) => e.info == spi);
|
||||||
for (var item in raw.split('\n')) {
|
for (var item in raw.split('\n')) {
|
||||||
if (item.contains('Mem:') || item.contains('内存:')) {
|
var found = false;
|
||||||
var split = item.replaceFirst('Mem:', '');
|
for (var memPrefix in memPrefixies) {
|
||||||
split = split.replaceFirst('内存:', '');
|
if (item.contains(memPrefix)) {
|
||||||
split = split.split(' ');
|
found = true;
|
||||||
split.removeWhere((e) => e == '');
|
final split = item.replaceFirst(memPrefix, '').split(' ');
|
||||||
final memList = split.map((e) => int.parse(e)).toList();
|
split.removeWhere((e) => e == '');
|
||||||
info.status.memory = Memory(
|
final memList = split.map((e) => int.parse(e)).toList();
|
||||||
total: memList[0],
|
info.status.memory = Memory(
|
||||||
used: memList[1],
|
total: memList[0],
|
||||||
free: memList[2],
|
used: memList[1],
|
||||||
shared: memList[3],
|
free: memList[2],
|
||||||
cache: memList[4],
|
shared: memList[3],
|
||||||
avail: memList[5]);
|
cache: memList[4],
|
||||||
|
avail: memList[5]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (found) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 98;
|
static const int build = 101;
|
||||||
static const String engine =
|
static const String engine =
|
||||||
"╔════════════════════════════════════════════════════════════════════════════╗\n║ A new version of Flutter is available! ║\n║ ║\n║ To update to the latest version, run \"flutter upgrade\". ║\n╚════════════════════════════════════════════════════════════════════════════╝\n\nFlutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (9 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
|
"Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (3 months ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
|
||||||
static const String buildAt = "2022-02-18 13:28:18.254386";
|
static const String buildAt = "2022-03-02 11:12:07.958841";
|
||||||
static const int modifications = 5;
|
static const int modifications = 4;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,7 +307,17 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
height: 7,
|
height: 7,
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
children.addAll(ns.devices.map((e) => _buildNetSpeedItem(ns, e)));
|
if (ns.devices.isEmpty) {
|
||||||
|
children.add(const Center(
|
||||||
|
child: Text(
|
||||||
|
'No interface.',
|
||||||
|
style: TextStyle(color: Colors.grey),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
children.addAll(ns.devices.map((e) => _buildNetSpeedItem(ns, e)));
|
||||||
|
}
|
||||||
|
|
||||||
return RoundRectCard(Padding(
|
return RoundRectCard(Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 7, horizontal: 17),
|
padding: const EdgeInsets.symmetric(vertical: 7, horizontal: 17),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -142,18 +142,7 @@ class _SFTPPageState extends State<SFTPPage> {
|
|||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.delete),
|
leading: const Icon(Icons.delete),
|
||||||
title: const Text('Delete'),
|
title: const Text('Delete'),
|
||||||
onTap: () => showRoundDialog(context, 'Confirm',
|
onTap: () => delete(context, left, file),
|
||||||
Text('Are you sure to delete ${file.filename}?'), [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: const Text('Cancel')),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {},
|
|
||||||
child: const Text(
|
|
||||||
'Delete',
|
|
||||||
style: TextStyle(color: Colors.red),
|
|
||||||
)),
|
|
||||||
]),
|
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.folder),
|
leading: const Icon(Icons.folder),
|
||||||
@@ -162,7 +151,7 @@ class _SFTPPageState extends State<SFTPPage> {
|
|||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(left ? Icons.arrow_forward : Icons.arrow_back),
|
leading: Icon(left ? Icons.arrow_forward : Icons.arrow_back),
|
||||||
title: const Text('Copy'),
|
title: const Text('Copy'),
|
||||||
onTap: () {},
|
onTap: () => copy(context, left, file),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.edit),
|
leading: const Icon(Icons.edit),
|
||||||
@@ -172,7 +161,7 @@ class _SFTPPageState extends State<SFTPPage> {
|
|||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.file_download),
|
leading: const Icon(Icons.file_download),
|
||||||
title: const Text('Download'),
|
title: const Text('Download'),
|
||||||
onTap: () {},
|
onTap: () => download(context, left, file),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -183,6 +172,25 @@ class _SFTPPageState extends State<SFTPPage> {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void download(BuildContext context, bool left, SftpName file) {}
|
||||||
|
|
||||||
|
void copy(BuildContext context, bool left, SftpName file) {}
|
||||||
|
|
||||||
|
void delete(BuildContext context, bool left, SftpName file) {
|
||||||
|
showRoundDialog(
|
||||||
|
context, 'Confirm', Text('Are you sure to delete ${file.filename}?'), [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: const Text('Cancel')),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {},
|
||||||
|
child: const Text(
|
||||||
|
'Delete',
|
||||||
|
style: TextStyle(color: Colors.red),
|
||||||
|
)),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
void mkdir(BuildContext context, bool left) {
|
void mkdir(BuildContext context, bool left) {
|
||||||
final textController = TextEditingController();
|
final textController = TextEditingController();
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
@@ -320,7 +328,7 @@ class _SFTPPageState extends State<SFTPPage> {
|
|||||||
|
|
||||||
return Text(
|
return Text(
|
||||||
(exceeded ? '...' : '') + str!.substring(str.length - len),
|
(exceeded ? '...' : '') + str!.substring(str.length - len),
|
||||||
overflow: TextOverflow.clip,
|
overflow: TextOverflow.ellipsis,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
style: const TextStyle(color: Colors.grey),
|
style: const TextStyle(color: Colors.grey),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user