build method

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

Builds the delete button widget, rendering an IconButton that triggers a Confirm dialog on press.

The dialog title interpolates the thing for context (e.g., "Delete Item?"), marks as destructive for red styling, uses menuText for the confirm button, includes description if provided, and calls onDelete on confirmation. Ensures user safety by requiring explicit approval before deletion, with async handling via DialogConfirm.open. No heavy computations; renders efficiently for repeated use.

Implementation

@override
Widget build(BuildContext context) => IconButton(
      icon: Icon(deleteIcon),
      onPressed: () => DialogConfirm(
              title: "Delete $thing?",
              destructive: true,
              confirmText: menuText,
              description: description,
              onConfirm: onDelete)
          .open(context),
    );