getFileIcon static method
Implementation
static IconData getFileIcon(String path) {
String name = VPaths.name(path);
String ext = name.startsWith(".")
? "."
: name.contains(".")
? name.split('.').sublist(1).join('.')
: "";
if (ext.isEmpty) {
return Icons.file_fill;
}
// dart format off
return switch (ext.toLowerCase()) {
"." => Icons.file_dotted_fill,
"mp4" ||
"mov" ||
"mkv" ||
"avi" ||
"webm" ||
"flv" ||
"wmv" ||
"mpg" ||
"mpeg" ||
"m4v" =>
Icons.file_video_fill,
"mp3" ||
"wav" ||
"flac" ||
"ogg" ||
"m4a" ||
"wma" ||
"aac" =>
Icons.file_audio_fill,
"zip" ||
"tar.gz" ||
"rar" ||
"gz" ||
"tar" ||
"7z" =>
Icons.file_zip_fill,
"gif" ||
"bmp" ||
"webp" ||
"tiff" ||
"svg" ||
"ico" =>
Icons.file_image_fill,
"py" || "go" || "cs" || "cpp" || "dart" || "java" => Icons.file_code_fill,
"txt" ||
"rtf" ||
"md" ||
"nfo" ||
"json" ||
"yml" ||
"yaml" ||
"toml" =>
Icons.file_text_fill,
"jpg" || "jpeg" || "jxl" => Icons.file_jpg_fill,
"scss" || "css" => Icons.file_css_fill,
"html" || "htm" => Icons.file_html_fill,
"docx" || "doc" => Icons.file_doc_fill,
"ppt" || "pptx" => Icons.file_ppt_fill,
"xls" || "xlsx" => Icons.file_xls_fill,
"js" => Icons.file_js_fill,
"csv" => Icons.file_csv_fill,
"jsx" => Icons.file_jsx_fill,
"pdf" => Icons.file_pdf_fill,
"png" => Icons.file_png_fill,
"apng" => Icons.file_png_fill,
"rs" => Icons.file_rs_fill,
"tsx" => Icons.file_tsx_fill,
"ts" => Icons.file_ts_fill,
"vue" => Icons.file_vue_fill,
"x" => Icons.file_x_fill,
_ => Icons.file_fill
};
// dart format on
}