mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
fix & opt
- display when client.run no result - remove dep. marquee
This commit is contained in:
@@ -89,7 +89,8 @@ class AptProvider extends BusyProvider {
|
||||
default:
|
||||
// avoid other outputs
|
||||
// such as: [Could not chdir to home directory /home/test: No such file or directory, , WARNING: apt does not have a stable CLI interface. Use with caution in scripts., , Listing...]
|
||||
final idx = list.indexWhere((element) => element.contains('[upgradable from:'));
|
||||
final idx =
|
||||
list.indexWhere((element) => element.contains('[upgradable from:'));
|
||||
if (idx != -1) {
|
||||
list = list.sublist(idx);
|
||||
}
|
||||
|
||||
@@ -176,7 +176,12 @@ class ServerProvider extends BusyProvider {
|
||||
logger.info(
|
||||
'Connected to [${spi.name}] in [${time2.difference(time1).toString()}].');
|
||||
s.connectionState = ServerConnectionState.connected;
|
||||
s.client!.run("echo '$shellCmd' > $shellPath && chmod +x $shellPath");
|
||||
final writeResult = await s.client!
|
||||
.run("echo '$shellCmd' > $shellPath && chmod +x $shellPath")
|
||||
.string;
|
||||
if (writeResult.isNotEmpty) {
|
||||
throw Exception(writeResult);
|
||||
}
|
||||
} catch (e) {
|
||||
s.connectionState = ServerConnectionState.failed;
|
||||
s.status.failedInfo = '$e ## ';
|
||||
@@ -189,13 +194,15 @@ class ServerProvider extends BusyProvider {
|
||||
// if client is null, return
|
||||
if (s.client == null) return;
|
||||
final raw = await s.client!.run("sh $shellPath").string;
|
||||
if (raw.isEmpty) {
|
||||
final lines = raw.split(seperator).map((e) => e.trim()).toList();
|
||||
if (raw.isEmpty || lines.length == 1) {
|
||||
s.connectionState = ServerConnectionState.failed;
|
||||
s.status.failedInfo = 'Empty output';
|
||||
if (s.status.failedInfo == null || s.status.failedInfo!.isEmpty) {
|
||||
s.status.failedInfo = 'No data received';
|
||||
}
|
||||
notifyListeners();
|
||||
return;
|
||||
}
|
||||
final lines = raw.split(seperator).map((e) => e.trim()).toList();
|
||||
lines.removeAt(0);
|
||||
|
||||
try {
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 143;
|
||||
static const int build = 144;
|
||||
static const String engine =
|
||||
"Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (3 days ago) • 2022-05-19 15:50:29 -0700\nEngine • revision caaafc5604\nTools • Dart 2.17.1 • DevTools 2.12.2\n";
|
||||
static const String buildAt = "2022-05-23 17:48:09.246927";
|
||||
static const int modifications = 0;
|
||||
"Flutter 3.0.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision fb57da5f94 (4 days ago) • 2022-05-19 15:50:29 -0700\nEngine • revision caaafc5604\nTools • Dart 2.17.1 • DevTools 2.12.2\n";
|
||||
static const String buildAt = "2022-05-24 13:07:20.629833";
|
||||
static const int modifications = 2;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"choosePrivateKey":
|
||||
MessageLookupByLibrary.simpleMessage("Choose private key"),
|
||||
"clear": MessageLookupByLibrary.simpleMessage("Clear"),
|
||||
"clickSee": MessageLookupByLibrary.simpleMessage("Click here"),
|
||||
"close": MessageLookupByLibrary.simpleMessage("Close"),
|
||||
"containerStatus":
|
||||
MessageLookupByLibrary.simpleMessage("Container status"),
|
||||
|
||||
@@ -76,6 +76,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
||||
"chooseDestination": MessageLookupByLibrary.simpleMessage("选择目标"),
|
||||
"choosePrivateKey": MessageLookupByLibrary.simpleMessage("选择私钥"),
|
||||
"clear": MessageLookupByLibrary.simpleMessage("清除"),
|
||||
"clickSee": MessageLookupByLibrary.simpleMessage("点击查看"),
|
||||
"close": MessageLookupByLibrary.simpleMessage("关闭"),
|
||||
"containerStatus": MessageLookupByLibrary.simpleMessage("容器状态"),
|
||||
"convert": MessageLookupByLibrary.simpleMessage("转换"),
|
||||
|
||||
@@ -1300,6 +1300,16 @@ class S {
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Click here`
|
||||
String get clickSee {
|
||||
return Intl.message(
|
||||
'Click here',
|
||||
name: 'clickSee',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||
|
||||
@@ -123,5 +123,6 @@
|
||||
"restoreSureWithDate": "Are you sure to restore from {date} ?",
|
||||
"backupVersionNotMatch": "Backup version is not match.",
|
||||
"invalidJson": "Invalid JSON",
|
||||
"restoreSuccess": "Restore success. Restart app to apply."
|
||||
"restoreSuccess": "Restore success. Restart app to apply.",
|
||||
"clickSee": "Click here"
|
||||
}
|
||||
@@ -123,5 +123,6 @@
|
||||
"restoreSureWithDate": "确定恢复 {date} 的备份吗?",
|
||||
"backupVersionNotMatch": "备份版本不匹配,无法恢复",
|
||||
"invalidJson": "无效的json,存在格式问题",
|
||||
"restoreSuccess": "恢复成功,需要重启App来应用更改"
|
||||
"restoreSuccess": "恢复成功,需要重启App来应用更改",
|
||||
"clickSee": "点击查看"
|
||||
}
|
||||
@@ -136,10 +136,10 @@ class _AptManagePageState extends State<AptManagePage>
|
||||
SizedBox(
|
||||
height: _media.size.height * 0.4,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(17),
|
||||
padding: const EdgeInsets.all(17),
|
||||
child: RoundRectCard(
|
||||
SingleChildScrollView(
|
||||
padding: EdgeInsets.all(17),
|
||||
padding: const EdgeInsets.all(17),
|
||||
child: Text(
|
||||
apt.error!,
|
||||
textAlign: TextAlign.center,
|
||||
|
||||
@@ -3,10 +3,10 @@ import 'package:circle_chart/circle_chart.dart';
|
||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:marquee/marquee.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
import 'package:toolbox/core/route.dart';
|
||||
import 'package:toolbox/core/utils.dart';
|
||||
import 'package:toolbox/data/model/app/menu_item.dart';
|
||||
import 'package:toolbox/data/model/server/server.dart';
|
||||
import 'package:toolbox/data/model/server/server_connection_state.dart';
|
||||
@@ -167,19 +167,10 @@ class _ServerPageState extends State<ServerPage>
|
||||
Row(
|
||||
children: [
|
||||
hasError
|
||||
? ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: _media.size.width * 0.57,
|
||||
maxHeight: 15),
|
||||
child: Marquee(
|
||||
accelerationDuration: const Duration(seconds: 3),
|
||||
accelerationCurve: Curves.linear,
|
||||
decelerationDuration: const Duration(seconds: 3),
|
||||
decelerationCurve: Curves.linear,
|
||||
text: topRightStr,
|
||||
textScaleFactor: 1.0,
|
||||
style: style),
|
||||
)
|
||||
? GestureDetector(
|
||||
onTap: () => showRoundDialog(
|
||||
context, s.error, Text(ss.failedInfo ?? ''), []),
|
||||
child: Text(s.clickSee, style: style))
|
||||
: Text(topRightStr, style: style, textScaleFactor: 1.0),
|
||||
_buildMoreBtn(spi),
|
||||
],
|
||||
|
||||
14
pubspec.lock
14
pubspec.lock
@@ -159,13 +159,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.3.0"
|
||||
fading_edge_scrollview:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fading_edge_scrollview
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -326,13 +319,6 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
marquee:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: marquee
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.2"
|
||||
matcher:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -54,7 +54,6 @@ dependencies:
|
||||
clipboard: ^0.1.3
|
||||
r_upgrade: ^0.3.6
|
||||
pull_to_refresh: ^2.0.0
|
||||
marquee: ^2.2.0
|
||||
dropdown_button2: ^1.1.1
|
||||
flutter_advanced_drawer: ^1.3.0
|
||||
path_provider: ^2.0.9
|
||||
|
||||
Reference in New Issue
Block a user