showSuccess static method

void showSuccess(
  1. BuildContext context,
  2. String message, {
  3. Duration duration = const Duration(seconds: 2),
})

Shows a success snackbar with a checkmark icon.

Implementation

static void showSuccess(
  BuildContext context,
  String message, {
  Duration duration = const Duration(seconds: 2),
}) {
  ScaffoldMessenger.of(context).showSnackBar(
    SnackBar(
      content: Row(
        children: [
          const Icon(Icons.check_circle, color: Colors.white),
          const SizedBox(width: 12),
          Expanded(child: Text(message)),
        ],
      ),
      backgroundColor: Colors.green.shade600,
      behavior: SnackBarBehavior.floating,
      duration: duration,
    ),
  );
}