Skip to content

Repository files navigation

A Flutter package for rendering remote SVG icons dynamically with support for multiple icon families. Built on top of flutter_svg for optimal performance and caching.

Features

  • 🚀 Dynamic icon loading from 29 icon families (Font Awesome, Heroicons, Lucide, Material Design Icons, Feather, etc.)
  • 🎨 Customizable colors, sizes, and other properties
  • 🖼️ Loading placeholder and error fallback widgets
  • ⚡ Automatic caching via flutter_svg
  • 🎯 Accessibility support
  • 📦 Lightweight and performant

Website

Usage

Dynamic Icons by Family

// ant design icons
SKIcon.antdf("account-book");   // filled
SKIcon.antdo("aim");            // outlined
SKIcon.antdtt("alert");         // two-tone

// bootstrap icons
SKIcon.bootstrap("0-circle-fill");

// box icons
SKIcon.boxl("bxl-aws");         // logos
SKIcon.boxr("bx-adjust");       // regular
SKIcon.boxs("bxs-alarm");       // solid

// css.gg icons
SKIcon.cssgg("abstract");

// feather icons
SKIcon.feather("activity");

// flat color icons
SKIcon.flatc("about");

// font awesome 6 icons
SKIcon.fontab("adn");           // brands
SKIcon.fontar("bell");          // regular
SKIcon.fontas("bell");          // solid

// github octicons
SKIcon.octicon("alert-fill");

// grommet icons
SKIcon.grommet("brush");

// hero icons
SKIcon.heroo("academic-cap");   // outline
SKIcon.heros("academic-cap");   // solid

// ico moon free icons
SKIcon.icomoon("home");

// icons8 line awesome icons
SKIcon.icons8("bell");

// ion icons
SKIcon.ion("alarm-outline");

// lucide icons
SKIcon.lucide("activity");

// material design icons (community)
SKIcon.mdi("ab-testing");

// radix icons
SKIcon.radix("avatar");

// simple line icons
SKIcon.sline("bell");

// tabler icons
SKIcon.tabf("adjustments");     // filled
SKIcon.tabo("adjustments");     // outline

// themify icons
SKIcon.themify("alarm-clock");

// typ icons
SKIcon.typ("anchor");

// vs code icons
SKIcon.vscode("account");

// weather icons
SKIcon.weather("wi-day-sunny");

With Customization

// Square icons: `size` sets both width and height
SKIcon.lucide("heart", size: 32, color: Colors.red);

// Or control width/height independently
SKIcon.fontar("bell", width: 48, height: 32);

// Loading placeholder and error fallback
SKIcon.feather(
  "activity",
  size: 24,
  placeholder: const CircularProgressIndicator(),
  errorWidget: const Icon(Icons.error),
);

// Copy an existing icon with different properties
SKIcon.fontar("bell").copyWith(size: 48, color: Colors.amber);

Using the Constructor Directly

IconFamily is exported, so you can also build icons without the static helpers:

SKIcon(
  family: IconFamily.heroIconsOutline,
  iconName: 'academic-cap',
  size: 24,
  color: Colors.indigo,
)

In Widgets

AppBar(
  title: Text('My App'),
  leading: SKIcon.heroo('home', size: 24),
  actions: [
    Padding(
      padding: EdgeInsets.all(8.0),
      child: SKIcon.antdtt('setting', size: 24),
    ),
  ],
)

In Buttons

ElevatedButton.icon(
  onPressed: () {},
  icon: SKIcon.feather("check", size: 20, color: Colors.white),
  label: Text('Accept'),
)

Custom URLs

Render any remote SVG with the same API:

SKIcon.custom(
  'https://example.com/icon.svg',
  size: 24.0,                                // Icon size (or width/height)
  color: Colors.blue,                        // Icon color
  semanticsLabel: 'Home icon',               // Accessibility label
  fit: BoxFit.contain,                       // How to fit the icon
  alignment: Alignment.center,               // Icon alignment
  placeholder: CircularProgressIndicator(),  // Loading placeholder
  errorWidget: Icon(Icons.error),            // Error fallback
  headers: {'Authorization': 'Bearer ...'},  // Optional HTTP headers
)

Icon Sets Used

Icon Set License Project Link
Ant Design Icons MIT ant-design-icons
Bootstrap Icons MIT twbs/icons
BoxIcons MIT boxicons
css.gg MIT css.gg
Feather MIT feathericons.com
Flat Color Icons MIT flat-color-icons
Font Awesome 6 CC BY 4.0 License fontawesome.com
Github Octicons icons MIT octicons-icons
Grommet-Icons Apache License Version 2.0 grommet-icons
Heroicons MIT hero-icons
IcoMoon Free MIT ico-moon-icons
Icons8 Line Awesome MIT icons8-line-awesome
Ionicons MIT ion-icons
Lucide Icons ISC lucide
Material Design Icons Apache License Version 2.0 MaterialDesign
Radix Icons MIT radix-icons
Simple Line Icons MIT simple-line-icons
Tabler Icons MIT tabler-icons
Themify Icons MIT themify-icons
Typicons CC BY-SA 3.0 typ-icons
VS Code Icons CC BY 4.0 vc-code-icons
Weather Icons SIL OFL 1.1 weather-icons

Migrating from 0.x

  • IconFamily.antDesignOutined was renamed to IconFamily.antDesignOutlined (typo fix).
  • errorWidget is now honored: when a network icon fails to load, the provided errorWidget (or a default broken-image icon) is shown instead of an empty box.

Performance

  • Icons are automatically cached by flutter_svg
  • Network requests are optimized
  • Supports both HTTP and HTTPS URLs
  • Placeholder widgets prevent layout shifts during loading

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Releases

Packages

Contributors

Languages