188 lines
4.8 KiB
Dart
188 lines
4.8 KiB
Dart
class SectionModel {
|
|
SectionModel({
|
|
this.status,
|
|
this.error,
|
|
this.progress,
|
|
required this.data,
|
|
});
|
|
|
|
int? status;
|
|
bool? error;
|
|
int? progress;
|
|
List<Map<String, Datum>> data;
|
|
|
|
factory SectionModel.fromJson(Map<String, dynamic> json) => SectionModel(
|
|
status: json["status"],
|
|
error: json["error"],
|
|
progress: json["progress"],
|
|
data: List<Map<String, Datum>>.from(json["data"].map((x) => Map.from(x)
|
|
.map((k, v) => MapEntry<String, Datum>(k, Datum.fromJson(v))))),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"status": status,
|
|
"error": error,
|
|
"progress": progress,
|
|
"data": List<dynamic>.from(data.map((x) => Map.from(x)
|
|
.map((k, v) => MapEntry<String, dynamic>(k, v.toJson())))),
|
|
};
|
|
}
|
|
|
|
class Datum {
|
|
Datum({
|
|
this.sectionTitle,
|
|
this.dataLesson,
|
|
});
|
|
|
|
String? sectionTitle;
|
|
List<DataLesson>? dataLesson;
|
|
|
|
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
|
|
sectionTitle: json["section_title"],
|
|
dataLesson: List<DataLesson>.from(
|
|
json["data_lesson"].map((x) => DataLesson.fromJson(x))),
|
|
);
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"section_title": sectionTitle,
|
|
"data_lesson": List<dynamic>.from(dataLesson!.map((x) => x.toJson())),
|
|
};
|
|
}
|
|
|
|
class DataLesson {
|
|
DataLesson(
|
|
{this.lessonId,
|
|
this.title,
|
|
this.duration,
|
|
this.progress,
|
|
this.attachmentType,
|
|
this.videoType,
|
|
this.videoUrl,
|
|
this.lessonType,
|
|
this.attachment,
|
|
this.isSkip,
|
|
this.isFinished,
|
|
this.summary});
|
|
|
|
String? progress;
|
|
String? lessonId;
|
|
String? title;
|
|
String? duration;
|
|
String? attachmentType;
|
|
String? videoType;
|
|
String? videoUrl;
|
|
String? lessonType;
|
|
dynamic attachment;
|
|
String? isSkip;
|
|
String? summary;
|
|
int? isFinished;
|
|
|
|
factory DataLesson.fromJson(Map<String, dynamic> json) => DataLesson(
|
|
lessonId: json["lesson_id"],
|
|
title: json["title"],
|
|
duration: json["duration"],
|
|
progress: json["progress_video"],
|
|
attachmentType: json["attachment_type"],
|
|
videoType: json["video_type"],
|
|
videoUrl: json["video_url"],
|
|
lessonType: json["lesson_type"],
|
|
attachment: json["attachment"],
|
|
isSkip: json["is_skip"],
|
|
isFinished: json["is_finished"],
|
|
summary: json["summary"],
|
|
);
|
|
|
|
get courseId => null;
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"lesson_id": lessonId,
|
|
"title": title,
|
|
"duration": duration,
|
|
"progress_video": progress,
|
|
"attachment_type": attachmentType,
|
|
"video_type": videoType,
|
|
"video_url": videoUrl,
|
|
"lesson_type": lessonType,
|
|
"attachment": attachment,
|
|
"is_skip": isSkip,
|
|
"is_finished": isFinished,
|
|
"summary": summary,
|
|
};
|
|
}
|
|
|
|
class NewMap {
|
|
NewMap({
|
|
required this.title,
|
|
});
|
|
|
|
final List<Title> title;
|
|
|
|
factory NewMap.fromMap(Map<String, dynamic> json) => NewMap(
|
|
title: List<Title>.from(json["Title"].map((x) => Title.fromMap(x))),
|
|
);
|
|
|
|
Map<String, dynamic> toMap() => {
|
|
"Title": List<dynamic>.from(title.map((x) => x.toMap())),
|
|
};
|
|
}
|
|
|
|
class Title {
|
|
Title({
|
|
this.courseId,
|
|
this.lessonId,
|
|
this.sectionTitle,
|
|
this.lessonTitle,
|
|
this.duration,
|
|
this.attachmentType,
|
|
this.videoType,
|
|
this.videoUrl,
|
|
this.lessonType,
|
|
this.attachment,
|
|
this.isSkip,
|
|
this.isFinished,
|
|
});
|
|
|
|
final String? courseId;
|
|
final String? lessonId;
|
|
final String? sectionTitle;
|
|
final String? lessonTitle;
|
|
final String? duration;
|
|
final String? attachmentType;
|
|
final String? videoType;
|
|
final String? videoUrl;
|
|
final String? lessonType;
|
|
final dynamic attachment;
|
|
final String? isSkip;
|
|
final int? isFinished;
|
|
|
|
factory Title.fromMap(Map<String, dynamic> json) => Title(
|
|
courseId: json["course_id"],
|
|
lessonId: json["lesson_id"],
|
|
sectionTitle: json["section_title"],
|
|
lessonTitle: json["lesson_title"],
|
|
duration: json["duration"],
|
|
attachmentType: json["attachment_type"],
|
|
videoType: json["video_type"],
|
|
videoUrl: json["video_url"] == '' ? 'a' : json["video_url"],
|
|
lessonType: json["lesson_type"],
|
|
attachment: json["attachment"],
|
|
isSkip: json["is_skip"],
|
|
isFinished: json["is_finished"],
|
|
);
|
|
|
|
Map<String, dynamic> toMap() => {
|
|
"course_id": courseId,
|
|
"lesson_id": lessonId,
|
|
"section_title": sectionTitle,
|
|
"lesson_title": lessonTitle,
|
|
"duration": duration,
|
|
"attachment_type": attachmentType,
|
|
"video_type": videoType,
|
|
"video_url": videoUrl,
|
|
"lesson_type": lessonType,
|
|
"attachment": attachment,
|
|
"is_skip": isSkip,
|
|
"is_finished": isFinished,
|
|
};
|
|
}
|