Search packages, repositories and app categories

Package detailsv0.0.3

icon_file

A Flutter widget to display file icons with extensions.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
37
Likes
2
Pub points
160

Install package

flutter pub add icon_file

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

icon_file is a Flutter package that provides a widget to display file icons based on file extensions. It simplifies the process of showing visual representations for various file types across multiple platforms, including Android, iOS, Web, macOS, Windows, and Linux. The widget automatically selects appropriate icons for common extensions like .pdf, .jpg, .txt, and more, enhancing user interface clarity in file-related applications. It is lightweight and easy to integrate with minimal configuration.

Use cases

  • Displaying file types in file explorers
  • Enhancing document lists with visual cues
  • Improving UI in cloud storage apps
  • Showing file formats in upload interfaces
  • Visual feedback in project management tools

Key features

  • Automatic icon selection by file extension
  • Support for multiple platforms
  • Lightweight and easy integration
  • Customizable icon size and color
  • Predefined icons for common file types

Suitable for

  • File management apps
  • Document sharing platforms
  • Cloud storage interfaces
  • Developer tools with file handling
  • UIs requiring visual file type indicators

Considerations

  • Limited to predefined file extensions
  • No support for custom icon mappings
  • May require additional styling for consistency
  • Depends on external icon assets
  • Not suitable for highly customized icon needs

Original README

Original README snapshot from the linked source repository. Visit the repository 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.

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package

No data available yet.