updated project linter-rules and enforced them
This commit is contained in:
@@ -43,8 +43,8 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
setState(() {
|
||||
state = FileUploadState.checkConflict;
|
||||
});
|
||||
List<WebDavResponse> result = (await webdavClient.propfind(PathUri.parse(widget.remotePath.join("/")))).responses;
|
||||
if(result.any((element) => element.href!.endsWith("/$targetFileName"))) {
|
||||
List<WebDavResponse> result = (await webdavClient.propfind(PathUri.parse(widget.remotePath.join('/')))).responses;
|
||||
if(result.any((element) => element.href!.endsWith('/$targetFileName'))) {
|
||||
setState(() {
|
||||
state = FileUploadState.conflict;
|
||||
});
|
||||
@@ -57,7 +57,7 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
}
|
||||
|
||||
Future<HttpClientResponse> uploadTask = webdavClient.putFile(File(widget.localPath), FileStat.statSync(widget.localPath), PathUri.parse(fullRemotePath)); // TODO use onProgress from putFile
|
||||
uploadTask.then((value) => Future<HttpClientResponse?>.value(value)).catchError((e) {
|
||||
uploadTask.then(Future<HttpClientResponse?>.value).catchError((e) {
|
||||
setState(() {
|
||||
state = FileUploadState.error;
|
||||
});
|
||||
@@ -67,7 +67,7 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
|
||||
cancelableOperation = CancelableOperation<HttpClientResponse>.fromFuture(
|
||||
uploadTask,
|
||||
onCancel: () => log("Upload cancelled"),
|
||||
onCancel: () => log('Upload cancelled'),
|
||||
);
|
||||
|
||||
cancelableOperation!.then((value) {
|
||||
@@ -88,7 +88,7 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
targetFileName = widget.fileName;
|
||||
remoteFolderName = widget.remotePath.isNotEmpty ? widget.remotePath.last : "/";
|
||||
remoteFolderName = widget.remotePath.isNotEmpty ? widget.remotePath.last : '/';
|
||||
fileNameController.text = widget.fileName;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
Widget build(BuildContext context) {
|
||||
if(state == FileUploadState.naming) {
|
||||
return AlertDialog(
|
||||
title: const Text("Datei hochladen"),
|
||||
title: const Text('Datei hochladen'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -107,7 +107,7 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
},
|
||||
autocorrect: false,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "Dateiname",
|
||||
labelText: 'Dateiname',
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -115,10 +115,10 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}, child: const Text("Abbrechen")),
|
||||
}, child: const Text('Abbrechen')),
|
||||
TextButton(onPressed: () async {
|
||||
upload();
|
||||
}, child: const Text("Hochladen")),
|
||||
}, child: const Text('Hochladen')),
|
||||
],
|
||||
|
||||
);
|
||||
@@ -127,7 +127,7 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
if(state == FileUploadState.conflict) {
|
||||
return AlertDialog(
|
||||
icon: const Icon(Icons.error_outline),
|
||||
title: const Text("Datei konflikt"),
|
||||
title: const Text('Datei konflikt'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -139,10 +139,10 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
setState(() {
|
||||
state = FileUploadState.naming;
|
||||
});
|
||||
}, child: const Text("Datei umbenennen")),
|
||||
}, child: const Text('Datei umbenennen')),
|
||||
TextButton(onPressed: () {
|
||||
upload(override: true);
|
||||
}, child: const Text("Datei überschreiben")),
|
||||
}, child: const Text('Datei überschreiben')),
|
||||
],
|
||||
|
||||
);
|
||||
@@ -151,15 +151,15 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
if(state == FileUploadState.upload || state == FileUploadState.checkConflict) {
|
||||
return AlertDialog(
|
||||
icon: const Icon(Icons.upload),
|
||||
title: const Text("Hochladen"),
|
||||
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),
|
||||
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()
|
||||
@@ -183,7 +183,7 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
}
|
||||
return AlertDialog(
|
||||
icon: const Icon(Icons.done),
|
||||
title: const Text("Upload fertig"),
|
||||
title: const Text('Upload fertig'),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -193,7 +193,7 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}, child: const Text("Fertig")),
|
||||
}, child: const Text('Fertig')),
|
||||
],
|
||||
|
||||
);
|
||||
@@ -202,23 +202,23 @@ class _FileUploadDialogState extends State<FileUploadDialog> {
|
||||
if(state == FileUploadState.error) {
|
||||
return AlertDialog(
|
||||
icon: const Icon(Icons.error_outline),
|
||||
title: const Text("Fehler"),
|
||||
title: const Text('Fehler'),
|
||||
content: const Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text("Es ist ein Fehler aufgetreten!", textAlign: TextAlign.center),
|
||||
Text('Es ist ein Fehler aufgetreten!', textAlign: TextAlign.center),
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}, child: const Text("Schlißen")),
|
||||
}, child: const Text('Schlißen')),
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
throw UnimplementedError("Invalid state");
|
||||
throw UnimplementedError('Invalid state');
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user