搜索插件、代码仓与 APP 分类

插件详情v1.0.2

font_mapper

一个 Dart 命令行工具,可自动扫描字体资源并更新 pubspec.yaml 文件中的 `fonts:` 部分。

AndroidiOSmacOSWindowsLinux
近 30 天下载
40
喜欢数
9
Pub 分数
140

安装插件

flutter pub add font_mapper

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Font Mapper 是一个 Dart 命令行工具,旨在简化 Flutter 项目中的字体资源管理。它会自动扫描本地字体文件,并更新 pubspec.yaml 文件中的 `fonts:` 部分,从而消除手动配置的需要。对于包含大量或频繁更改字体的项目来说,它非常理想,能够确保一致性并减少设置时间。该工具支持所有主要平台,包括 Android、iOS、macOS、Windows 和 Linux,使其在各种开发环境中都具有高度灵活性。通过与 Flutter 的构建流程无缝集成,Font Mapper 提升了开发者的生产力,并减少了配置错误。

适合场景

  • 自动注册字体资源
  • 添加新字体后更新 pubspec.yaml
  • 在团队间保持一致的字体配置
  • 减少字体设置中的手动错误
  • 通过字体更改优化 CI/CD 工作流程

主要特点

  • 自动检测项目中的字体文件
  • 自动更新 pubspec.yaml
  • 支持多个平台
  • 命令行界面,便于集成
  • 保留现有的字体配置结构

适合对象

  • Flutter 开发人员管理多个字体
  • 需要一致字体设置的团队
  • 涉及字体资源的 CI/CD 流水线
  • 寻求减少手动 pubspec 编辑的开发者
  • 频繁更新字体的项目

使用建议

  • 需要命令行访问
  • 可能需要权限来修改 pubspec.yaml
  • 不适用于非 Dart 项目
  • 依赖于正确的字体文件命名约定
  • 应在共享仓库中谨慎使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Font Mapper 🧩

A Dart CLI tool to scan font files and auto-generate the fonts: section in your pubspec.yaml.

🔧 Installation

dart pub global activate font_mapper

🚀 Usage

🔧 Basic
font_mapper

This scans assets/fonts and updates the fonts: section in pubspec.yaml.

🛠 With options
font_mapper -t pubspec.yaml -d assets/my_fonts

-t / --target: Target YAML file (default: pubspec.yaml)

-d / --dir: Directory containing font files (default: assets/fonts)

-h / --help: Show help

📂 Supported Fonts

.ttf, .otf formats

Supports multi-family directories

📄 Output Example

If you have:

assets/fonts/
├── SF-Pro-Display-BoldItalic.ttf
├── SF-Pro-Display-Regular.ttf
├── Inter-Light.otf

Running font_mapper generates:

flutter:
  fonts:
    - family: SF-Pro-Display
      fonts:
        - asset: assets/fonts/SF-Pro-Display-BoldItalic.ttf
          weight: 700
          style: italic
        - asset: assets/fonts/SF-Pro-Display-Regular.ttf
          weight: 400
    - family: Inter
      fonts:
        - asset: assets/fonts/Inter-Light.otf
          weight: 300

🔐 License

MIT License. See LICENSE.

🧑‍💻 Contributing

Feel free to open PRs or issues on GitHub!

Sponsoring

Buy Me A Coffee

OR

7ezgif-5-20a8a8001a

所属分类

依赖

依赖清单 1 项

源码仓库

使用此插件的项目

暂无相关数据。