新增精灵图贴纸类型及内置资源 优化分类图标使用SVG替代emoji 实现分页预加载功能 修复API基础地址与客户端一致 新增健康生活、国学经典服务模块 扩展Feed频道至44种并整合互动统计 修正多处UI显示问题及逻辑错误
54 lines
1.8 KiB
Dart
54 lines
1.8 KiB
Dart
// ============================================================
|
|
// 闲言APP — 生成内置精灵图占位资源
|
|
// 创建时间: 2026-04-29
|
|
// 作用: 为每个内置精灵图贴纸生成占位 PNG 文件
|
|
// ============================================================
|
|
|
|
import 'dart:io';
|
|
import 'dart:typed_data';
|
|
|
|
/// 生成 1x1 透明 PNG 字节
|
|
Uint8List _transparent1x1Png() {
|
|
return Uint8List.fromList([
|
|
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
|
|
0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
|
|
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
|
|
0x08, 0x06, 0x00, 0x00, 0x00, 0x1F, 0x15, 0xC4,
|
|
0x89, 0x00, 0x00, 0x00, 0x0A, 0x49, 0x44, 0x41,
|
|
0x54, 0x78, 0x9C, 0x62, 0x00, 0x00, 0x00, 0x02,
|
|
0x00, 0x01, 0xE5, 0x27, 0xDE, 0xFC, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE,
|
|
0x42, 0x60, 0x82,
|
|
]);
|
|
}
|
|
|
|
void main() {
|
|
final baseDir = 'assets/spritesheets/builtin';
|
|
|
|
final stickers = <String, List<String>>{
|
|
'emotions': ['happy', 'sad', 'angry', 'surprised', 'love', 'cool', 'think', 'sleep'],
|
|
'gestures': ['thumbsup', 'ok', 'wave', 'fist', 'clap', 'peace'],
|
|
'nature': ['fire', 'water', 'lightning', 'leaf', 'snow', 'star'],
|
|
'festive': ['firework', 'confetti', 'lantern', 'gift', 'balloon', 'heart'],
|
|
};
|
|
|
|
int count = 0;
|
|
for (final entry in stickers.entries) {
|
|
final dir = Directory('$baseDir/${entry.key}');
|
|
if (!dir.existsSync()) dir.createSync(recursive: true);
|
|
|
|
for (final name in entry.value) {
|
|
final file = File('${dir.path}/$name.png');
|
|
if (!file.existsSync()) {
|
|
file.writeAsBytesSync(_transparent1x1Png());
|
|
count++;
|
|
print('✅ ${file.path}');
|
|
} else {
|
|
print('⏭️ ${file.path} (已存在)');
|
|
}
|
|
}
|
|
}
|
|
|
|
print('\n生成完成: $count 个占位精灵图文件');
|
|
}
|