diff --git a/scripts/generators/generateFonts.ts b/scripts/generators/generateFonts.ts
index fb700fe2..ffca1f03 100644
--- a/scripts/generators/generateFonts.ts
+++ b/scripts/generators/generateFonts.ts
@@ -107,11 +107,7 @@ const buildFontFile = async (type: FontType, fontResult: GenerateFontResult, inp
* @returns {string} Dart definition line used in body of `Icons.dart`.
*/
function getDartIconDefinition(iconName: string, unicode: string, type: FontType | undefined): string {
- const name_link = `${iconName}_${type === undefined ? "round" : type}`;
- const readableName = iconName
- .split("_")
- .map((e) => e.capitalize())
- .join(" ");
+ const iconPreview = getIconPreview(iconName, type);
if (type == undefined) {
iconName = iconName.toSnakeCase();
@@ -119,10 +115,19 @@ function getDartIconDefinition(iconName: string, unicode: string, type: FontType
iconName = getIconFileName(iconName, type);
}
- return ` /// ${readableName} icon ${
- type != undefined ? `(${type})` : ""
- }
+ return `${iconPreview}
static const IconData ${iconName} = IconData(0x${unicode}, fontFamily: family${
type?.capitalize() ?? ""
}, fontPackage: package);`;
}
+
+function getIconPreview(iconName: string, type: FontType | undefined) {
+ const name_link = `${iconName}_${type === undefined ? "round" : type}`;
+ const readableName = iconName
+ .split("_")
+ .map((e) => e.capitalize())
+ .join(" ");
+ return ` /// ${readableName} icon ${
+ type != undefined ? `(${type})` : ""
+ }`;
+}