dart format

This commit is contained in:
2026-05-08 20:12:40 +02:00
parent 9e139b5704
commit 3b8da1d3d6
295 changed files with 6404 additions and 4161 deletions
+32 -29
View File
@@ -23,8 +23,10 @@ class ConfirmDialog extends StatelessWidget {
this.onConfirm,
this.onConfirmAsync,
this.errorBuilder,
}) : assert(onConfirm != null || onConfirmAsync != null,
'ConfirmDialog requires either onConfirm or onConfirmAsync');
}) : assert(
onConfirm != null || onConfirmAsync != null,
'ConfirmDialog requires either onConfirm or onConfirmAsync',
);
void asDialog(BuildContext context) {
showDialog(context: context, builder: build);
@@ -32,32 +34,32 @@ class ConfirmDialog extends StatelessWidget {
@override
Widget build(BuildContext context) => AlertDialog(
icon: icon != null ? Icon(icon) : null,
title: Text(title),
content: Text(content),
actions: onConfirmAsync != null
? [
AsyncDialogAction(
confirmLabel: confirmButton,
cancelLabel: cancelButton,
onConfirm: onConfirmAsync!,
errorBuilder: errorBuilder,
),
]
: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(cancelButton),
),
TextButton(
onPressed: () {
Navigator.of(context).pop();
onConfirm!();
},
child: Text(confirmButton),
),
],
);
icon: icon != null ? Icon(icon) : null,
title: Text(title),
content: Text(content),
actions: onConfirmAsync != null
? [
AsyncDialogAction(
confirmLabel: confirmButton,
cancelLabel: cancelButton,
onConfirm: onConfirmAsync!,
errorBuilder: errorBuilder,
),
]
: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: Text(cancelButton),
),
TextButton(
onPressed: () {
Navigator.of(context).pop();
onConfirm!();
},
child: Text(confirmButton),
),
],
);
static void openBrowser(BuildContext context, String url) {
showDialog(
@@ -66,7 +68,8 @@ class ConfirmDialog extends StatelessWidget {
title: 'Link öffnen',
content: 'Möchtest du den folgenden Link öffnen?\n$url',
confirmButton: 'Öffnen',
onConfirm: () => launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication),
onConfirm: () =>
launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication),
),
);
}