destructive static method

Widget destructive(
  1. BuildContext context, {
  2. required String label,
  3. Object? result,
  4. VoidCallback? onPressed,
})

A destructive action (e.g. "Delete") styled with the error color.

Implementation

static Widget destructive(
  BuildContext context, {
  required String label,
  Object? result,
  VoidCallback? onPressed,
}) => FilledButton(
  style: FilledButton.styleFrom(
    backgroundColor: Theme.of(context).colorScheme.error,
    foregroundColor: Theme.of(context).colorScheme.onError,
  ),
  onPressed: onPressed ?? () => Navigator.pop(context, result),
  child: Text(label),
);