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.irq,
|
||||||
this.softirq,
|
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;
|
int get total => user + sys + nice + idle + iowait + irq + softirq;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,23 +25,4 @@ class DiskInfo {
|
|||||||
this.size,
|
this.size,
|
||||||
this.avail,
|
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;
|
late String name;
|
||||||
String? ip;
|
late String ip;
|
||||||
int? port;
|
late int port;
|
||||||
String? user;
|
late String user;
|
||||||
Object? authorization;
|
late Object authorization;
|
||||||
|
String? pubKeyId;
|
||||||
|
|
||||||
ServerPrivateInfo({
|
ServerPrivateInfo(
|
||||||
this.name,
|
{required this.name,
|
||||||
this.ip,
|
required this.ip,
|
||||||
this.port,
|
required this.port,
|
||||||
this.user,
|
required this.user,
|
||||||
this.authorization,
|
required this.authorization,
|
||||||
});
|
this.pubKeyId});
|
||||||
ServerPrivateInfo.fromJson(Map<String, dynamic> json) {
|
ServerPrivateInfo.fromJson(Map<String, dynamic> json) {
|
||||||
name = json["name"]?.toString();
|
name = json["name"].toString();
|
||||||
ip = json["ip"]?.toString();
|
ip = json["ip"].toString();
|
||||||
port = json["port"]?.toInt();
|
port = json["port"].toInt();
|
||||||
user = json["user"]?.toString();
|
user = json["user"].toString();
|
||||||
authorization = json["authorization"];
|
authorization = json["authorization"];
|
||||||
|
pubKeyId = json["pubKeyId"]?.toString();
|
||||||
}
|
}
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
final Map<String, dynamic> data = <String, dynamic>{};
|
||||||
@@ -40,11 +42,12 @@ class ServerPrivateInfo {
|
|||||||
data["port"] = port;
|
data["port"] = port;
|
||||||
data["user"] = user;
|
data["user"] = user;
|
||||||
data["authorization"] = authorization;
|
data["authorization"] = authorization;
|
||||||
|
data["pubKeyId"] = pubKeyId;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ServerPrivateInfo>? getServerInfoList(dynamic data) {
|
List<ServerPrivateInfo> getServerInfoList(dynamic data) {
|
||||||
List<ServerPrivateInfo> ss = [];
|
List<ServerPrivateInfo> ss = [];
|
||||||
if (data is String) {
|
if (data is String) {
|
||||||
data = json.decode(data);
|
data = json.decode(data);
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ class ServerProvider extends BusyProvider {
|
|||||||
|
|
||||||
SSHClient genClient(ServerPrivateInfo spi) {
|
SSHClient genClient(ServerPrivateInfo spi) {
|
||||||
return SSHClient(
|
return SSHClient(
|
||||||
host: spi.ip!,
|
host: spi.ip,
|
||||||
port: spi.port!,
|
port: spi.port,
|
||||||
username: spi.user!,
|
username: spi.user,
|
||||||
passwordOrKey: spi.authorization);
|
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 backendUrl = 'https://v2.custed.lolli.tech';
|
||||||
const baseUrl = backendUrl + '/res/toolbox';
|
const baseUrl = backendUrl + '/res/toolbox';
|
||||||
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
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() {
|
List<ServerPrivateInfo> fetch() {
|
||||||
return getServerInfoList(
|
return getServerInfoList(
|
||||||
json.decode(box.get('servers', defaultValue: '[]')!))!;
|
json.decode(box.get('servers', defaultValue: '[]')!));
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete(ServerPrivateInfo s) {
|
void delete(ServerPrivateInfo s) {
|
||||||
|
|||||||
@@ -48,12 +48,20 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: SingleChildScrollView(
|
body: Consumer<ServerProvider>(builder: (_, pro, __) {
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
if (pro.servers.isEmpty) {
|
||||||
child: AnimationLimiter(
|
return const Center(
|
||||||
child: Consumer<ServerProvider>(builder: (_, pro, __) {
|
child: Text(
|
||||||
return Column(
|
'There is not server.\nClick the fab to add one.',
|
||||||
children: AnimationConfiguration.toStaggeredList(
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||||
|
child: AnimationLimiter(
|
||||||
|
child: Column(
|
||||||
|
children: AnimationConfiguration.toStaggeredList(
|
||||||
duration: const Duration(milliseconds: 377),
|
duration: const Duration(milliseconds: 377),
|
||||||
childAnimationBuilder: (widget) => SlideAnimation(
|
childAnimationBuilder: (widget) => SlideAnimation(
|
||||||
verticalOffset: 50.0,
|
verticalOffset: 50.0,
|
||||||
@@ -65,9 +73,9 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
const SizedBox(height: 13),
|
const SizedBox(height: 13),
|
||||||
...pro.servers.map((e) => _buildEachServerCard(e))
|
...pro.servers.map((e) => _buildEachServerCard(e))
|
||||||
],
|
],
|
||||||
));
|
))),
|
||||||
})),
|
);
|
||||||
),
|
}),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
AppRoute(const ServerEditPage(), 'Add server info page')
|
AppRoute(const ServerEditPage(), 'Add server info page')
|
||||||
|
|||||||
Reference in New Issue
Block a user