Closed timkandel closed 1 year ago
I'll try to add a pull request for the fallback method. Hope to find some time soonish :-)
Hi @timkandel and thanks for the feedback! I changed the function so it returns null if no icon is found. This way everyone can decide themselves how to treat missing icons by simply wrapping the function like
IconData customGetIconFromCss(String cssClasses) {
return getIconFromCss(cssClasses) ?? FontAwesomeIcons.circleQuestion; // FontAwesomeIcons.circleQuestion being the placeholder icon here
}
This is definitely a much better solution that also eliminates the issue.
Describe the bug If I generate my dynamic icon mapping file
name_icon_mapping.dart
while excluding the regular font it will lead into an error during build time. If no icon with the corresponding css class is found, the methodgetIconFromCss
will returnFontAwesomeIcons.circleQuestion
as a default.To Reproduce Steps to reproduce the behavior:
$ configurator.sh --dynamic --exclude regular
import 'package:font_awesome_flutter/name_icon_mapping.dart';
font_awesome_flutter/lib/name_icon_mapping.dart:36:26: Error: Member not found: 'circleQuestion'.
Expected behavior The method generating the code for
getIconFromCss
should have some kind of fallback behavior to use an icon from an available font. Maybe regular -> solid -> light -> thin? Even better would be to include a custom icon that's obviously broken / not from font awesome to avoid the very small problem if I want to include circle-question and something is wrong.