@@ -194,7 +194,7 @@ void adjustPubspecFontIncludes(Set<String> styles) {
194
194
if (! line.trimLeft ().startsWith ('- family:' )) continue ;
195
195
196
196
styleName = line.substring (25 ).toLowerCase (); // - family: FontAwesomeXXXXXX
197
- if (styles.contains ( styleName)) {
197
+ if (styles.any ((element) => element. replaceAll ( ' ' , '' ) == styleName)) { //Because of 'sharp thin' we need to remove spaces here
198
198
pubspec[i] = uncommentYamlLine (pubspec[i]);
199
199
pubspec[i + 1 ] = uncommentYamlLine (pubspec[i + 1 ]);
200
200
pubspec[i + 2 ] = uncommentYamlLine (pubspec[i + 2 ]);
@@ -445,7 +445,7 @@ String normalizeIconName(String iconName, String style, int styleCompetitors) {
445
445
446
446
/// Utility function to generate the correct 'IconData' subclass for a [style]
447
447
String styleToDataSource (String style) {
448
- return 'IconData${style [0 ].toUpperCase ()}${ style .substring (1 )}' ;
448
+ return 'IconData${style . split ( ' ' ). map (( word ) => word . isNotEmpty ? word [0 ].toUpperCase () + word .substring (1 ) : '' ). toList (). join ( '' )}' ;
449
449
}
450
450
451
451
/// Gets the default branch from github's metadata
@@ -556,13 +556,25 @@ bool readAndPickMetadata(File iconsJson, List<IconMetadata> metadata,
556
556
versions.add (v);
557
557
}
558
558
559
- List <String > iconStyles = (icon['styles' ] as List ).cast <String >();
560
-
559
+ List <String > iconStyles = [];
560
+ if (icon.containsKey ("styles" )) {
561
+ iconStyles = (icon['styles' ] as List ).cast <String >();
562
+ } else if (icon.containsKey ("svgs" )) {
563
+ iconStyles.addAll ((icon['svgs' ]['classic' ] as Map <String , dynamic >).keys);
564
+ if (icon['svgs' ]? ['sharp' ] != null ) {
565
+ iconStyles.addAll ((icon['svgs' ]['sharp' ] as Map <String , dynamic >).keys.map ((key) => 'sharp $key ' )); //"sharp thin ..."
566
+ }
567
+ }
561
568
//TODO: Remove line once duotone support discontinuation notice is removed
562
569
if (iconStyles.contains ('duotone' )) hasDuotoneIcons = true ;
563
570
564
571
for (var excluded in excludedStyles) {
565
- iconStyles.remove (excluded);
572
+ if (excluded == 'sharp' ) {
573
+ //Since it's 'sharp thin' then remove any containing sharp
574
+ iconStyles.removeWhere ((element) => element.contains ('sharp' ));
575
+ } else {
576
+ iconStyles.remove (excluded);
577
+ }
566
578
}
567
579
568
580
if (iconStyles.isEmpty) continue ;
@@ -628,7 +640,7 @@ ArgParser setUpArgParser() {
628
640
argParser.addMultiOption ('exclude' ,
629
641
abbr: 'e' ,
630
642
defaultsTo: [],
631
- allowed: ['brands' , 'regular' , 'solid' , 'duotone' , 'light' , 'thin' ],
643
+ allowed: ['brands' , 'regular' , 'solid' , 'duotone' , 'light' , 'thin' , 'sharp' ],
632
644
help: 'icon styles which are excluded by the generator' );
633
645
634
646
argParser.addFlag ('dynamic' ,
0 commit comments