chatapp3-flutter/lib/app/config/asset_loader.dart
2026-04-09 21:32:23 +08:00

28 lines
683 B
Dart

/// 资源加载器
class AssetLoader {
/// 获取资源路径
/// [path] 相对路径,如 'sc_images/icon.png'
static String getAssetPath(String path) {
return 'assets/$path';
}
/// 获取图片资源路径
static String image(String path) {
return getAssetPath('sc_images/$path');
}
/// 获取本地化文件路径
static String localization(String path) {
return getAssetPath('l10n/$path');
}
/// 获取配置文件路径
static String config(String path) {
return getAssetPath('config/$path');
}
/// 获取共享资源路径
static String shared(String path) {
return 'assets/shared/$path';
}
}