Skip to content

pantoken / packages/core/src / flutterIconManifest

函数: flutterIconManifest()

flutterIconManifest(names, assetDir?): string

Beta

flutter_svg 构建一个 Flutter/Dart 图标资源路径清单。 与复制到 assetDir 下的原始 SVG 配对。

参数

names

readonly string[]

图标名称。

assetDir?

string = "assets/pantoken/icons"

SVG 被复制到的资源目录(默认 assets/pantoken/icons)。

返回值

string

声明 PanTokensIcons 资产路径常量类的 Dart 源代码。

示例

默认资源目录

ts
import { flutterIconManifest } from "@pantoken/core";

flutterIconManifest(["arrow-left", "check-mark"]);
// → class PanTokensIcons {
//     static const String arrowLeft = 'assets/pantoken/icons/arrow-left.svg';
//     static const String checkMark = 'assets/pantoken/icons/check-mark.svg';
//   }

自定义资源目录

ts
import { flutterIconManifest } from "@pantoken/core";

flutterIconManifest(["arrow-left"], "lib/icons");
// → static const String arrowLeft = 'lib/icons/arrow-left.svg';