Pakete, Repositories und App-Kategorien suchen

GitHub-RepositoryAhmedha91/icon_file

icon_file

Ahmedha91/icon_file open-source repository details.

Projektcover von icon_file
Sterne
1
Forks
0
Letzter Push (UTC)
23.06.2025
Projektstatus
Aktiv

Original-README

Englischer Projektschnappschuss. Aktuelle Inhalte auf GitHub.

📂 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-Autor

Ahmedha91 ↗

SprachenC++CMakeDartSwiftCHTMLKotlinObjective-C

Von diesem Repository veröffentlichte Pakete

Verwendete Abhängigkeiten

Abhängigkeiten 4 Einträge

Wie wähle ich ein passendes Repository?

Nach Anwendungsfall filtern, Aktivität vergleichen und vor der Nutzung das Originalprojekt prüfen.

  1. Nach Name, Autor oder Beschreibung suchen und nach Thema eingrenzen.
  2. Sterne, Forks und letzte Pushes vergleichen. Sterne zeigen Interesse, garantieren aber keine Qualität.
  3. Vor der Nutzung README, Lizenz und Issues auf GitHub prüfen.

Quellen und Pflege

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

GitHub Docs — About repositories ↗