dart format
This commit is contained in:
@@ -138,11 +138,17 @@ class _FileElementState extends State<FileElement> {
|
||||
|
||||
void _onTap() {
|
||||
if (widget.file.isDirectory) {
|
||||
AppRoutes.openFolder(context, widget.path.toList()..add(widget.file.name));
|
||||
AppRoutes.openFolder(
|
||||
context,
|
||||
widget.path.toList()..add(widget.file.name),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (EndpointData().getEndpointMode() == EndpointMode.stage) {
|
||||
InfoDialog.show(context, 'Virtuelle Dateien im Staging Prozess können nicht heruntergeladen werden!');
|
||||
InfoDialog.show(
|
||||
context,
|
||||
'Virtuelle Dateien im Staging Prozess können nicht heruntergeladen werden!',
|
||||
);
|
||||
return;
|
||||
}
|
||||
final status = _job?.status.value;
|
||||
@@ -178,21 +184,34 @@ class _FileElementState extends State<FileElement> {
|
||||
autofocus: true,
|
||||
),
|
||||
actions: [
|
||||
TextButton(onPressed: () => Navigator.of(dialogCtx).pop(), child: const Text('Abbrechen')),
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(dialogCtx).pop(controller.text.trim()),
|
||||
onPressed: () => Navigator.of(dialogCtx).pop(),
|
||||
child: const Text('Abbrechen'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () =>
|
||||
Navigator.of(dialogCtx).pop(controller.text.trim()),
|
||||
child: const Text('Umbenennen'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (newName == null || newName.isEmpty || newName == widget.file.name) return;
|
||||
if (newName == null || newName.isEmpty || newName == widget.file.name) {
|
||||
return;
|
||||
}
|
||||
|
||||
final parent = _parentPathOf(widget.file.path);
|
||||
final destination = _joinPath(parent, newName, isDirectory: widget.file.isDirectory);
|
||||
final destination = _joinPath(
|
||||
parent,
|
||||
newName,
|
||||
isDirectory: widget.file.isDirectory,
|
||||
);
|
||||
await _runWebdavOp(() async {
|
||||
final webdav = await WebdavApi.webdav;
|
||||
await webdav.move(PathUri.parse(widget.file.path), PathUri.parse(destination));
|
||||
await webdav.move(
|
||||
PathUri.parse(widget.file.path),
|
||||
PathUri.parse(destination),
|
||||
);
|
||||
}, errorTitle: 'Umbenennen fehlgeschlagen');
|
||||
} finally {
|
||||
controller.dispose();
|
||||
@@ -205,10 +224,14 @@ class _FileElementState extends State<FileElement> {
|
||||
} else {
|
||||
FileClipboard.instance.cut([widget.file]);
|
||||
}
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text('"${widget.file.name}" zum ${copy ? "Kopieren" : "Verschieben"} bereitgelegt'),
|
||||
duration: const Duration(seconds: 2),
|
||||
));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'"${widget.file.name}" zum ${copy ? "Kopieren" : "Verschieben"} bereitgelegt',
|
||||
),
|
||||
duration: const Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _delete() async {
|
||||
@@ -227,7 +250,10 @@ class _FileElementState extends State<FileElement> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _runWebdavOp(Future<void> Function() action, {required String errorTitle}) async {
|
||||
Future<void> _runWebdavOp(
|
||||
Future<void> Function() action, {
|
||||
required String errorTitle,
|
||||
}) async {
|
||||
try {
|
||||
await action();
|
||||
widget.refetch();
|
||||
@@ -287,13 +313,13 @@ class _FileElementState extends State<FileElement> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ListTile(
|
||||
leading: CenteredLeading(
|
||||
Icon(widget.file.isDirectory ? Icons.folder : Icons.description_outlined),
|
||||
),
|
||||
title: Text(widget.file.name, maxLines: 2, overflow: TextOverflow.ellipsis),
|
||||
subtitle: _subtitle(),
|
||||
trailing: Icon(widget.file.isDirectory ? Icons.arrow_right : null),
|
||||
onTap: _onTap,
|
||||
onLongPress: _showActionSheet,
|
||||
);
|
||||
leading: CenteredLeading(
|
||||
Icon(widget.file.isDirectory ? Icons.folder : Icons.description_outlined),
|
||||
),
|
||||
title: Text(widget.file.name, maxLines: 2, overflow: TextOverflow.ellipsis),
|
||||
subtitle: _subtitle(),
|
||||
trailing: Icon(widget.file.isDirectory ? Icons.arrow_right : null),
|
||||
onTap: _onTap,
|
||||
onLongPress: _showActionSheet,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user