showGrockSnackBarWithActionAndIcon method

void showGrockSnackBarWithActionAndIcon(
  1. String message, {
  2. Duration? duration,
  3. required String actionLabel,
  4. required VoidCallback action,
  5. required IconData icon,
})

showSnackBar method

Implementation

void showGrockSnackBarWithActionAndIcon(
  String message, {
  Duration? duration,
  required String actionLabel,
  required VoidCallback action,
  required IconData icon,
}) {
  ScaffoldMessenger.of(context).showSnackBar(
    SnackBar(
      content: Row(
        children: [
          Icon(icon),
          SizedBox(width: 10),
          Text(message),
        ],
      ),
      duration: duration ?? const Duration(seconds: 2),
      action: SnackBarAction(
        label: actionLabel,
        onPressed: action,
      ),
    ),
  );
}