mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
Fix get mem failed in chinese
This commit is contained in:
@@ -296,12 +296,14 @@ 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')) {
|
||||
if (item.contains('Mem:') || item.contains('内存:')) {
|
||||
var split = item.replaceFirst('Mem:', '');
|
||||
split = split.replaceFirst('内存:', '');
|
||||
split = split.split(' ');
|
||||
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(
|
||||
@@ -311,8 +313,11 @@ class ServerProvider extends BusyProvider {
|
||||
shared: memList[3],
|
||||
cache: memList[4],
|
||||
avail: memList[5]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
}
|
||||
|
||||
Future<String?> runSnippet(ServerPrivateInfo spi, Snippet snippet) async {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 98;
|
||||
static const int build = 101;
|
||||
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";
|
||||
static const String buildAt = "2022-02-18 13:28:18.254386";
|
||||
static const int modifications = 5;
|
||||
"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-03-02 11:12:07.958841";
|
||||
static const int modifications = 4;
|
||||
}
|
||||
|
||||
@@ -307,7 +307,17 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
||||
height: 7,
|
||||
)
|
||||
];
|
||||
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(
|
||||
padding: const EdgeInsets.symmetric(vertical: 7, horizontal: 17),
|
||||
child: Column(
|
||||
|
||||
@@ -142,18 +142,7 @@ class _SFTPPageState extends State<SFTPPage> {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete),
|
||||
title: const Text('Delete'),
|
||||
onTap: () => 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),
|
||||
)),
|
||||
]),
|
||||
onTap: () => delete(context, left, file),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.folder),
|
||||
@@ -162,7 +151,7 @@ class _SFTPPageState extends State<SFTPPage> {
|
||||
ListTile(
|
||||
leading: Icon(left ? Icons.arrow_forward : Icons.arrow_back),
|
||||
title: const Text('Copy'),
|
||||
onTap: () {},
|
||||
onTap: () => copy(context, left, file),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.edit),
|
||||
@@ -172,7 +161,7 @@ class _SFTPPageState extends State<SFTPPage> {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.file_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) {
|
||||
final textController = TextEditingController();
|
||||
showRoundDialog(
|
||||
@@ -320,7 +328,7 @@ class _SFTPPageState extends State<SFTPPage> {
|
||||
|
||||
return Text(
|
||||
(exceeded ? '...' : '') + str!.substring(str.length - len),
|
||||
overflow: TextOverflow.clip,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
maxLines: 1,
|
||||
style: const TextStyle(color: Colors.grey),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user