Refactor codebase using ConfirmDialog whenever possible
This commit is contained in:
@ -96,28 +96,25 @@ class _FileElementState extends State<FileElement> {
|
||||
));
|
||||
} 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"))
|
||||
],
|
||||
);
|
||||
});
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => ConfirmDialog(
|
||||
title: "Download abbrechen?",
|
||||
content: "Möchtest du den Download abbrechen?",
|
||||
cancelButton: "Nein",
|
||||
confirmButton: "Ja, Abbrechen",
|
||||
onConfirm: () {
|
||||
downloadCore?.then((value) {
|
||||
if(!value.isCancelled) value.cancel();
|
||||
});
|
||||
setState(() {
|
||||
widget.file.currentlyDownloading = false;
|
||||
percent = 0;
|
||||
downloadCore = null;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user