/// 学习进度模型 class LearningProgress { final String id; final String title; final String category; final int totalWords; final int learnedWords; final double progress; final DateTime? lastStudyDate; LearningProgress({ required this.id, required this.title, required this.category, required this.totalWords, required this.learnedWords, required this.progress, this.lastStudyDate, }); factory LearningProgress.fromJson(Map json) { return LearningProgress( id: json['id'] as String? ?? '', title: json['title'] as String? ?? '', category: json['category'] as String? ?? '', totalWords: json['total_words'] as int? ?? 0, learnedWords: json['learned_words'] as int? ?? 0, progress: (json['progress'] as num?)?.toDouble() ?? 0.0, lastStudyDate: json['last_study_date'] != null ? DateTime.tryParse(json['last_study_date'] as String) : null, ); } Map toJson() { return { 'id': id, 'title': title, 'category': category, 'total_words': totalWords, 'learned_words': learnedWords, 'progress': progress, 'last_study_date': lastStudyDate?.toIso8601String(), }; } String get progressPercentage => '${(progress * 100).toInt()}%'; }