new: iperf

This commit is contained in:
lollipopkit
2024-01-21 18:53:17 +08:00
parent 50d6ed919b
commit 1434556e0b
34 changed files with 432 additions and 117 deletions

View File

@@ -1,30 +1,44 @@
import 'package:flutter/material.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:toolbox/core/extension/context/locale.dart';
enum ServerTabMenu {
part 'server_func.g.dart';
@HiveType(typeId: 6)
enum ServerFuncBtn {
@HiveField(0)
terminal,
@HiveField(1)
sftp,
@HiveField(2)
container,
@HiveField(3)
process,
@HiveField(4)
pkg,
@HiveField(5)
snippet,
@HiveField(6)
iperf,
;
IconData get icon => switch (this) {
ServerTabMenu.sftp => Icons.insert_drive_file,
ServerTabMenu.snippet => Icons.code,
ServerTabMenu.pkg => Icons.system_security_update,
ServerTabMenu.container => Icons.view_agenda,
ServerTabMenu.process => Icons.list_alt_outlined,
ServerTabMenu.terminal => Icons.terminal,
};
sftp => Icons.insert_drive_file,
snippet => Icons.code,
pkg => Icons.system_security_update,
container => Icons.view_agenda,
process => Icons.list_alt_outlined,
terminal => Icons.terminal,
iperf => Icons.speed,
};
String get toStr => switch (this) {
ServerTabMenu.sftp => 'SFTP',
ServerTabMenu.snippet => l10n.snippet,
ServerTabMenu.pkg => l10n.pkg,
ServerTabMenu.container => l10n.container,
ServerTabMenu.process => l10n.process,
ServerTabMenu.terminal => l10n.terminal,
};
}
sftp => 'SFTP',
snippet => l10n.snippet,
pkg => l10n.pkg,
container => l10n.container,
process => l10n.process,
terminal => l10n.terminal,
iperf => 'iperf',
};
}

View File

@@ -0,0 +1,71 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'server_func.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class ServerFuncBtnAdapter extends TypeAdapter<ServerFuncBtn> {
@override
final int typeId = 6;
@override
ServerFuncBtn read(BinaryReader reader) {
switch (reader.readByte()) {
case 0:
return ServerFuncBtn.terminal;
case 1:
return ServerFuncBtn.sftp;
case 2:
return ServerFuncBtn.container;
case 3:
return ServerFuncBtn.process;
case 4:
return ServerFuncBtn.pkg;
case 5:
return ServerFuncBtn.snippet;
case 6:
return ServerFuncBtn.iperf;
default:
return ServerFuncBtn.terminal;
}
}
@override
void write(BinaryWriter writer, ServerFuncBtn obj) {
switch (obj) {
case ServerFuncBtn.terminal:
writer.writeByte(0);
break;
case ServerFuncBtn.sftp:
writer.writeByte(1);
break;
case ServerFuncBtn.container:
writer.writeByte(2);
break;
case ServerFuncBtn.process:
writer.writeByte(3);
break;
case ServerFuncBtn.pkg:
writer.writeByte(4);
break;
case ServerFuncBtn.snippet:
writer.writeByte(5);
break;
case ServerFuncBtn.iperf:
writer.writeByte(6);
break;
}
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is ServerFuncBtnAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}