Commit 21b1f5cd authored by Brian Egan's avatar Brian Egan

Version 8.7.0: FaIcon Widget

parent 0d0d56ba
## 8.7.0
* Add `FaIcon` widget for Font Awesome Icons
* Update `README` with FAQ
## 8.6.0 ## 8.6.0
* Move package to FlutterCommunity * Move package to FlutterCommunity
* Upgrade to Font Awesome Icons 5.12.1 * Upgrade to Font Awesome Icons 5.12.1
......
...@@ -15,9 +15,9 @@ Based on Font Awesome 5.12.1. Includes all free icons: ...@@ -15,9 +15,9 @@ Based on Font Awesome 5.12.1. Includes all free icons:
In the `dependencies:` section of your `pubspec.yaml`, add the following line: In the `dependencies:` section of your `pubspec.yaml`, add the following line:
```yaml ```yaml
dependencies:
font_awesome_flutter: <latest_version> font_awesome_flutter: <latest_version>
``` ```
When icons do not render try [this](https://github.com/brianegan/font_awesome_flutter/issues/28#issuecomment-460109786).
## Usage ## Usage
...@@ -39,27 +39,59 @@ class MyWidget extends StatelessWidget { ...@@ -39,27 +39,59 @@ 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 ## FAQ
### Why aren't the icons aligned properly or why are the icons being cut off?
Please use the `FaIcon` widget provided by the library instead of the `Icon`
widget provided by Flutter. The `Icon` widget assumes all icons are square, but
many Font Awesome Icons are not.
### Why aren't the icons showing up on Mobile devices?
If you're not seeing any icons at all, sometimes it means that Flutter has a cached version of the app on device and hasn't pushed the new fonts. I've run into that as well a few times...
Please try:
1. Stopping the app
2. Running `flutter clean` in your app directory
3. Deleting the app from your simulator / emulator / device
4. Rebuild & Deploy the app.
### Why aren't the icons showing up on Web?
Most likely, the fonts were not correctly added to the `FontManifest.json`.
Note: older versions of Flutter did not properly package non-Material fonts
in the `FontManifest.json` during the build step, but that issue has been
resolved and this shouldn't be much of a problem these days.
Please ensure you are using `Flutter 1.14.6 beta` or newer!
### How can I use pro icons?
This library only packages the free Font Awesome icon fonts. If you own the pro
icon fonts and want to use them with Flutter, please follow these instructions.
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
a public github repository or other public file sharing services.
: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`
* Uncomment `IconDataLight` in `lib/icon_data.dart`
* In your project's dependencies, replace the version tag for `font_awesome_flutter` with the path to your custom installation.
- 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 ```yaml
dependencies: dependencies:
font_awesome_flutter: font_awesome_flutter:
path: /path/to/font_awesome_flutter path: /path/to/font_awesome_flutter
... ...
``` ```
- Uncomment `IconDataLight` in `lib/icon_data.dart`
## Contributors ## Contributors
......
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
/// Creates an Icon Widget that works for non-material Icons, such as the /// Creates an Icon Widget that works for non-material Icons, such as the
/// Font Awesome Icons. /// Font Awesome Icons.
...@@ -25,24 +26,20 @@ class FaIcon extends StatelessWidget { ...@@ -25,24 +26,20 @@ class FaIcon extends StatelessWidget {
}) : assert(icon != null), }) : assert(icon != null),
super(key: key); super(key: key);
/// The icon to display. The available icons are described in [Icons]. /// The icon to display. The available icons are described in
/// /// [FontAwesomeIcons].
/// The icon can be null, in which case the widget will render as an empty
/// space of the specified [size].
final IconData icon; final IconData icon;
/// The size of the icon in logical pixels. /// The font size of the icon.
///
/// Icons occupy a square with width and height equal to size.
/// ///
/// Defaults to the current [IconTheme] size, if any. If there is no /// Defaults to the current [IconTheme] size, if any. If there is no
/// [IconTheme], or it does not specify an explicit size, then it defaults to /// [IconTheme], or it does not specify an explicit size, then it defaults to
/// 24.0. /// 24.0.
/// ///
/// If this [FaIcon] is being placed inside an [IconButton], then use /// If this [FaIcon] is being placed inside an [IconButton], then use
/// [IconButton.iconSize] instead, so that the [IconButton] can make the splash /// [IconButton.iconSize] instead, so that the [IconButton] can make the
/// area the appropriate size as well. The [IconButton] uses an [IconTheme] to /// splash area the appropriate size as well. The [IconButton] uses an
/// pass down the size to the [FaIcon]. /// [IconTheme] to pass down the size to the [FaIcon].
final double size; final double size;
/// The color to use when drawing the icon. /// The color to use when drawing the icon.
...@@ -51,27 +48,6 @@ class FaIcon extends StatelessWidget { ...@@ -51,27 +48,6 @@ class FaIcon extends StatelessWidget {
/// ///
/// The given color will be adjusted by the opacity of the current /// The given color will be adjusted by the opacity of the current
/// [IconTheme], if any. /// [IconTheme], if any.
///
///
/// In material apps, if there is a [Theme] without any [IconTheme]s
/// specified, icon colors default to white if the theme is dark
/// and black if the theme is light.
///
/// If no [IconTheme] and no [Theme] is specified, icons will default to black.
///
/// See [Theme] to set the current theme and [ThemeData.brightness]
/// for setting the current theme's brightness.
///
/// {@tool snippet}
/// Typically, a material design color will be used, as follows:
///
/// ```dart
/// Icon(
/// Icons.widgets,
/// color: Colors.blue.shade400,
/// )
/// ```
/// {@end-tool}
final Color color; final Color color;
/// Semantic label for the icon. /// Semantic label for the icon.
......
...@@ -5,7 +5,7 @@ authors: ...@@ -5,7 +5,7 @@ authors:
- Flutter Community <community@flutter.zone> - Flutter Community <community@flutter.zone>
- Brian Egan <brian@brianegan.com> - Brian Egan <brian@brianegan.com>
homepage: https://github.com/fluttercommunity/font_awesome_flutter homepage: https://github.com/fluttercommunity/font_awesome_flutter
version: 8.6.0 version: 8.7.0
environment: environment:
sdk: ">=2.0.0-dev.28.0 <3.0.0" sdk: ">=2.0.0-dev.28.0 <3.0.0"
......
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