getFileIcon function

IconData getFileIcon(
  1. PodFileItem item
)

Returns the appropriate icon for a file item based on its type and extension.

Implementation

IconData getFileIcon(PodFileItem item) {
  if (item.isDirectory) return Icons.folder_rounded;

  switch (item.extension) {
    case 'json':
      return Icons.data_object;
    case 'txt':
      return Icons.article;
    case 'md':
      return Icons.description;
    case 'csv':
      return Icons.table_chart;
    case 'jpg':
    case 'jpeg':
    case 'png':
    case 'gif':
    case 'webp':
      return Icons.image;
    case 'mp3':
    case 'wav':
    case 'ogg':
      return Icons.audio_file;
    case 'mp4':
    case 'webm':
    case 'avi':
      return Icons.video_file;
    case 'pdf':
      return Icons.picture_as_pdf;
    case 'ttl':
    case 'rdf':
    case 'n3':
      return Icons.schema;
    case 'acl':
      return Icons.security;
    default:
      return Icons.insert_drive_file;
  }
}