fluttercommunity / font_awesome_flutter

The Font Awesome Icon pack available as Flutter Icons
Other
844 stars 244 forks source link

Add ability to pull font metadata from FontAwesome API instead of ico… #200

Closed ryanawhelan closed 2 years ago

ryanawhelan commented 2 years ago
Add ability to pull font metadata from FontAwesome API instead of icons.json since icons.json doesn't appear to be updated regularly/accurately.

Added ability to get Pro or Free icons from API Added args for pro/free, use API instead of icons.json, debug API, update example to support FontAwesome 6.0.0 update example to fully use Android v2 embedding update gradle version update kotlin plugin update compileSdkVersion

devj3ns commented 2 years ago

Hey @ryanawhelan, unfortunately it does not work for me.

By depending on your version of the package with

font_awesome_flutter:
    git: https://github.com/ryanawhelan/font_awesome_flutter

I get the following error:

Error: unable to locate asset entry in pubspec.yaml: "lib/fonts/fa-light-300.ttf".
Failed to compile application.
ryanawhelan commented 2 years ago

@devj3ns I see, I checked in the modified pubspec.yaml with the pro font files uncommented. This is fixed. Can you update and try again? configurator.sh (or bat) -defaults to none-pro version, but you would add --pro if you have the pro icons.

devj3ns commented 2 years ago

Now I don't get the error anymore, nice!

Unfortunately, I don't have access to the new icons in v6 (e.g., chart-column or mask-face). When I open my local font_awesome_flutter.dart file in /lib it also says: /// Icons based on font awesome 5.15.4.

I also tried to run the configurator.bat file manually and it says:

Error: Couldn't resolve the package 'ansicolor' in 'package:ansicolor/ansicolor.dart'.
Error: Couldn't resolve the package 'args' in 'package:args/args.dart'.
Error: Couldn't resolve the package 'recase' in 'package:recase/recase.dart'.
Error: Couldn't resolve the package 'version' in 'package:version/version.dart'.
Error: Couldn't resolve the package 'lite_graphql' in 'package:lite_graphql/lite_graphql.dart'.
util/lib/main.dart:6:8: Error: Not found: 'package:ansicolor/ansicolor.dart'
import 'package:ansicolor/ansicolor.dart';
       ^
util/lib/main.dart:7:8: Error: Not found: 'package:args/args.dart'
import 'package:args/args.dart';
       ^
util/lib/main.dart:8:8: Error: Not found: 'package:recase/recase.dart'
import 'package:recase/recase.dart';
       ^
util/lib/main.dart:9:8: Error: Not found: 'package:version/version.dart'
import 'package:version/version.dart';
       ^
util/lib/main.dart:11:8: Error: Not found: 'package:lite_graphql/lite_graphql.dart'
import 'package:lite_graphql/lite_graphql.dart';
michaelspiss commented 2 years ago

@devj3ns you need to run flutter pub get once in the main repository for pub to get all the dependencies.

michaelspiss commented 2 years ago

Hey, thanks @ryanawhelan so much for putting your effort into this. I still hope they'll bring back the icon metadata, as I see many issues with the GraphQL API approach.

You already discovered my main usability concern: We either attach this package's version to a specific version of font awesome, or the user has to enter their version number and pro/free every time they run the generator. It should also not be a necessity to have internet access to build otherwise local files (especially important for larger companies).

If you have font awesome pro and it is connected to your Github account, you can see my full reasoning here: fa-pro repository (private).

I won't merge this pull request anytime soon but will leave it open as long as we don't have a clear answer by the font awesome developers. People who need v6 right now can use this patch. Should FA decide to drop the metadata folder completely, we'll work to get your code into the main package.

I hope this sounds reasonable and is in your interest as well.

ryanawhelan commented 2 years ago

@michaelspiss

Understood. We use 6.0 and Pro so I needed this personally and was just hoping to help if other people could benefit. I can totally understand wanting to wait, but from what I have heard from other developers, the metadata (icons.json) from later 5.0 versions was not being well maintained anyway, so I think the FontAwesome people lost a lot of interest in maintaining two copies of their font metadata.

Another option would be to pull the API code out of main.dart and have it generate an icons.json file from the API. I assume this is probably what the FontAwesome people would do anyway (extract the json from their existing database, but probably not in Dart).

michaelspiss commented 2 years ago

Closing as icons.json is available again starting version 6.1.0. Nonetheless, thanks @ryanawhelan for your help bridging these months!