validateTheme method
验证主题完整性
Implementation
Future<Map<String, dynamic>> validateTheme(String themeId) async {
final theme = _themes[themeId];
if (theme == null) {
return {'valid': false, 'error': 'Theme not found'};
}
try {
// 验证资源文件是否存在
final resourceValidation =
await theme.resourceManager.validateResources();
final missingResources =
resourceValidation.entries
.where((entry) => !entry.value)
.map((entry) => entry.key)
.toList();
return {
'valid': missingResources.isEmpty,
'missingResources': missingResources,
'resourceValidation': resourceValidation,
};
} catch (e) {
return {'valid': false, 'error': 'Validation failed: $e'};
}
}