Refactor codebase resolving warnings and remove self-package imports
This commit is contained in:
185
lib/view/pages/files/fileElement.dart
Normal file
185
lib/view/pages/files/fileElement.dart
Normal file
@ -0,0 +1,185 @@
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:better_open_file/better_open_file.dart';
|
||||
import 'package:filesize/filesize.dart';
|
||||
import 'package:flowder/flowder.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
||||
import '../../../api/marianumcloud/webdav/queries/listFiles/cacheableFile.dart';
|
||||
import '../../../api/marianumcloud/webdav/webdavApi.dart';
|
||||
import '../../../widget/confirmDialog.dart';
|
||||
import '../../../widget/unimplementedDialog.dart';
|
||||
import 'files.dart';
|
||||
|
||||
class FileElement extends StatefulWidget {
|
||||
final CacheableFile file;
|
||||
final List<String> path;
|
||||
final void Function() refetch;
|
||||
const FileElement(this.file, this.path, this.refetch, {Key? key}) : super(key: key);
|
||||
|
||||
static Future<DownloaderCore> download(String remotePath, String name, Function(double) onProgress, Function(OpenResult) onDone) async {
|
||||
Directory paths = await getApplicationDocumentsDirectory();
|
||||
|
||||
String local = paths.path + Platform.pathSeparator + name;
|
||||
|
||||
DownloaderUtils options = DownloaderUtils(
|
||||
progressCallback: (current, total) {
|
||||
final progress = (current / total) * 100;
|
||||
onProgress(progress);
|
||||
},
|
||||
file: File(local),
|
||||
progress: ProgressImplementation(),
|
||||
deleteOnCancel: true,
|
||||
onDone: () {
|
||||
Future<OpenResult> result = OpenFile.open(local);
|
||||
|
||||
result.then((value) => {
|
||||
onDone(value)
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
return await Flowder.download(
|
||||
"${await WebdavApi.webdavConnectString}$remotePath",
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
State<FileElement> createState() => _FileElementState();
|
||||
}
|
||||
|
||||
class _FileElementState extends State<FileElement> {
|
||||
double percent = 0;
|
||||
Future<DownloaderCore>? downloadCore;
|
||||
|
||||
Widget getSubtitle() {
|
||||
if(widget.file.currentlyDownloading) {
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(right: 10),
|
||||
child: const Text("Download:"),
|
||||
),
|
||||
Expanded(
|
||||
child: LinearProgressIndicator(value: percent/100),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(left: 10),
|
||||
child: Text("${percent.round()}%"),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return widget.file.isDirectory ? Text("geändert ${Jiffy.parseFromDateTime(widget.file.modifiedAt ?? DateTime.now()).fromNow()}") : Text("${filesize(widget.file.size)}, ${Jiffy.parseFromDateTime(widget.file.modifiedAt ?? DateTime.now()).fromNow()}");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [Icon(widget.file.isDirectory ? Icons.folder_outlined : Icons.description_outlined)],
|
||||
),
|
||||
title: Text(widget.file.name),
|
||||
subtitle: getSubtitle(),
|
||||
trailing: Icon(widget.file.isDirectory ? Icons.arrow_right : null),
|
||||
onTap: () {
|
||||
if(widget.file.isDirectory) {
|
||||
Navigator.of(context).push(MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return Files(widget.path.toList()..add(widget.file.name));
|
||||
},
|
||||
));
|
||||
} else {
|
||||
if(widget.file.currentlyDownloading) {
|
||||
showDialog(context: context, builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text("Download abbrechen?"),
|
||||
content: const Text("Möchtest du den Download abbrechen?"),
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}, child: const Text("Nein")),
|
||||
TextButton(onPressed: () {
|
||||
downloadCore?.then((value) {
|
||||
if(!value.isCancelled) value.cancel();
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
setState(() {
|
||||
widget.file.currentlyDownloading = false;
|
||||
percent = 0;
|
||||
downloadCore = null;
|
||||
});
|
||||
}, child: const Text("Ja, Abbrechen"))
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() {
|
||||
widget.file.currentlyDownloading = true;
|
||||
});
|
||||
|
||||
log("Download: ${widget.file.path} to ${widget.file.name}");
|
||||
|
||||
downloadCore = FileElement.download(widget.file.path, widget.file.name, (progress) {
|
||||
setState(() => percent = progress);
|
||||
}, (result) {
|
||||
if(result.type != ResultType.done) {
|
||||
showDialog(context: context, builder: (context) {
|
||||
return AlertDialog(
|
||||
title: const Text("Download"),
|
||||
content: Text(result.message),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
setState(() {
|
||||
widget.file.currentlyDownloading = false;
|
||||
percent = 0;
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
onLongPress: () {
|
||||
showDialog(context: context, builder: (context) {
|
||||
return SimpleDialog(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.delete_outline),
|
||||
title: const Text("Löschen"),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
showDialog(context: context, builder: (context) => ConfirmDialog(
|
||||
title: "Element löschen?",
|
||||
content: "Das Element wird unwiederruflich gelöscht.",
|
||||
onConfirm: () {
|
||||
WebdavApi.webdav
|
||||
.then((value) => value.delete(widget.file.path))
|
||||
.then((value) => widget.refetch());
|
||||
}
|
||||
));
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.share_outlined),
|
||||
title: const Text("Teilen"),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
UnimplementedDialog.show(context);
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
227
lib/view/pages/files/fileUploadDialog.dart
Normal file
227
lib/view/pages/files/fileUploadDialog.dart
Normal file
@ -0,0 +1,227 @@
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:async/async.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:nextcloud/nextcloud.dart';
|
||||
|
||||
import '../../../api/marianumcloud/webdav/webdavApi.dart';
|
||||
|
||||
class FileUploadDialog extends StatefulWidget {
|
||||
final String localPath;
|
||||
final List<String> remotePath;
|
||||
final String fileName;
|
||||
final void Function() triggerReload;
|
||||
const FileUploadDialog({Key? key, required this.localPath, required this.remotePath, required this.fileName, required this.triggerReload}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<FileUploadDialog> createState() => _FileUploadDialogState();
|
||||
}
|
||||
|
||||
class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
FileUploadState state = FileUploadState.naming;
|
||||
CancelableOperation? cancelableOperation;
|
||||
late String targetFileName;
|
||||
late String remoteFolderName;
|
||||
late String fullRemotePath = "${widget.remotePath.join("/")}/$targetFileName";
|
||||
String? lastError;
|
||||
|
||||
TextEditingController fileNameController = TextEditingController();
|
||||
|
||||
|
||||
void upload({bool override = false}) async {
|
||||
setState(() {
|
||||
state = FileUploadState.upload;
|
||||
});
|
||||
|
||||
WebDavClient webdavClient = await WebdavApi.webdav;
|
||||
|
||||
if(!override) {
|
||||
setState(() {
|
||||
state = FileUploadState.checkConflict;
|
||||
});
|
||||
List<WebDavResponse> result = (await webdavClient.ls(widget.remotePath.join("/"))).responses;
|
||||
if(result.any((element) => element.href!.endsWith("/$targetFileName"))) {
|
||||
setState(() {
|
||||
state = FileUploadState.conflict;
|
||||
});
|
||||
return;
|
||||
} else {
|
||||
setState(() {
|
||||
state = FileUploadState.upload;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<HttpClientResponse> uploadTask = webdavClient.upload(File(widget.localPath).readAsBytesSync(), fullRemotePath);
|
||||
uploadTask.then((value) => Future<HttpClientResponse?>.value(value)).catchError((e) {
|
||||
setState(() {
|
||||
state = FileUploadState.error;
|
||||
});
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
cancelableOperation = CancelableOperation<HttpClientResponse>.fromFuture(
|
||||
uploadTask,
|
||||
onCancel: () => log("Upload cancelled"),
|
||||
);
|
||||
|
||||
cancelableOperation!.then((value) {
|
||||
log("Upload done!");
|
||||
setState(() {
|
||||
state = FileUploadState.done;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void cancel() {
|
||||
cancelableOperation?.cancel();
|
||||
setState(() {
|
||||
state = FileUploadState.naming;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
targetFileName = widget.fileName;
|
||||
remoteFolderName = widget.remotePath.isNotEmpty ? widget.remotePath.last : "/";
|
||||
fileNameController.text = widget.fileName;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if(state == FileUploadState.naming) {
|
||||
return AlertDialog(
|
||||
title: const Text("Datei hochladen"),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
controller: fileNameController,
|
||||
onChanged: (input) {
|
||||
targetFileName = input;
|
||||
},
|
||||
autocorrect: false,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Dateiname",
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}, child: const Text("Abbrechen")),
|
||||
TextButton(onPressed: () async {
|
||||
upload();
|
||||
}, child: const Text("Hochladen")),
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
if(state == FileUploadState.conflict) {
|
||||
return AlertDialog(
|
||||
icon: const Icon(Icons.error_outline),
|
||||
title: const Text("Datei konflikt"),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text("Es gibt bereits eine Datei mit dem Namen $targetFileName in dem ausgewählten Ordner '$remoteFolderName'", textAlign: TextAlign.center),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
setState(() {
|
||||
state = FileUploadState.naming;
|
||||
});
|
||||
}, child: const Text("Datei umbenennen")),
|
||||
TextButton(onPressed: () {
|
||||
upload(override: true);
|
||||
}, child: const Text("Datei überschreiben")),
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
if(state == FileUploadState.upload || state == FileUploadState.checkConflict) {
|
||||
return AlertDialog(
|
||||
icon: const Icon(Icons.upload),
|
||||
title: const Text("Hochladen"),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Visibility(
|
||||
visible: state == FileUploadState.upload,
|
||||
replacement: const Text("Prüfe auf dateikonflikte..."),
|
||||
child: const Text("Upload läuft!\nDies kann je nach Dateigröße einige Zeit dauern...", textAlign: TextAlign.center),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
const CircularProgressIndicator()
|
||||
],
|
||||
),
|
||||
actions: const [
|
||||
// TODO implement working upload cancelling
|
||||
// TextButton(onPressed: () {
|
||||
// cancel();
|
||||
// }, child: const Text("Abbrechen")),
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
if(state == FileUploadState.done) {
|
||||
widget.triggerReload();
|
||||
return AlertDialog(
|
||||
icon: const Icon(Icons.upload),
|
||||
title: const Text("Upload fertig"),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text("Die Datei wurde erfolgreich nach '$remoteFolderName' hochgeladen!", textAlign: TextAlign.center),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}, child: const Text("Fertig")),
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
if(state == FileUploadState.error) {
|
||||
return AlertDialog(
|
||||
icon: const Icon(Icons.error_outline),
|
||||
title: const Text("Fehler"),
|
||||
content: const Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text("Es ist ein Fehler aufgetreten!", textAlign: TextAlign.center),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}, child: const Text("Schlißen")),
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
throw UnimplementedError("Invalid state");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
enum FileUploadState {
|
||||
naming,
|
||||
checkConflict,
|
||||
conflict,
|
||||
upload,
|
||||
done,
|
||||
error
|
||||
}
|
247
lib/view/pages/files/files.dart
Normal file
247
lib/view/pages/files/files.dart
Normal file
@ -0,0 +1,247 @@
|
||||
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:loader_overlay/loader_overlay.dart';
|
||||
|
||||
import '../../../api/marianumcloud/webdav/queries/listFiles/cacheableFile.dart';
|
||||
import '../../../api/marianumcloud/webdav/queries/listFiles/listFilesCache.dart';
|
||||
import '../../../api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
||||
import '../../../api/marianumcloud/webdav/webdavApi.dart';
|
||||
import '../../../model/files/filesProps.dart';
|
||||
import '../../../widget/errorView.dart';
|
||||
import '../../../widget/filePick.dart';
|
||||
import 'fileUploadDialog.dart';
|
||||
import 'fileElement.dart';
|
||||
|
||||
class Files extends StatefulWidget {
|
||||
final List<String> path;
|
||||
const Files(this.path, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<Files> createState() => _FilesState();
|
||||
}
|
||||
|
||||
class BetterSortOption {
|
||||
String displayName;
|
||||
int Function(CacheableFile, CacheableFile) compare;
|
||||
IconData icon;
|
||||
|
||||
BetterSortOption({required this.displayName, required this.icon, required this.compare});
|
||||
}
|
||||
|
||||
enum SortOption {
|
||||
name,
|
||||
date,
|
||||
size
|
||||
}
|
||||
|
||||
class SortOptions {
|
||||
static Map<SortOption, BetterSortOption> options = {
|
||||
SortOption.name: BetterSortOption(
|
||||
displayName: "Name",
|
||||
icon: Icons.sort_by_alpha_outlined,
|
||||
compare: (CacheableFile a, CacheableFile b) => a.name.compareTo(b.name)
|
||||
),
|
||||
SortOption.date: BetterSortOption(
|
||||
displayName: "Datum",
|
||||
icon: Icons.history_outlined,
|
||||
compare: (CacheableFile a, CacheableFile b) => a.modifiedAt!.compareTo(b.modifiedAt!)
|
||||
),
|
||||
SortOption.size: BetterSortOption(
|
||||
displayName: "Größe",
|
||||
icon: Icons.sd_card_outlined,
|
||||
compare: (CacheableFile a, CacheableFile b) {
|
||||
if(a.isDirectory || b.isDirectory) return a.isDirectory ? 1 : 0;
|
||||
if(a.size == null) return 0;
|
||||
if(b.size == null) return 1;
|
||||
return a.size!.compareTo(b.size!);
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
static BetterSortOption getOption(SortOption option) {
|
||||
return options[option]!;
|
||||
}
|
||||
}
|
||||
|
||||
class _FilesState extends State<Files> {
|
||||
FilesProps props = FilesProps();
|
||||
ListFilesResponse? data;
|
||||
|
||||
SortOption currentSort = SortOption.name;
|
||||
bool currentSortDirection = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_query();
|
||||
}
|
||||
|
||||
void _query() {
|
||||
ListFilesCache(
|
||||
path: widget.path.isEmpty ? "/" : widget.path.join("/"),
|
||||
onUpdate: (ListFilesResponse d) {
|
||||
if(!context.mounted) return; // prevent setState when widget is possibly already disposed
|
||||
setState(() {
|
||||
data = d;
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<CacheableFile> files = (data?.files.toList() ?? List.empty())..sort(SortOptions.getOption(currentSort).compare);
|
||||
if(currentSortDirection) files = files.reversed.toList();
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(widget.path.isNotEmpty ? widget.path.last : "Dateien"),
|
||||
actions: [
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.search),
|
||||
// onPressed: () => {
|
||||
// // TODO implement search
|
||||
// },
|
||||
// ),
|
||||
PopupMenuButton<bool>(
|
||||
icon: Icon(currentSortDirection ? Icons.text_rotate_up : Icons.text_rotation_down),
|
||||
itemBuilder: (context) {
|
||||
return [true, false].map((e) => PopupMenuItem<bool>(
|
||||
value: e,
|
||||
enabled: e != currentSortDirection,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(e ? Icons.text_rotate_up : Icons.text_rotation_down, color: Colors.black),
|
||||
const SizedBox(width: 15),
|
||||
Text(e ? "Aufsteigend" : "Absteigend")
|
||||
],
|
||||
)
|
||||
)).toList();
|
||||
},
|
||||
onSelected: (e) {
|
||||
setState(() {
|
||||
currentSortDirection = e;
|
||||
});
|
||||
},
|
||||
),
|
||||
PopupMenuButton<SortOption>(
|
||||
icon: const Icon(Icons.sort),
|
||||
itemBuilder: (context) {
|
||||
return SortOptions.options.keys.map((key) => PopupMenuItem<SortOption>(
|
||||
value: key,
|
||||
enabled: key != currentSort,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(SortOptions.getOption(key).icon, color: Colors.black),
|
||||
const SizedBox(width: 15),
|
||||
Text(SortOptions.getOption(key).displayName)
|
||||
],
|
||||
)
|
||||
)).toList();
|
||||
},
|
||||
onSelected: (e) {
|
||||
setState(() {
|
||||
currentSort = e;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
backgroundColor: Theme.of(context).primaryColor,
|
||||
onPressed: () {
|
||||
showDialog(context: context, builder: (context) {
|
||||
return SimpleDialog(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.create_new_folder_outlined),
|
||||
title: const Text("Ordner erstellen"),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
showDialog(context: context, builder: (context) {
|
||||
var inputController = TextEditingController();
|
||||
return AlertDialog(
|
||||
title: const Text("Neuer Ordner"),
|
||||
content: TextField(
|
||||
controller: inputController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Name",
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}, child: const Text("Abbrechen")),
|
||||
TextButton(onPressed: () {
|
||||
WebdavApi.webdav.then((webdav) {
|
||||
webdav.mkdirs("${widget.path.join("/")}/${inputController.text}").then((value) => _query());
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
}, child: const Text("Ordner erstellen")),
|
||||
],
|
||||
);
|
||||
});
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.upload_file),
|
||||
title: const Text("Aus Dateien hochladen"),
|
||||
onTap: () {
|
||||
context.loaderOverlay.show();
|
||||
FilePick.documentPick().then((value) {
|
||||
log(value ?? "?");
|
||||
mediaUpload(value);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.add_a_photo_outlined),
|
||||
title: const Text("Aus Gallerie hochladen"),
|
||||
onTap: () {
|
||||
context.loaderOverlay.show();
|
||||
FilePick.galleryPick().then((value) {
|
||||
log(value?.path ?? "?");
|
||||
mediaUpload(value?.path);
|
||||
});
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
},
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
body: data == null ? const Center(child: CircularProgressIndicator()) : data!.files.isEmpty ? const ErrorView(icon: Icons.folder_off_rounded, text: "Der Ordner ist leer") : LoaderOverlay(
|
||||
child: RefreshIndicator(
|
||||
onRefresh: () {
|
||||
_query();
|
||||
return Future.delayed(const Duration(seconds: 3));
|
||||
},
|
||||
child: ListView.builder(
|
||||
itemCount: files.length,
|
||||
itemBuilder: (context, index) {
|
||||
CacheableFile file = files.toList()[index];
|
||||
return FileElement(file, widget.path, _query);
|
||||
},
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void mediaUpload(String? path) async {
|
||||
context.loaderOverlay.hide();
|
||||
|
||||
if(path == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var fileName = path.split(Platform.pathSeparator).last;
|
||||
showDialog(context: context, builder: (context) => FileUploadDialog(localPath: path, remotePath: widget.path, fileName: fileName, triggerReload: () => _query()), barrierDismissible: false);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user