Prepare webdavApi.dart implementation
This commit is contained in:
parent
edd8c1600a
commit
09003439a6
62
.idea/libraries/Dart_Packages.xml
generated
62
.idea/libraries/Dart_Packages.xml
generated
@ -44,6 +44,13 @@
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="asn1lib">
|
||||
<value>
|
||||
<list>
|
||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/asn1lib-1.4.0/lib" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="async">
|
||||
<value>
|
||||
<list>
|
||||
@ -163,6 +170,13 @@
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="cookie_jar">
|
||||
<value>
|
||||
<list>
|
||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/cookie_jar-3.0.1/lib" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="crypto">
|
||||
<value>
|
||||
<list>
|
||||
@ -170,6 +184,13 @@
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="crypton">
|
||||
<value>
|
||||
<list>
|
||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/crypton-2.1.0/lib" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="csslib">
|
||||
<value>
|
||||
<list>
|
||||
@ -191,13 +212,6 @@
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="dio">
|
||||
<value>
|
||||
<list>
|
||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/dio-5.0.0/lib" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="fake_async">
|
||||
<value>
|
||||
<list>
|
||||
@ -429,6 +443,13 @@
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="nextcloud">
|
||||
<value>
|
||||
<list>
|
||||
<option value="$USER_HOME$/.pub-cache/git/nextcloud-neon-f9deebaa06241d11567225d3556ceed80af41140/packages/nextcloud/lib" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="package_config">
|
||||
<value>
|
||||
<list>
|
||||
@ -555,6 +576,13 @@
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="retry">
|
||||
<value>
|
||||
<list>
|
||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/retry-3.1.0/lib" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="shared_preferences">
|
||||
<value>
|
||||
<list>
|
||||
@ -786,6 +814,13 @@
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="version">
|
||||
<value>
|
||||
<list>
|
||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/version-3.0.2/lib" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="watcher">
|
||||
<value>
|
||||
<list>
|
||||
@ -800,10 +835,10 @@
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
<entry key="webdav_client">
|
||||
<entry key="webdav">
|
||||
<value>
|
||||
<list>
|
||||
<option value="$USER_HOME$/.pub-cache/hosted/pub.dev/webdav_client-1.1.9/lib" />
|
||||
<option value="$USER_HOME$/.pub-cache/git/dart-webdav-1a70d3f7236484ed170f688980020b344d729d39//lib" />
|
||||
</list>
|
||||
</value>
|
||||
</entry>
|
||||
@ -838,12 +873,15 @@
|
||||
</option>
|
||||
</properties>
|
||||
<CLASSES>
|
||||
<root url="file://$USER_HOME$/.pub-cache/git/dart-webdav-1a70d3f7236484ed170f688980020b344d729d39//lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/git/nextcloud-neon-f9deebaa06241d11567225d3556ceed80af41140/packages/nextcloud/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/_fe_analyzer_shared-53.0.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/analyzer-5.5.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/another_flushbar-1.12.29/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/another_transformer_page_view-2.0.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/archive-3.3.6/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/args-2.4.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/asn1lib-1.4.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/async-2.10.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/bubble-1.2.1/lib" />
|
||||
@ -861,11 +899,12 @@
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/code_builder-4.4.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/collection-1.17.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/convert-3.1.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/cookie_jar-3.0.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/crypto-3.0.2/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/crypton-2.1.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/csslib-0.17.2/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/dart_style-2.2.4/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/dio-5.0.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/fake_async-1.3.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/ffi-2.0.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/file-6.1.4/lib" />
|
||||
@ -914,6 +953,7 @@
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/pub_semver-2.1.3/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/pubspec_parse-1.2.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/quiver-3.2.1/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/retry-3.1.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/shared_preferences-2.0.17/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/shared_preferences_android-2.0.15/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.1.3/lib" />
|
||||
@ -946,9 +986,9 @@
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.14/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_windows-3.0.3/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/version-3.0.2/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/watcher-1.0.2/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/web_socket_channel-2.3.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/webdav_client-1.1.9/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/win32-3.1.3/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/xdg_directories-1.0.0/lib" />
|
||||
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/xml-6.2.2/lib" />
|
||||
|
@ -0,0 +1,46 @@
|
||||
// import 'package:json_annotation/json_annotation.dart';
|
||||
// import 'package:webdav_client/webdav_client.dart';
|
||||
//
|
||||
// part 'cacheableFile.g.dart';
|
||||
//
|
||||
// @JsonSerializable(explicitToJson: true)
|
||||
// class CacheableFile {
|
||||
// String? path;
|
||||
// bool? isDir;
|
||||
// String? name;
|
||||
// String? mimeType;
|
||||
// int? size;
|
||||
// String? eTag;
|
||||
// DateTime? cTime;
|
||||
// DateTime? mTime;
|
||||
//
|
||||
// CacheableFile(this.path, this.isDir, this.name, this.mimeType, this.size,
|
||||
// this.eTag, this.cTime, this.mTime);
|
||||
//
|
||||
// CacheableFile.fromDavFile(File file) {
|
||||
// path = file.path;
|
||||
// isDir = file.isDir;
|
||||
// name = file.name;
|
||||
// mimeType = file.mimeType;
|
||||
// size = file.size;
|
||||
// eTag = file.eTag;
|
||||
// cTime = file.cTime;
|
||||
// mTime = file.mTime;
|
||||
// }
|
||||
//
|
||||
// File toDavFile() {
|
||||
// return File(
|
||||
// path: path,
|
||||
// isDir: isDir,
|
||||
// name: name,
|
||||
// mimeType: mimeType,
|
||||
// size: size,
|
||||
// eTag: eTag,
|
||||
// cTime: cTime,
|
||||
// mTime: mTime
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// factory CacheableFile.fromJson(Map<String, dynamic> json) => _$CacheableFileFromJson(json);
|
||||
// Map<String, dynamic> toJson() => _$CacheableFileToJson(this);
|
||||
// }
|
@ -0,0 +1,31 @@
|
||||
// // GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
//
|
||||
// part of 'cacheableFile.dart';
|
||||
//
|
||||
// // **************************************************************************
|
||||
// // JsonSerializableGenerator
|
||||
// // **************************************************************************
|
||||
//
|
||||
// CacheableFile _$CacheableFileFromJson(Map<String, dynamic> json) =>
|
||||
// CacheableFile(
|
||||
// json['path'] as String?,
|
||||
// json['isDir'] as bool?,
|
||||
// json['name'] as String?,
|
||||
// json['mimeType'] as String?,
|
||||
// json['size'] as int?,
|
||||
// json['eTag'] as String?,
|
||||
// json['cTime'] == null ? null : DateTime.parse(json['cTime'] as String),
|
||||
// json['mTime'] == null ? null : DateTime.parse(json['mTime'] as String),
|
||||
// );
|
||||
//
|
||||
// Map<String, dynamic> _$CacheableFileToJson(CacheableFile instance) =>
|
||||
// <String, dynamic>{
|
||||
// 'path': instance.path,
|
||||
// 'isDir': instance.isDir,
|
||||
// 'name': instance.name,
|
||||
// 'mimeType': instance.mimeType,
|
||||
// 'size': instance.size,
|
||||
// 'eTag': instance.eTag,
|
||||
// 'cTime': instance.cTime?.toIso8601String(),
|
||||
// 'mTime': instance.mTime?.toIso8601String(),
|
||||
// };
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// import 'package:marianum_mobile/api/apiParams.dart';
|
||||
// import 'package:marianum_mobile/api/apiResponse.dart';
|
||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/cacheableFile.dart';
|
||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesParams.dart';
|
||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/webdavApi.dart';
|
||||
// import 'package:webdav_client/webdav_client.dart';
|
||||
//
|
||||
// class ListFiles extends WebdavApi<ListFilesParams> {
|
||||
// ListFilesParams params;
|
||||
//
|
||||
// ListFiles(this.params) : super(params);
|
||||
//
|
||||
// @override
|
||||
// Future<ListFilesResponse> run() async {
|
||||
// Set<CacheableFile> files = (await (await WebdavApi.webdav).readDir(params.path)).map((e) => CacheableFile.fromDavFile(e)).toSet();
|
||||
//
|
||||
// return ListFilesResponse(files);
|
||||
// }
|
||||
// }
|
@ -0,0 +1,33 @@
|
||||
// import 'dart:convert';
|
||||
// import 'dart:developer';
|
||||
//
|
||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFiles.dart';
|
||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesParams.dart';
|
||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
||||
// import 'package:marianum_mobile/api/requestCache.dart';
|
||||
// import 'package:webdav_client/webdav_client.dart';
|
||||
//
|
||||
// class ListFilesCache extends RequestCache<ListFilesResponse> {
|
||||
// String path;
|
||||
//
|
||||
// ListFilesCache({required onUpdate, required this.path}) : super(RequestCache.cacheNothing, onUpdate) {
|
||||
// String cacheName = path.replaceAll(RegExp("[^A-Za-z0-9]"), "_"); //TODO this is very evil, "/ü/" > "___" also "/ä/" > "___"
|
||||
// log(cacheName);
|
||||
//
|
||||
// start("MarianumMobile", "wd-folder-$cacheName");
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// Future<ListFilesResponse> onLoad() async {
|
||||
// log("Loading remote data");
|
||||
// ListFilesResponse data = await ListFiles(ListFilesParams(path)).run();
|
||||
// return data;
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// ListFilesResponse onLocalData(String json) {
|
||||
// log("Loading local data");
|
||||
// return ListFilesResponse.fromJson(jsonDecode(json));
|
||||
// }
|
||||
//
|
||||
// }
|
@ -0,0 +1,15 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../../../apiParams.dart';
|
||||
|
||||
part 'listFilesParams.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class ListFilesParams extends ApiParams {
|
||||
String path;
|
||||
|
||||
ListFilesParams(this.path);
|
||||
|
||||
factory ListFilesParams.fromJson(Map<String, dynamic> json) => _$ListFilesParamsFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$ListFilesParamsToJson(this);
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'listFilesParams.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
ListFilesParams _$ListFilesParamsFromJson(Map<String, dynamic> json) =>
|
||||
ListFilesParams(
|
||||
json['path'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ListFilesParamsToJson(ListFilesParams instance) =>
|
||||
<String, dynamic>{
|
||||
'path': instance.path,
|
||||
};
|
@ -0,0 +1,16 @@
|
||||
// import 'package:json_annotation/json_annotation.dart';
|
||||
// import 'package:marianum_mobile/api/apiResponse.dart';
|
||||
//
|
||||
// import 'cacheableFile.dart';
|
||||
//
|
||||
// part 'listFilesResponse.g.dart';
|
||||
//
|
||||
// @JsonSerializable(explicitToJson: true)
|
||||
// class ListFilesResponse extends ApiResponse {
|
||||
// Set<CacheableFile> files;
|
||||
//
|
||||
// ListFilesResponse(this.files);
|
||||
//
|
||||
// factory ListFilesResponse.fromJson(Map<String, dynamic> json) => _$ListFilesResponseFromJson(json);
|
||||
// Map<String, dynamic> toJson() => _$ListFilesResponseToJson(this);
|
||||
// }
|
@ -0,0 +1,19 @@
|
||||
// // GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
//
|
||||
// part of 'listFilesResponse.dart';
|
||||
//
|
||||
// // **************************************************************************
|
||||
// // JsonSerializableGenerator
|
||||
// // **************************************************************************
|
||||
//
|
||||
// ListFilesResponse _$ListFilesResponseFromJson(Map<String, dynamic> json) =>
|
||||
// ListFilesResponse(
|
||||
// (json['files'] as List<dynamic>)
|
||||
// .map((e) => CacheableFile.fromJson(e as Map<String, dynamic>))
|
||||
// .toSet(),
|
||||
// );
|
||||
//
|
||||
// Map<String, dynamic> _$ListFilesResponseToJson(ListFilesResponse instance) =>
|
||||
// <String, dynamic>{
|
||||
// 'files': instance.files.map((e) => e.toJson()).toList(),
|
||||
// };
|
31
lib/data/files/filesProps.dart
Normal file
31
lib/data/files/filesProps.dart
Normal file
@ -0,0 +1,31 @@
|
||||
// import 'dart:developer';
|
||||
//
|
||||
// import 'package:marianum_mobile/api/apiResponse.dart';
|
||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesCache.dart';
|
||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
||||
// import 'package:marianum_mobile/data/dataHolder.dart';
|
||||
//
|
||||
// class FilesProps extends DataHolder {
|
||||
//
|
||||
// ListFilesResponse? _listFilesResponse;
|
||||
// ListFilesResponse get listFilesResponse => _listFilesResponse!;
|
||||
//
|
||||
// @override
|
||||
// List<ApiResponse?> properties() {
|
||||
// return [_listFilesResponse];
|
||||
// }
|
||||
//
|
||||
// @override
|
||||
// void run() {
|
||||
// log("Query Cache");
|
||||
// ListFilesCache(
|
||||
// path: "/",
|
||||
// onUpdate: (ListFilesResponse data) => {
|
||||
// log("Got cache response"),
|
||||
// _listFilesResponse = data,
|
||||
// notifyListeners(),
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// }
|
@ -2,6 +2,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:marianum_mobile/data/files/filesProps.dart';
|
||||
import 'package:marianum_mobile/data/timetable/timetableProps.dart';
|
||||
import 'package:marianum_mobile/screen/login/login.dart';
|
||||
import 'package:marianum_mobile/widget/loadingSpinner.dart';
|
||||
@ -38,6 +39,7 @@ Future<void> main() async {
|
||||
ChangeNotifierProvider(create: (context) => TimetableProps()),
|
||||
ChangeNotifierProvider(create: (context) => ChatListProps()),
|
||||
ChangeNotifierProvider(create: (context) => ChatProps()),
|
||||
//ChangeNotifierProvider(create: (context) => FilesProps()),
|
||||
],
|
||||
child: const Main(),
|
||||
)
|
||||
|
@ -1,11 +1,13 @@
|
||||
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesCache.dart';
|
||||
import 'package:marianum_mobile/data/files/filesProps.dart';
|
||||
import 'package:marianum_mobile/widget/loadingPacket.dart';
|
||||
import 'package:nextcloud/nextcloud.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:webdav_client/webdav_client.dart';
|
||||
|
||||
import '../../../dataOld/incommingPackets/fileListPacket.dart';
|
||||
import '../../../widget/loadingSpinner.dart';
|
||||
import 'package:webdav/webdav.dart';
|
||||
|
||||
class Files extends StatefulWidget {
|
||||
const Files({Key? key}) : super(key: key);
|
||||
@ -15,256 +17,110 @@ class Files extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _FilesState extends State<Files> {
|
||||
// List<String> path = List<String>.empty(growable: true);
|
||||
// List<File> files = List<File>.empty(growable: true);
|
||||
//
|
||||
// var client = newClient(
|
||||
// "https://cloud.marianum-fulda.de/remote.php/dav/files/***REMOVED***/",
|
||||
// user: "***REMOVED***",
|
||||
// password: "***REMOVED***",
|
||||
// );
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
Provider.of<FileListPacket>(context, listen: false).invoke();
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
//Provider.of<FilesProps>(context, listen: false).run();
|
||||
});
|
||||
|
||||
super.initState();
|
||||
|
||||
// client.setHeaders(
|
||||
// {
|
||||
// "Authorization": "Bearer",
|
||||
// "User-Agent": "Marianum Fulda/Alpha0.1 (Development build) ; https://mhsl.eu/id.html",
|
||||
// }
|
||||
// );
|
||||
//
|
||||
// path.add("/");
|
||||
// Future.delayed(Duration.zero).then((context) => updatePath());
|
||||
}
|
||||
|
||||
// void homeFolder() {
|
||||
// path.clear();
|
||||
// path.add("/");
|
||||
// updatePath();
|
||||
// }
|
||||
//
|
||||
// void popFolder() {
|
||||
// if(path.length == 1) return;
|
||||
// path.removeLast();
|
||||
// updatePath();
|
||||
// }
|
||||
//
|
||||
// void enterFolder(String sub) {
|
||||
// path.add(sub);
|
||||
// updatePath();
|
||||
// }
|
||||
//
|
||||
// void updatePath() {
|
||||
//
|
||||
// final files = client.readDir(path.join("/"));
|
||||
//
|
||||
// showDialog(
|
||||
// context: context,
|
||||
// barrierDismissible: false,
|
||||
// builder: (BuildContext context) {
|
||||
// return const LoadingSpinner();
|
||||
// }
|
||||
// );
|
||||
//
|
||||
// files.then((value) =>
|
||||
// setState(() {
|
||||
// Navigator.pop(context);
|
||||
// this.files.clear();
|
||||
// this.files = value;
|
||||
// })
|
||||
// );
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// List<Widget> items = List<Widget>.empty(growable: true);
|
||||
//
|
||||
// var counter = 0;
|
||||
// for (final file in files) {
|
||||
// bool isDir = file.isDir ?? false;
|
||||
// String name = file.name ?? "?";
|
||||
//
|
||||
// items.add(ListTile(
|
||||
// title: Text(file.name ?? "?"),
|
||||
// leading: Icon(isDir ? Icons.folder_outlined : Icons.file_copy),
|
||||
// trailing: Icon(isDir ? Icons.arrow_right : null),
|
||||
// onTap: () {
|
||||
// enterFolder(file.name ?? "");
|
||||
// },
|
||||
// onLongPress: () {
|
||||
// setState(() {
|
||||
// items[counter] = ListTile(
|
||||
// title: Text(file.name ?? "?"),
|
||||
// trailing: const Icon(Icons.delete),
|
||||
|
||||
// log("NEW CLIENT");
|
||||
// Client client = newClient(
|
||||
// "https://***REMOVED***:***REMOVED***@cloud.marianum-fulda.de/remote.php/dav/files/***REMOVED***/",
|
||||
// user: "***REMOVED***",
|
||||
// password: "***REMOVED***",
|
||||
// debug: true
|
||||
// );
|
||||
// });
|
||||
// },
|
||||
// ));
|
||||
//
|
||||
// // client.setHeaders(
|
||||
// // {
|
||||
// // "User-Agent": "Marianum Fulda/Alpha0.1 (Development build) ; https://mhsl.eu/id.html",
|
||||
// // }
|
||||
// // );
|
||||
//
|
||||
// log("DATA");
|
||||
// log(client.readDir("/").toString());
|
||||
|
||||
// Future<List<FileInfo>> files = Client("https://cloud.marianum-fulda.de/remote.php/dav/files/***REMOVED***", "***REMOVED***", "***REMOVED***").ls();
|
||||
// log(files.toString());
|
||||
// log("REQUEST FINISH");
|
||||
//
|
||||
// files.then((asd) => {
|
||||
// asd.forEach((element) {
|
||||
// log(element.name);
|
||||
// }),
|
||||
// });
|
||||
|
||||
// var client = NextcloudClient("https://cloud.marianum-fulda.de", username: "***REMOVED***", password: "***REMOVED***");
|
||||
//
|
||||
// //client.baseHeaders.putIfAbsent("Authorization", () => "Basic ***REMOVED***");
|
||||
// //client.authentication?.headers.putIfAbsent("Authorization", () => "Basic ***REMOVED***");
|
||||
// //client.webdav.rootClient.baseHeaders.putIfAbsent("Authorization", () => "Basic ***REMOVED***");
|
||||
//
|
||||
// client.webdav.ls("/").then((value) => () {
|
||||
// log("TEST");
|
||||
// value.forEach((element) {
|
||||
// log(element.name);
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
return const Center(
|
||||
child: Text("Currently not implemented!"),
|
||||
);
|
||||
|
||||
// return Consumer<FilesProps>(
|
||||
// builder: (context, data, child) {
|
||||
//
|
||||
// if(data.primaryLoading()) {
|
||||
// return const Center(child: CircularProgressIndicator());
|
||||
// }
|
||||
//
|
||||
// items.insert(0, AppBar(
|
||||
// leading: path.length == 1 ? null : IconButton(
|
||||
// icon: const Icon(Icons.keyboard_arrow_left),
|
||||
// onPressed: () {
|
||||
// popFolder();
|
||||
// },
|
||||
// ),
|
||||
// actions: [
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.home),
|
||||
// onPressed: () {
|
||||
// homeFolder();
|
||||
// },
|
||||
// ),
|
||||
// List<ListTile> entries = List<ListTile>.empty(growable: true);
|
||||
//
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.refresh),
|
||||
// onPressed: () {
|
||||
// updatePath();
|
||||
// data.listFilesResponse.files.forEach((element) {
|
||||
// entries.add(ListTile(
|
||||
// title: Text(element.name ?? "?"),
|
||||
// leading: Icon(element.isDir ?? false ? Icons.folder : Icons.file_copy_outlined),
|
||||
// onTap: () {
|
||||
// if(element.isDir ?? false) {
|
||||
// // TODO: Open Folder
|
||||
// } else {
|
||||
// // TODO: Open an File
|
||||
// }
|
||||
// },
|
||||
//
|
||||
// onLongPress: () {
|
||||
// showModalBottomSheet<void>(
|
||||
// context: context,
|
||||
// builder: (context) {
|
||||
// return ListView(
|
||||
// children: [
|
||||
// ListTile(
|
||||
// leading: const Icon(Icons.delete),
|
||||
// title: Text("'${element.name?.replaceRange(20, element.name?.length, " ...")}' Löschen"),
|
||||
// ),
|
||||
// const ListTile(
|
||||
// leading: Icon(Icons.share),
|
||||
// title: Text("Teilen"),
|
||||
// )
|
||||
// ],
|
||||
//
|
||||
// title: Text(path.length == 1 ? "Dateien" : path.last),
|
||||
// ));
|
||||
//
|
||||
// return ListView(
|
||||
// children: items,
|
||||
// );
|
||||
|
||||
return Consumer<FileListPacket>(
|
||||
builder: (context, data, child) {
|
||||
List<ListTile> entries = List<ListTile>.empty(growable: true);
|
||||
|
||||
data.entries.forEach((element) {
|
||||
entries.add(ListTile(
|
||||
title: Text(element.name),
|
||||
leading: Icon(element.isFolder ? Icons.folder : Icons.file_copy_outlined),
|
||||
onTap: () {
|
||||
if(element.isFolder) {
|
||||
Provider.of<FileListPacket>(context, listen: false).invoke(
|
||||
data: {
|
||||
"path": element.path
|
||||
},
|
||||
indicateLoading: true,
|
||||
);
|
||||
} else {
|
||||
// TODO: Open an File
|
||||
}
|
||||
},
|
||||
|
||||
onLongPress: () {
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return ListView(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Icon(Icons.delete),
|
||||
title: Text("'${element.name.replaceRange(20, element.name.length, " ...")}' Löschen"),
|
||||
),
|
||||
const ListTile(
|
||||
leading: Icon(Icons.share),
|
||||
title: Text("Teilen"),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
));
|
||||
});
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_outlined),
|
||||
onPressed: () {
|
||||
Provider.of<FileListPacket>(context, listen: false).invoke(
|
||||
data: {
|
||||
"path": data.lastPath
|
||||
},
|
||||
indicateLoading: true,
|
||||
);
|
||||
}
|
||||
),
|
||||
|
||||
title: Text(data.lastPath),
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Provider.of<FileListPacket>(context, listen: false).invoke(indicateLoading: true);
|
||||
},
|
||||
icon: const Icon(Icons.home)
|
||||
),
|
||||
PopupMenuButton(
|
||||
icon: Icon(Icons.add),
|
||||
itemBuilder: (context) {
|
||||
return [
|
||||
const PopupMenuItem<int>(
|
||||
value: 0,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.folder),
|
||||
title: Text("Ordner erstellen"),
|
||||
),
|
||||
),
|
||||
const PopupMenuItem<int>(
|
||||
value: 1,
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.upload),
|
||||
title: Text("Datei Hochladen"),
|
||||
),
|
||||
)
|
||||
];
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
floatingActionButton: FloatingActionButton.small(
|
||||
onPressed: () {
|
||||
showModalBottomSheet(
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (context) {
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height * 0.3,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(25.0),
|
||||
topRight: Radius.circular(25.0),
|
||||
)
|
||||
),
|
||||
child: ListView(
|
||||
children: const [
|
||||
ListTile(
|
||||
leading: Icon(Icons.create_new_folder_sharp),
|
||||
title: Text("Neuer Ordner"),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.upload),
|
||||
title: Text("Hochladen"),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
|
||||
body: LoadingPacket(packet: data, child: ListView(children: entries)),
|
||||
);
|
||||
},
|
||||
);
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// ));
|
||||
// });
|
||||
//
|
||||
// return ListView(children: entries);
|
||||
// },
|
||||
// );
|
||||
}
|
||||
}
|
||||
|
13
pubspec.yaml
13
pubspec.yaml
@ -40,7 +40,6 @@ dependencies:
|
||||
flutter_login: ^4.1.0
|
||||
bubble: ^1.2.1
|
||||
http: ^0.13.5
|
||||
webdav_client: ^1.1.8
|
||||
shared_preferences: ^2.0.15
|
||||
provider: ^6.0.4
|
||||
web_socket_channel: ^2.2.0
|
||||
@ -49,6 +48,18 @@ dependencies:
|
||||
json_annotation: ^4.8.0
|
||||
localstore: ^1.2.3
|
||||
intl: ^0.17.0
|
||||
webdav: #^1.0.9
|
||||
git:
|
||||
url: https://github.com/timestee/dart-webdav.git
|
||||
ref: 1a70d3f7236484ed170f688980020b344d729d39
|
||||
nextcloud:
|
||||
git:
|
||||
url: https://github.com/provokateurin/nextcloud-neon
|
||||
path: packages/nextcloud
|
||||
|
||||
dependency_overrides:
|
||||
xml: ^6.2.2
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Loading…
x
Reference in New Issue
Block a user