资源管理器

Pub.dev Badge MIT License Badge

资源管理器可以帮助你自动生成资源代码并将其添加到你的 pubspec.yaml 文件中。

快速开始

dart pub global activate asset_manager_cli

概述

要自动生成并将资源代码添加到你的 pubspec.yaml 文件中,请在项目的根目录下运行以下命令。

asset_manager add

❕注意

该 CLI 假定你的资源文件夹具有以下结构。

---assets/
     |---any_other_assets_folder
     |
     |---fonts/
           | 
           |---font1/
           |    |---font1-style-weight1.ttf
           |    |---font1-style-weight2.ttf
           |    |---font1-style-weight3.ttf
           |
           |
           |---font2/
                |---font2-style-weight1.ttf
                |---font2-style-weight2.ttf
                |---font2-style-weight3.ttf
       

除了字体之外,任何其他资源文件夹都可以根据你的需要命名。但是对于字体,你应该将它们添加到 assets 文件夹内的名为 fonts 的文件夹中。并且 fonts 文件夹内的每个文件夹都应根据 font-family 命名。每个字体文件应以以下方式命名 –

Font file name ---> font1-style-weight.ttf
                      ^     ^     ^
                      |     |     |
                      |     |   Weight of the font
                      |     |
                      |    Style of the font
                      |
                     Font family name

支持该项目

"Buy Me A Coffee"

GitHub

查看 Github