Table of Contents
font_awesome_flutter_named
Live Example
An online live example can be found here
Introduction
With many thanks to the for creating the vast majority of the work required for this package.
This package generates the names of the fonts provided by the dependant font_awesome_flutter
package. It does not actually include the font files themselves.
Font Names
As a note, the names generated by this package differs from the official package in that the string names of the font icons exactly match the generated Dart code name rather than prefixing with the style. So the names in the example app match the names you may reference in the strings maps.
Installation
In the dependencies:
section of your pubspec.yaml
, add the following line:
dependencies:
font_awesome_flutter_named: <latest_version>
Usage
import 'package:font_awesome_flutter_named/font_awesome_flutter_named.dart';
class MyWidget extends StatelessWidget {
Widget build(BuildContext context) {
return IconButton(
// Use the FaIcon Widget + FontAwesomeIcons class for the IconData
icon: FaIcon(faIconNameMapping['gamepad']!),
onPressed: () { print("Pressed"); }
);
}
}
Icon names
Icon names equal those on the official website, but are written in lower camel case. If more than one icon style is available for an icon, the style name is used as prefix, except for "regular". Due to restrictions in dart, icons starting with numbers have those numbers written out.
Examples:
Icon name | Code | Style |
---|---|---|
angle-double-up | faIconNameMapping['angleDoubleUp'] |
solid (this icon does not have other free styles) |
arrow-alt-circle-up | faIconNameMapping['arrowAltCircleUp'] |
regular |
arrow-alt-circle-up | faIconNameMapping['solidArrowAltCircleUp'] |
solid |
1 | faIconNameMapping['solidOne'] |
solid |