Search packages, repositories and app categories

GitHub repositoryAhmedha91/icon_file

icon_file

Ahmedha91/icon_file open-source repository details.

icon_file project cover
Stars
1
Forks
0
Last push (UTC)
Jun 23, 2025
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

📂 icon_file

A Flutter package to automatically display a file icon (SVG) with a dynamic badge based on the file extension (.pdf, .jpg, .zip, etc.).
Perfect for file explorers, downloads, or file previews in apps.

🧩 Features

  • Automatic detection of the file extension
  • Dynamic colored badge based on file type
  • Customizable style (color, text, etc.)
  • Supports over 30 common extensions
  • Ready for responsive layouts (ScreenUtil)
  • Dark mode friendly

📸 Preview

Default Icons Customized Icons
default_icons custom_icons

🚀 Installation

Add this to your pubspec.yaml:

dependencies:
  icon_file: ^1.0.X

Then run:

flutter pub get

🛠️ Basic Usage

import "package:icon_file/icon_file.dart";
FileIcon("document.pdf");

🎨 Example with Custom Styles

FileIcon(
  "custom.pdf",
  color: Colors.deepPurple,
  extensionStyle: TextStyle(
    fontSize: 12,
    fontWeight: FontWeight.bold,
    color: Colors.yellow,
  ),
)

💡 Available Parameters

Parameter Description
fileName (required) File name with extension (document.pdf)
color Custom background color for the badge (optional)
showExtension Whether to show the badge with the extension (default: true)
extensionStyle Text style for the extension badge
assetIcon Custom path to SVG icon (default: assets/file.svg)
size Size of the icon (default: 80)
roundedLabel Whether the badge has rounded corners (default: true)

🔍 Supported Extensions

This package automatically supports the following file types (and can be extended):

pdf, doc, docx, ppt, pptx, xls, xlsx, csv, txt, png, jpg, jpeg, svg, mp3, wav, aac, mp4, avi, mov, js, css, html, json, xml, zip, rar, 7z, tar, gz, dart


🧪 Full Example (UI)

List<String> files = [
  'document.pdf',
  'notes.docx',
  'image.png',
  'video.mp4',
  'music.mp3',
  'slides.pptx',
  'spreadsheet.xlsx',
  'archive.zip',
  'script.js',
  'style.css',
  'readme.txt',
  'logo.svg',
  'data.json',
  'source.dart',
];

List<Widget> icons = files.map((file) => FileIcon(file)).toList();

👥 Contributing

Contributions are welcome!
Feel free to open an issue, submit a pull request, or simply report a bug.


📄 License

This project is licensed under the MIT License.

Ahmedha91 GitHub avatar
GitHub author

Ahmedha91 ↗

LanguagesC++CMakeDartSwiftCHTMLKotlinObjective-C

Packages published by this repository

Dependencies used

Dependency list 4 items

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗