mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-12 02:57:22 +00:00
modern file manager delete dialog
This commit is contained in:
@@ -593,9 +593,11 @@ class FileModel extends ChangeNotifier {
|
||||
? "${translate("Are you sure you want to delete the file of this directory?")}\n"
|
||||
: "";
|
||||
final count = entries.length > 1 ? "${i + 1}/${entries.length}" : "";
|
||||
content = "$dirShow$count \n${entries[i].path}";
|
||||
final confirm =
|
||||
await showRemoveDialog(title, content, item.isDirectory);
|
||||
content = "$dirShow\n\n${entries[i].path}".trim();
|
||||
final confirm = await showRemoveDialog(
|
||||
count.isEmpty ? title : "$title ($count)",
|
||||
content,
|
||||
item.isDirectory);
|
||||
try {
|
||||
if (confirm == true) {
|
||||
sendRemoveFile(entries[i].path, i, items.isLocal!);
|
||||
@@ -636,42 +638,59 @@ class FileModel extends ChangeNotifier {
|
||||
submit() => close(true);
|
||||
return CustomAlertDialog(
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.warning, color: Colors.red),
|
||||
const SizedBox(width: 20),
|
||||
Text(title)
|
||||
const Icon(Icons.warning_rounded, color: Colors.red),
|
||||
Text(title).paddingOnly(
|
||||
left: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
contentBoxConstraints:
|
||||
BoxConstraints(minHeight: 100, minWidth: 400, maxWidth: 400),
|
||||
BoxConstraints(minHeight: 80, minWidth: 400, maxWidth: 400),
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(content),
|
||||
const SizedBox(height: 5),
|
||||
Text(translate("This is irreversible!"),
|
||||
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||
showCheckbox
|
||||
? CheckboxListTile(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
title: Text(
|
||||
translate("Do this for all conflicts"),
|
||||
),
|
||||
value: removeCheckboxRemember,
|
||||
onChanged: (v) {
|
||||
if (v == null) return;
|
||||
setState(() => removeCheckboxRemember = v);
|
||||
},
|
||||
)
|
||||
: const SizedBox.shrink()
|
||||
]),
|
||||
actions: [
|
||||
dialogButton("Cancel", onPressed: cancel, isOutline: true),
|
||||
dialogButton("OK", onPressed: submit),
|
||||
],
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(content),
|
||||
Text(
|
||||
translate("This is irreversible!"),
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.red,
|
||||
),
|
||||
).paddingOnly(top: 20),
|
||||
showCheckbox
|
||||
? CheckboxListTile(
|
||||
contentPadding: const EdgeInsets.all(0),
|
||||
dense: true,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
title: Text(
|
||||
translate("Do this for all conflicts"),
|
||||
),
|
||||
value: removeCheckboxRemember,
|
||||
onChanged: (v) {
|
||||
if (v == null) return;
|
||||
setState(() => removeCheckboxRemember = v);
|
||||
},
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
ElevatedButton.icon(
|
||||
icon: Icon(Icons.close_rounded),
|
||||
label: Text(translate("Cancel")),
|
||||
onPressed: cancel,
|
||||
),
|
||||
ElevatedButton.icon(
|
||||
icon: Icon(Icons.done_rounded),
|
||||
label: Text(translate("Ok")),
|
||||
onPressed: submit,
|
||||
),
|
||||
],
|
||||
).paddingOnly(top: 20)
|
||||
],
|
||||
),
|
||||
onSubmit: submit,
|
||||
onCancel: cancel,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user