Unverified Commit 9d4bf360 authored by Brian Egan's avatar Brian Egan Committed by GitHub

Merge pull request #37 from michaelspiss/master

Add support for pro icons, fix #45
parents 3e302b92 8d0530e1
...@@ -37,7 +37,30 @@ class MyWidget extends StatelessWidget { ...@@ -37,7 +37,30 @@ class MyWidget extends StatelessWidget {
View the Flutter app in the `example` directory to see all the available `FontAwesomeIcons`. View the Flutter app in the `example` directory to see all the available `FontAwesomeIcons`.
## Include pro icons
If you bought font awesome pro icons, you can import them here.
:exclamation: By importing pro icons you acknowledge that it is your obligation to keep these files private. This includes **not** uploading your package to github or other public file sharing services.
- Download this package's newest release, extract the folder and move it to a location of your choice
- Remove `#`s from `pubspec.yaml` at the indicated position
- run `flutter packages get`
- Download your font awesome pro icons (web version)
- Move all `.ttf` files from the `webfonts` directory to this package's lib/fonts (replace existing fonts)
- Move `icons.json` from `metadata` to this directory
- Run `./tool/update.sh`
- In your project's dependencies, replace the version tag for `font_awesome_flutter` with the path to your custom installation.
```yaml
dependencies:
font_awesome_flutter:
path: /path/to/font_awesome_flutter
...
```
- Uncomment `IconDataLight` in `lib/icon_data.dart`
## Contributors ## Contributors
- Brian Egan - Brian Egan
- Phil Plante - Phil Plante
- Michael Spiss
...@@ -28,3 +28,16 @@ class IconDataRegular extends IconData { ...@@ -28,3 +28,16 @@ class IconDataRegular extends IconData {
fontPackage: 'font_awesome_flutter', fontPackage: 'font_awesome_flutter',
); );
} }
// Uncomment to be able to use (pro) light icons if installed
/*
class IconDataLight extends IconData {
const IconDataLight(int codePoint)
: super(
codePoint,
fontFamily: 'FontAwesomeLight',
fontPackage: 'font_awesome_flutter',
);
}
*/
...@@ -28,3 +28,9 @@ flutter: ...@@ -28,3 +28,9 @@ flutter:
fonts: fonts:
- asset: lib/fonts/fa-solid-900.ttf - asset: lib/fonts/fa-solid-900.ttf
weight: 900 weight: 900
# To support pro icons, drop fa-light-300.ttf into lib/fonts,
# regenerate the icon collection and uncomment the following lines:
# - family: FontAwesomeLight
# fonts:
# - asset: lib/fonts/fa-light-300.ttf
# weight: 300
...@@ -34,7 +34,7 @@ void main(List<String> arguments) { ...@@ -34,7 +34,7 @@ void main(List<String> arguments) {
String name = '${style}_$iconName'; String name = '${style}_$iconName';
iconDefinitions[name] = generateIconDefinition( iconDefinitions[name] = generateIconDefinition(
name, name,
styles.first, style,
unicode, unicode,
); );
} }
......
#!/usr/bin/env bash #!/usr/bin/env bash
if [ -e ./icons.json ];
then
echo "Custom icons.json found, using local data only."
dart ./tool/generate_font.dart ./icons.json
dart ./tool/generate_example.dart ./icons.json
dartfmt -w ./lib/font_awesome_flutter.dart
dartfmt -w ./example/lib/icons.dart
else
echo "Updating icons to newest version."
pushd lib/fonts/ pushd lib/fonts/
curl -O -L "https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/webfonts/fa-brands-400.ttf" curl -O -L "https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/webfonts/fa-brands-400.ttf"
...@@ -16,3 +26,4 @@ dartfmt -w ./lib/font_awesome_flutter.dart ...@@ -16,3 +26,4 @@ dartfmt -w ./lib/font_awesome_flutter.dart
dartfmt -w ./example/lib/icons.dart dartfmt -w ./example/lib/icons.dart
rm /tmp/icons.json rm /tmp/icons.json
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment