Fix scorll error.

This commit is contained in:
Junyuan Feng
2022-05-05 13:31:45 +08:00
parent 521ff998af
commit f9aa3b1728
8 changed files with 32 additions and 24 deletions

View File

@@ -354,7 +354,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 122; CURRENT_PROJECT_VERSION = 123;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -362,7 +362,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.122; MARKETING_VERSION = 1.0.123;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -484,7 +484,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 122; CURRENT_PROJECT_VERSION = 123;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -492,7 +492,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.122; MARKETING_VERSION = 1.0.123;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
@@ -508,7 +508,7 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 122; CURRENT_PROJECT_VERSION = 123;
DEVELOPMENT_TEAM = BA88US33G6; DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
@@ -516,7 +516,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.0.122; MARKETING_VERSION = 1.0.123;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox; PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";

View File

@@ -14,8 +14,10 @@ class Cpu2Status {
return used.isNaN ? 0 : 100 - used * 100; return used.isNaN ? 0 : 100 - used * 100;
} }
Cpu2Status update(List<CpuStatus> newStatus, String newTemp) { void update(List<CpuStatus> newStatus, String newTemp) {
return Cpu2Status(now, newStatus, newTemp); pre = now;
now = newStatus;
temp = newTemp;
} }
int get coresCount => now.length; int get coresCount => now.length;

View File

@@ -21,7 +21,10 @@ class NetSpeed {
return devices; return devices;
} }
NetSpeed update(List<NetSpeedPart> newOne) => NetSpeed(now, newOne); void update(List<NetSpeedPart> newOne) {
old = now;
now = newOne;
}
int get timeDiff => now[0].time - old[0].time; int get timeDiff => now[0].time - old[0].time;

View File

@@ -29,14 +29,15 @@ List<SSHKeyPair> loadIndentity(String key) {
return SSHKeyPair.fromPem(key); return SSHKeyPair.fromPem(key);
} }
const shellCmd = "cat /proc/net/dev && date +%s \necho A====A \n " const seperator = 'A====A';
"cat /etc/os-release | grep PRETTY_NAME \necho A====A \n" const shellCmd = "cat /proc/net/dev && date +%s \necho $seperator \n "
"cat /proc/stat | grep cpu \necho A====A \n" "cat /etc/os-release | grep PRETTY_NAME \necho $seperator \n"
"uptime \necho A====A \n" "cat /proc/stat | grep cpu \necho $seperator \n"
"cat /proc/net/snmp \necho A====A \n" "uptime \necho $seperator \n"
"df -h \necho A====A \n" "cat /proc/net/snmp \necho $seperator \n"
"free -m \necho A====A \n" "df -h \necho $seperator \n"
"cat /sys/class/thermal/thermal_zone*/type \necho A====A \n" "free -m \necho $seperator \n"
"cat /sys/class/thermal/thermal_zone*/type \necho $seperator \n"
"cat /sys/class/thermal/thermal_zone*/temp"; "cat /sys/class/thermal/thermal_zone*/temp";
const shellPath = '.serverbox.sh'; const shellPath = '.serverbox.sh';
final cpuTempReg = RegExp('(x86_pkg_temp|cpu_thermal)'); final cpuTempReg = RegExp('(x86_pkg_temp|cpu_thermal)');
@@ -190,7 +191,7 @@ class ServerProvider extends BusyProvider {
final si = _servers[idx]; final si = _servers[idx];
if (si.client == null) return; if (si.client == null) return;
final raw = await si.client!.run("sh $shellPath").string; final raw = await si.client!.run("sh $shellPath").string;
final lines = raw.split('A====A').map((e) => e.trim()).toList(); final lines = raw.split(seperator).map((e) => e.trim()).toList();
try { try {
_getCPU(spi, lines[2], lines[7], lines[8]); _getCPU(spi, lines[2], lines[7], lines[8]);
@@ -232,7 +233,7 @@ class ServerProvider extends BusyProvider {
final bytesOut = int.parse(bytes[8]); final bytesOut = int.parse(bytes[8]);
results.add(NetSpeedPart(device, bytesIn, bytesOut, time)); results.add(NetSpeedPart(device, bytesIn, bytesOut, time));
} }
info.status.netSpeed = info.status.netSpeed.update(results); info.status.netSpeed.update(results);
} }
void _getSysVer(ServerPrivateInfo spi, String raw) { void _getSysVer(ServerPrivateInfo spi, String raw) {
@@ -285,8 +286,7 @@ class ServerProvider extends BusyProvider {
int.parse(matches[6]))); int.parse(matches[6])));
} }
if (cpus.isNotEmpty) { if (cpus.isNotEmpty) {
info.status.cpu2Status = info.status.cpu2Status.update(cpus, _getCPUTemp(tempType, tempValue));
info.status.cpu2Status.update(cpus, _getCPUTemp(tempType, tempValue));
} }
} }

View File

@@ -2,9 +2,9 @@
class BuildData { class BuildData {
static const String name = "ServerBox"; static const String name = "ServerBox";
static const int build = 122; static const int build = 123;
static const String engine = 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"; "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:07:15.254894"; static const String buildAt = "2022-05-04 21:08:15.263486";
static const int modifications = 5; static const int modifications = 0;
} }

View File

@@ -50,6 +50,7 @@ class _ConvertPageState extends State<ConvertPage>
body: GestureDetector( body: GestureDetector(
child: SingleChildScrollView( child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 7), padding: const EdgeInsets.symmetric(horizontal: 7),
controller: ScrollController(),
child: Column(children: [ child: Column(children: [
const SizedBox(height: 13), const SizedBox(height: 13),
_buildInputTop(), _buildInputTop(),

View File

@@ -48,6 +48,7 @@ class _PingPageState extends State<PingPage>
width: double.infinity, width: double.infinity,
height: _media.size.height * 0.6, height: _media.size.height * 0.6,
child: ListView.builder( child: ListView.builder(
controller: ScrollController(),
itemCount: _results.length, itemCount: _results.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final result = _results[index]; final result = _results[index];

View File

@@ -71,6 +71,7 @@ class _ServerPageState extends State<ServerPage>
} }
return ListView.separated( return ListView.separated(
padding: const EdgeInsets.all(7), padding: const EdgeInsets.all(7),
controller: ScrollController(),
itemBuilder: (ctx, idx) { itemBuilder: (ctx, idx) {
if (idx == pro.servers.length) { if (idx == pro.servers.length) {
return SizedBox(height: _media.padding.bottom); return SizedBox(height: _media.padding.bottom);