fixed overwrite on internal copy, DST drift in widget anchors, inline errors without controller and removed dead room lookup

This commit is contained in:
2026-09-27 17:37:31 +02:00
parent ee1240f71a
commit 2664378b17
13 changed files with 86 additions and 152 deletions
+11 -6
View File
@@ -13,6 +13,9 @@ class ConfirmDialog extends StatelessWidget {
/// Label of the cancel button. Set to `null` for a single-button dialog
/// (only the confirm action is rendered).
final String? cancelButton;
/// Optional: without [onConfirm]/[onConfirmAsync] the dialog only reports
/// the decision via [ask].
final void Function()? onConfirm;
final AsyncActionCallback? onConfirmAsync;
final AsyncErrorBuilder? errorBuilder;
@@ -27,15 +30,17 @@ class ConfirmDialog extends StatelessWidget {
this.onConfirm,
this.onConfirmAsync,
this.errorBuilder,
}) : assert(
onConfirm != null || onConfirmAsync != null,
'ConfirmDialog requires either onConfirm or onConfirmAsync',
);
});
void asDialog(BuildContext context) {
showDialog(context: context, builder: build);
}
/// Resolves to true once confirmed – with [onConfirmAsync] only after it
/// succeeded.
Future<bool> ask(BuildContext context) async =>
await showDialog<bool>(context: context, builder: build) ?? false;
@override
Widget build(BuildContext context) => AlertDialog(
icon: icon != null ? Icon(icon) : null,
@@ -59,8 +64,8 @@ class ConfirmDialog extends StatelessWidget {
TextButton(
onPressed: () {
Haptics.confirm();
Navigator.of(context).pop();
onConfirm!();
Navigator.of(context).pop(true);
onConfirm?.call();
},
child: Text(confirmButton),
),