127 lines
3.9 KiB
Dart
127 lines
3.9 KiB
Dart
|
|
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/webdav.dart';
|
|
|
|
class Files extends StatefulWidget {
|
|
const Files({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<Files> createState() => _FilesState();
|
|
}
|
|
|
|
class _FilesState extends State<Files> {
|
|
|
|
@override
|
|
void initState() {
|
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
|
//Provider.of<FilesProps>(context, listen: false).run();
|
|
});
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
|
|
// 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());
|
|
// }
|
|
//
|
|
// List<ListTile> entries = List<ListTile>.empty(growable: true);
|
|
//
|
|
// 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"),
|
|
// )
|
|
// ],
|
|
// );
|
|
// },
|
|
// );
|
|
// },
|
|
// ));
|
|
// });
|
|
//
|
|
// return ListView(children: entries);
|
|
// },
|
|
// );
|
|
}
|
|
}
|