build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Builds the DialogConfirm widget tree, rendering it as an ArcaneDialog.

This method constructs the dialog's UI:

No side effects beyond building the widget; interactions are handled via button callbacks. Returns a fully configured ArcaneDialog ready for display.

The build ensures horizontal centering and maximal content fitting, maintaining Arcane's aesthetic with glass effects and proper spacing.

Implementation

@override

/// Builds the [DialogConfirm] widget tree, rendering it as an [ArcaneDialog].
///
/// This method constructs the dialog's UI:
/// - Title: A [Text] widget with [title].
/// - Content: A flexible [Row] containing either [Text] from [description]
///   (if provided) or [descriptionWidget]. Wrapped in [InWidth] for responsive
///   sizing.
/// - Actions: Defaults to cancel ([OutlineButton]) and confirm buttons.
///   Confirm uses [DestructiveButton] if [destructive] is true, otherwise
///   [PrimaryButton]. Both dismiss the dialog (pop true/false) and invoke
///   [onConfirm] on confirm. Additional [actions] are spread if provided.
///   The entire actions list is wrapped in [InWidth].
///
/// No side effects beyond building the widget; interactions are handled
/// via button callbacks. Returns a fully configured [ArcaneDialog] ready
/// for display.
///
/// The build ensures horizontal centering and maximal content fitting,
/// maintaining Arcane's aesthetic with glass effects and proper spacing.
Widget build(BuildContext context) => ArcaneDialog(
      title: Text(title),
      content: Row(
        mainAxisSize: MainAxisSize.max,
        children: [
          Flexible(
              child: description != null
                  ? Text(description!)
                  : descriptionWidget)
        ],
      ).iw,
      actions: actions ??
          [
            OutlineButton(
              onPressed: () => Navigator.of(context).pop(false),
              child: Text(cancelText),
            ),
            destructive
                ? DestructiveButton(
                    onPressed: () {
                      Navigator.of(context).pop(true);
                      onConfirm();
                    },
                    child: Text(confirmText),
                  )
                : PrimaryButton(
                    onPressed: () {
                      Navigator.of(context).pop(true);
                      onConfirm();
                    },
                    child: Text(confirmText),
                  ),
            if (actions != null) ...actions!,
          ],
    ).iw;