# iconfontool **Repository Path**: SecondaryMarquis/iconfontool ## Basic Information - **Project Name**: iconfontool - **Description**: convert ali iconfont to flutter Icon font - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-09-28 - **Last Updated**: 2024-12-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ### description A command-line tool that generates a Flutter Icon class from fonts obtained from iconfont.cn. ### usage 1、add iconfontool to dev dependenceis ```yaml dev_dependencies: iconfontool: latest ``` 2、add fonts assets which download from iconfont.cn to flutter ![download fonts asset from iconfont.cn](./art/iconfont1.png) Basically only need the iconfont.tts and iconfont.json file, and you can rename it according to your preference. ```yaml flutter: fonts: - family: iconfont fonts: - asset: assets/fonts/shiny_music.ttf ``` 3、config iconfontool iconfontool support seperate yaml or integrate into pubspec.yaml ```yaml iconfontool: - json_path: assets/fonts/iconfont.json # including icons information font_family: shiny_music # set font family font_path: assets/fonts/shiny_music.ttf # the font asset file path icon_class: ShinyMusic # generated dart class name out_dir: lib/fonts/shiny/ # generated file output dir - json_path: assets/fonts/iconfont.json # including icons information font_family: shiny_music2 # set font family font_path: assets/fonts/shiny_music.ttf # the font asset file path icon_class: ShinyMusic2 # generated dart class name out_dir: lib/fonts/shiny/ # generated file output dir ``` or seperate yaml iconfontool.yaml ```yaml - json_path: assets/fonts/iconfont.json # including icons information font_family: shiny_music # set font family font_path: assets/fonts/shiny_music.ttf # the font asset file path icon_class: ShinyMusic # generated dart class name out_dir: lib/fonts/shiny/ # generated file output dir - json_path: assets/fonts/iconfont.json # including icons information font_family: shiny_music2 # set font family font_path: assets/fonts/shiny_music.ttf # the font asset file path icon_class: ShinyMusic2 # generated dart class name out_dir: lib/fonts/shiny/ # generated file output dir ``` 4、generate ```sh flutter pub run iconfontool # flutter pub run iconfontool -c iconfontool.yaml ```