#dart, #flutter, #package, #icons

Pixel Art Icons

Dart package to use pixelarticons in Flutter


Original author

The original author is @halfmage on the pixelarticons.

So, please if you like these icons, thanks to @halfmage! and show support on the original repository!

Warning This package is just an automated tool to generate the font from the svg icons created by @halfmage.

How to use

1. Install the package

You can also check the on pub.dev.

flutter pub add pixelarticons

2. Import in to the project

Import wherever you want.

import 'package:pixelarticons/pixelarticons.dart';

3. Use as IconData

pixelarticons is the same of Icons class but renamed to Pixel.

Be aware:

  • Lower-case for all icons and no separators, for example card-plus is written as Pixel.cardplus.
  • Icons that starts with non-alpha characters, like 4k, 4k-box, 4g are prefixed with k.
  • Icons that are Dart keywords, like switch are prefix with k as well.

So use k4k, k4kbox, kswitch instead:

/// 4k icon:
Icon(Pixel.k4k)

/// switch icon:
Icon(Pixel.kswitch)

/// align-left icon:
Icon(Pixel.alignleft);

Purpose of this library

You can download directly from the source, but you'll need convert all the svg files to font and generate the Dart classes... and you'll repeat the process if you want to include a new released icon in the future, so this library was made to automate this gap.

Contribute

As you can see, I'm not native English speaker, so this library certainly has many gramatical errors, typo, and wrong words. So if you have a proficient English you can contribute by fixing all these documentation errors!

If you can improve the tool, please, feel free to open a issue to discuss, I'll appreciate it!

Also, if you miss any icon, please ping me on the repository issues or Discord rintt#1712, I'll take care to verify and trigger the update, thanks!

Flow

This library works automatically:

  • /download contains a python script that downloads svg from all icons of pixelarticons.
  • /lib contains an entry point that exports the generated icon classes (generated by fontify).

This flow is powered by GitHub actions, and the triggers are:

  • scheduled: once a month we'll check if new icons are available, if so we'll update the pub.dev library otherwise we'll just ignore the possible update
  • manually: if we go to actions tab, we can trigger the flow.yaml action clicking run over the action card (need repo write access).

Support

If you have ideas to share, bugs to report or need support, you can either open an issue or join our Discord server.

How to generate the icons

Environment:

Dart SDK version: 2.14.4 (stable)
Python 3.9.9

Working dir: ~/:

0. Install requests library.

pip install requests

1. Download icons using Python.

py download/download.py

2. Generate classes with fontify.

Add fontify as global dependency:

dart pub global activate fontify

Run fontify:

dart pub global run fontify

Done, you'll see a folder called ~/release and a font ~/fonts/pixelarticons.otf.

What you want is the font inside the ~/fonts folder, the ~/release folder should be ignored. Now you can publish or do whatever you want!

Breaking Change Exception

This means that this tool can't find the latest release of the pixelarticons repository.

But this can have several causes, so the best way to fix that is to first figure out where the icons are located in the original repository and then update the ~/download/download.py script to fix/cover the breaking changes if they exists (this error can also be caused by a simple python exception).

Please fill a issue to see what is going wrong and do not worry: all current releases and versions will be available.


Open Source

Copyright © 2022-present, Alex Rintt.

Pixel Art Icons Dart Wrapper is MIT licensed 💖

Libraries

pixel
pixelarticons