file_icon.dart 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. class FileIcon {
  2. static String getFileIconAssetsNameByExtension(String extension) {
  3. if (extension.isEmpty) {
  4. return "icon_file_unkown.png";
  5. }
  6. extension = extension.toLowerCase();
  7. if (extension.startsWith(".")) {
  8. extension = extension.substring(1, extension.length);
  9. }
  10. switch (extension){
  11. case "jpg":
  12. case "jpeg":
  13. return "icon_file_jpeg.png";
  14. case "gif":
  15. return "icon_file_gif.png";
  16. case "png":
  17. return "icon_file_png.png";
  18. case "tiff":
  19. return "icon_file_tiff.png";
  20. case "bmp":
  21. case "webp":
  22. return "icon_file_img.png";
  23. case "ogg":
  24. case "mp3":
  25. case "wav":
  26. case "wma":
  27. return "icon_file_mp3.png";
  28. case "mp4":
  29. return "icon_file_mp4.png";
  30. case "avi":
  31. return "icon_file_avi.png";
  32. case "mov":
  33. case "rm":
  34. case "mkv":
  35. return "icon_file_rm.png";
  36. case "doc":
  37. case "docx":
  38. return "icon_file_word.png";
  39. case "xls":
  40. case "xlsx":
  41. return "icon_file_excel.png";
  42. case "ppt":
  43. case "pptx":
  44. return "icon_file_ppt.png";
  45. case "html":
  46. return "icon_file_html.png";
  47. case "pdf":
  48. return "icon_file_pdf.png";
  49. case "txt":
  50. case "json":
  51. return "icon_file_txt.png";
  52. case "zip":
  53. return "icon_file_zip.png";
  54. case "rar":
  55. return "icon_file_rar.png";
  56. case "7z":
  57. return "icon_file_arch.png";
  58. case "ai":
  59. return "icon_file_ai.png";
  60. case "att":
  61. return "icon_file_att.png";
  62. case "au":
  63. return "icon_file_au.png";
  64. case "cad":
  65. return "icon_file_cad.png";
  66. case "cdr":
  67. return "icon_file_cdr.png";
  68. case "eps":
  69. return "icon_file_eps.png";
  70. case "exe":
  71. return "icon_file_exe.png";
  72. case "iso":
  73. return "icon_file_iso.png";
  74. case "link":
  75. return "icon_file_link.png";
  76. case "swf":
  77. return "icon_file_flash.png";
  78. case "psd":
  79. return "icon_file_psd.png";
  80. case "tmp":
  81. return "icon_file_tmp.png";
  82. default:
  83. return "icon_file_unkown.png";
  84. }
  85. }
  86. }