podSpecAndFoldersGenerator top-level property
生成 podspec 文件和文件夹的生成器
Implementation
final FigGenerator podSpecAndFoldersGenerator = FigGenerator(
template: ['filepaths'],
filterTemplateSuggestions: (suggestions, context) {
return suggestions.whereType<FigSuggestion>().where((suggestion) {
final name = suggestion.nameSingle;
if (name == null) return false;
// 检查是否为 podspec 文件
if (name.endsWith('.podspec')) {
return true;
}
// 或者检查是否为文件夹(以 / 结尾)
if (name.endsWith('/')) {
return true;
}
return false;
}).map((suggestion) {
if (suggestion.nameSingle?.endsWith('.podspec') ?? false) {
// 对于 podspec 文件,使用 Ruby 图标
return FigSuggestion(
name: suggestion.nameSingle,
icon: POD_ICON,
type: SuggestionType.file,
priority: suggestion.priority ?? 50,
);
}
// 对于文件夹,保持原样或添加文件夹图标
return suggestion;
}).toList();
},
);