Implement Webuntis HTTP Api and Display
This commit is contained in:
29
lib/dataOld/incommingPackets/fileListPacket.dart
Normal file
29
lib/dataOld/incommingPackets/fileListPacket.dart
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
import '../incomingPacket.dart';
|
||||
|
||||
class FileEntry {
|
||||
String name;
|
||||
bool isFolder;
|
||||
String path;
|
||||
|
||||
FileEntry(this.name, this.isFolder, this.path);
|
||||
}
|
||||
|
||||
class FileListPacket extends IncomingPacket {
|
||||
FileListPacket() : super("fileList");
|
||||
|
||||
List<FileEntry> _entries = List<FileEntry>.empty(growable: true);
|
||||
List<FileEntry> get entries => _entries;
|
||||
|
||||
String _lastPath = "/";
|
||||
String get lastPath => _lastPath;
|
||||
|
||||
@override
|
||||
void handle(data) {
|
||||
_entries = List<FileEntry>.empty(growable: true);
|
||||
_lastPath = data['backLink'];
|
||||
data['files'].forEach((value) => {
|
||||
_entries.add(FileEntry(value['name'], value['is_folder'], value['path']))
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user