mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
remove useless function
This commit is contained in:
@@ -33,28 +33,6 @@ class CpuStatus {
|
||||
this.irq,
|
||||
this.softirq,
|
||||
);
|
||||
CpuStatus.fromJson(Map<String, dynamic> json) {
|
||||
id = json["id"];
|
||||
user = json["user"]?.toInt();
|
||||
sys = json["sys"]?.toInt();
|
||||
nice = json["nice"]?.toInt();
|
||||
idle = json["idle"]?.toInt();
|
||||
iowait = json["iowait"]?.toInt();
|
||||
irq = json["irq"]?.toInt();
|
||||
softirq = json["softirq"]?.toInt();
|
||||
}
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data["id"] = id;
|
||||
data["user"] = user;
|
||||
data["sys"] = sys;
|
||||
data["nice"] = nice;
|
||||
data["idle"] = idle;
|
||||
data["iowait"] = iowait;
|
||||
data["irq"] = irq;
|
||||
data["softirq"] = softirq;
|
||||
return data;
|
||||
}
|
||||
|
||||
int get total => user + sys + nice + idle + iowait + irq + softirq;
|
||||
}
|
||||
|
||||
@@ -25,23 +25,4 @@ class DiskInfo {
|
||||
this.size,
|
||||
this.avail,
|
||||
);
|
||||
|
||||
DiskInfo.fromJson(Map<String, dynamic> json) {
|
||||
mountPath = json["mountPath"].toString();
|
||||
mountLocation = json["mountLocation"].toString();
|
||||
usedPercent = int.parse(json["usedPercent"]);
|
||||
used = json["used"].toString();
|
||||
size = json["size"].toString();
|
||||
avail = json["avail"].toString();
|
||||
}
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data["mountPath"] = mountPath;
|
||||
data["mountLocation"] = mountLocation;
|
||||
data["usedPercent"] = usedPercent;
|
||||
data["used"] = used;
|
||||
data["size"] = size;
|
||||
data["avail"] = avail;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,25 +13,27 @@ class ServerPrivateInfo {
|
||||
}
|
||||
*/
|
||||
|
||||
String? name;
|
||||
String? ip;
|
||||
int? port;
|
||||
String? user;
|
||||
Object? authorization;
|
||||
late String name;
|
||||
late String ip;
|
||||
late int port;
|
||||
late String user;
|
||||
late Object authorization;
|
||||
String? pubKeyId;
|
||||
|
||||
ServerPrivateInfo({
|
||||
this.name,
|
||||
this.ip,
|
||||
this.port,
|
||||
this.user,
|
||||
this.authorization,
|
||||
});
|
||||
ServerPrivateInfo(
|
||||
{required this.name,
|
||||
required this.ip,
|
||||
required this.port,
|
||||
required this.user,
|
||||
required this.authorization,
|
||||
this.pubKeyId});
|
||||
ServerPrivateInfo.fromJson(Map<String, dynamic> json) {
|
||||
name = json["name"]?.toString();
|
||||
ip = json["ip"]?.toString();
|
||||
port = json["port"]?.toInt();
|
||||
user = json["user"]?.toString();
|
||||
name = json["name"].toString();
|
||||
ip = json["ip"].toString();
|
||||
port = json["port"].toInt();
|
||||
user = json["user"].toString();
|
||||
authorization = json["authorization"];
|
||||
pubKeyId = json["pubKeyId"]?.toString();
|
||||
}
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
@@ -40,11 +42,12 @@ class ServerPrivateInfo {
|
||||
data["port"] = port;
|
||||
data["user"] = user;
|
||||
data["authorization"] = authorization;
|
||||
data["pubKeyId"] = pubKeyId;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
List<ServerPrivateInfo>? getServerInfoList(dynamic data) {
|
||||
List<ServerPrivateInfo> getServerInfoList(dynamic data) {
|
||||
List<ServerPrivateInfo> ss = [];
|
||||
if (data is String) {
|
||||
data = json.decode(data);
|
||||
|
||||
@@ -50,9 +50,9 @@ class ServerProvider extends BusyProvider {
|
||||
|
||||
SSHClient genClient(ServerPrivateInfo spi) {
|
||||
return SSHClient(
|
||||
host: spi.ip!,
|
||||
port: spi.port!,
|
||||
username: spi.user!,
|
||||
host: spi.ip,
|
||||
port: spi.port,
|
||||
username: spi.user,
|
||||
passwordOrKey: spi.authorization);
|
||||
}
|
||||
|
||||
|
||||
3
lib/data/res/icon/common.dart
Normal file
3
lib/data/res/icon/common.dart
Normal file
@@ -0,0 +1,3 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
final appIcon = Image.asset('assets/app_icon.png');
|
||||
@@ -1,3 +1,5 @@
|
||||
const backendUrl = 'https://v2.custed.lolli.tech';
|
||||
const baseUrl = backendUrl + '/res/toolbox';
|
||||
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
||||
const myGithub = 'https://github.com/LollipopKit';
|
||||
const rainSunMeGithub = 'https://github.com/RainSunMe';
|
||||
|
||||
@@ -12,7 +12,7 @@ class ServerStore extends PersistentStore {
|
||||
|
||||
List<ServerPrivateInfo> fetch() {
|
||||
return getServerInfoList(
|
||||
json.decode(box.get('servers', defaultValue: '[]')!))!;
|
||||
json.decode(box.get('servers', defaultValue: '[]')!));
|
||||
}
|
||||
|
||||
void delete(ServerPrivateInfo s) {
|
||||
|
||||
@@ -48,12 +48,20 @@ class _ServerPageState extends State<ServerPage>
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Scaffold(
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||
child: AnimationLimiter(
|
||||
child: Consumer<ServerProvider>(builder: (_, pro, __) {
|
||||
return Column(
|
||||
children: AnimationConfiguration.toStaggeredList(
|
||||
body: Consumer<ServerProvider>(builder: (_, pro, __) {
|
||||
if (pro.servers.isEmpty) {
|
||||
return const Center(
|
||||
child: Text(
|
||||
'There is not server.\nClick the fab to add one.',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||
child: AnimationLimiter(
|
||||
child: Column(
|
||||
children: AnimationConfiguration.toStaggeredList(
|
||||
duration: const Duration(milliseconds: 377),
|
||||
childAnimationBuilder: (widget) => SlideAnimation(
|
||||
verticalOffset: 50.0,
|
||||
@@ -65,9 +73,9 @@ class _ServerPageState extends State<ServerPage>
|
||||
const SizedBox(height: 13),
|
||||
...pro.servers.map((e) => _buildEachServerCard(e))
|
||||
],
|
||||
));
|
||||
})),
|
||||
),
|
||||
))),
|
||||
);
|
||||
}),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
onPressed: () =>
|
||||
AppRoute(const ServerEditPage(), 'Add server info page')
|
||||
|
||||
Reference in New Issue
Block a user