Initial commit: Penyerahan final Source code Tugas Akhir

This commit is contained in:
ferdiakhh
2025-07-10 19:15:14 +07:00
commit e1f2206b8a
687 changed files with 80132 additions and 0 deletions

0
lib/models/.gitkeep Normal file
View File

157
lib/models/Product.dart Normal file
View File

@ -0,0 +1,157 @@
// import 'package:flutter/material.dart';
// import '../size_config.dart';
// import '../theme.dart';
// // class Product {
// // final int id;
// // final String title;
// // final RichText description;
// // final List<String> images;
// // final List<Color> colors;
// // final double rating, price, disc;
// // final bool isFavourite, isPopular;
// // Product({
// // required this.id,
// // required this.images,
// // required this.colors,
// // this.rating = 0.0,
// // this.isFavourite = false,
// // this.isPopular = false,
// // required this.title,
// // required this.price,
// // required this.disc,
// // required this.description,
// // });
// // }
// // Our demo Products
// final TextStyle light = primaryTextStyle.copyWith(
// letterSpacing: 0.5,
// color: secondaryColor,
// fontSize: getProportionateScreenWidth(10),
// fontWeight: reguler);
// final TextStyle thick = primaryTextStyle.copyWith(
// letterSpacing: 0.5,
// color: secondaryColor,
// fontSize: getProportionateScreenWidth(10),
// fontWeight: semiBold);
// List<Product> demoProducts = [
// Product(
// id: 1,
// images: [
// "assets/images/Kur1.png",
// ],
// colors: [
// Color(0xFFF6625E),
// Color(0xFF836DB8),
// Color(0xFFDECB9C),
// Colors.white,
// ],
// title: "Menjadi Pengusaha Sukses dan Bertalenta",
// price: 250000,
// disc: 1250000,
// description: RichText(
// text: new TextSpan(
// // Note: Styles for TextSpans must be explicitly defined.
// // Child text spans will inherit styles from parent
// style: TextStyle(
// fontSize: 10, color: Colors.white, fontWeight: FontWeight.w300),
// //maxLines: 1,
// children: <TextSpan>[
// new TextSpan(text: 'Oleh ', style: light),
// new TextSpan(text: 'Farid Subkhan', style: thick),
// ],
// ),
// ),
// rating: 4.8,
// isFavourite: true,
// isPopular: true,
// ),
// Product(
// id: 2,
// images: [
// "assets/images/Kur2.png",
// ],
// colors: [
// Color(0xFFF6625E),
// Color(0xFF836DB8),
// Color(0xFFDECB9C),
// Colors.white,
// ],
// title: "Kiat Menjadi Youtuber",
// price: 500500,
// disc: 1500000,
// description: RichText(
// text: new TextSpan(
// // Note: Styles for TextSpans must be explicitly defined.
// // Child text spans will inherit styles from parent
// style: TextStyle(fontSize: 10, fontWeight: FontWeight.w300),
// children: <TextSpan>[
// new TextSpan(text: 'Oleh ', style: light),
// new TextSpan(text: 'Farid Subkhan', style: thick),
// ],
// ),
// ),
// rating: 4.1,
// isPopular: true,
// ),
// Product(
// id: 3,
// images: [
// "assets/images/Kur3.png",
// ],
// colors: [
// Color(0xFFF6625E),
// Color(0xFF836DB8),
// Color(0xFFDECB9C),
// Colors.white,
// ],
// title: "Menjadi Pengusaha Sukses dan Berjiwa Entrepreneur",
// price: 365500,
// disc: 1500000,
// description: RichText(
// text: new TextSpan(
// // Note: Styles for TextSpans must be explicitly defined.
// // Child text spans will inherit styles from parent
// style: TextStyle(fontSize: 10, fontWeight: FontWeight.w300),
// children: <TextSpan>[
// new TextSpan(text: 'Oleh ', style: light),
// new TextSpan(text: 'Ali Sanjani', style: thick),
// ],
// ),
// ),
// rating: 4.1,
// isFavourite: true,
// isPopular: true,
// ),
// Product(
// id: 4,
// images: [
// "assets/images/Kur4.png",
// ],
// colors: [
// Color(0xFFF6625E),
// Color(0xFF836DB8),
// Color(0xFFDECB9C),
// Colors.white,
// ],
// title: "Menguasai Excel dengan Cepat dan Handal Banget",
// price: 200500,
// disc: 1000000,
// description: RichText(
// text: new TextSpan(
// // Note: Styles for TextSpans must be explicitly defined.
// // Child text spans will inherit styles from parent
// style: TextStyle(fontSize: 10, fontWeight: FontWeight.w300),
// children: <TextSpan>[
// new TextSpan(text: 'Oleh ', style: light),
// new TextSpan(text: 'Ali Sanjani', style: thick),
// ],
// ),
// ),
// rating: 4.1,
// isFavourite: true,
// isPopular: true,
// ),
// ];

View File

@ -0,0 +1,38 @@
class ProductProgram {
final int id;
final List<String> images;
ProductProgram({
required this.id,
required this.images,
});
}
// Our demo Products
List<ProductProgram> demoProducts = [
ProductProgram(
id: 1,
images: [
"assets/images/workshop.png",
],
),
ProductProgram(
id: 2,
images: [
"assets/images/prakerja.png",
],
),
ProductProgram(
id: 3,
images: [
"assets/images/workshop.png",
],
),
ProductProgram(
id: 4,
images: [
"assets/images/prakerja.png",
],
),
];

View File

@ -0,0 +1,338 @@
import 'package:initial_folder/models/reply_announcement_model.dart';
class AnnouncementModel {
AnnouncementModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final List<List<AnnouncementDataModel>> data;
factory AnnouncementModel.fromJson(Map<String, dynamic> json) =>
AnnouncementModel(
status: json["status"],
error: json["error"],
data: List<List<AnnouncementDataModel>>.from(json["data"].map((x) =>
List<AnnouncementDataModel>.from(
x.map((x) => AnnouncementDataModel.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(
data.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
};
}
class AnnouncementDataModel {
AnnouncementDataModel({
this.idAnnouncement,
this.tokenAnnouncement,
this.instructorName,
this.fotoProfile,
this.bodyContent,
this.countLike,
this.likes,
this.isLike,
this.comment,
this.date,
required this.replies,
});
final String? idAnnouncement;
final String? tokenAnnouncement;
final String? instructorName;
final String? fotoProfile;
final String? bodyContent;
final String? countLike;
final bool? likes;
final int? isLike;
final int? comment;
final String? date;
final List<ReplyModel> replies;
factory AnnouncementDataModel.fromJson(Map<String, dynamic> json) =>
AnnouncementDataModel(
idAnnouncement: json["id_announcement"],
tokenAnnouncement: json["token_announcement"],
instructorName: json["instructor_name"],
bodyContent: json["body"],
fotoProfile: json["foto_profile"],
likes: json["likes"].length > 0,
isLike: json["is_like"],
countLike: json["count_likes"],
comment: json["comment"],
date: json["date"],
replies: List<ReplyModel>.from(
json["replies"].map((x) => ReplyModel.fromJson(x))).toList(),
);
Map<String, dynamic> toJson() => {
"id_announcement": idAnnouncement,
"token_announcement": tokenAnnouncement,
"instructor_name": instructorName,
"body": bodyContent,
"foto_profile": fotoProfile,
"likes": likes,
"is_like": isLike,
"comment": comment,
"date": date,
"replies": List<ReplyModel>.from(replies.map((x) => x)),
};
}
class AnnouncementPostModel {
AnnouncementPostModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final DataPostAnnouncement data;
factory AnnouncementPostModel.fromJson(Map<String, dynamic> json) =>
AnnouncementPostModel(
status: json["status"],
error: json["error"],
data: DataPostAnnouncement.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": data.toJson(),
};
}
class DataPostAnnouncement {
DataPostAnnouncement({this.idUser, this.idCourse, this.body});
final String? idUser;
final String? idCourse;
final String? body;
factory DataPostAnnouncement.fromJson(Map<String, dynamic> json) =>
DataPostAnnouncement(
idUser: json["id_user"],
idCourse: json["course_id"],
body: json["body"],
);
Map<String, dynamic> toJson() => {
"id_user": idUser,
"id_course": idCourse,
"body": body,
};
}
class AnnouncementLikeModel {
AnnouncementLikeModel({
this.userLikes,
});
final String? userLikes;
factory AnnouncementLikeModel.fromJson(Map<String, dynamic> json) =>
AnnouncementLikeModel(
userLikes: json["user_likes"],
);
Map<String, dynamic> toJson() => {
"user_likes": userLikes,
};
}
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.attachmentType,
this.videoType,
this.videoUrl,
this.lessonType,
this.attachment,
this.isSkip,
this.isFinished,
this.summary,
});
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"],
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,
"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,
this.summary,
});
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 String? summary;
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"],
summary: json["summary"],
);
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,
"summary": summary,
};
}

View File

@ -0,0 +1,30 @@
class BannersModel {
BannersModel({
this.id,
this.status,
this.img,
this.url,
this.courseId = '',
});
String? id;
String? status;
String? img;
String? url;
String courseId = '';
BannersModel.fromJson(Map<String, dynamic> json) {
id = json["id"];
status = json["status"];
img = json["img"];
url = json["url"];
courseId = json["course_id"] ?? '';
}
Map<String, dynamic> toJson() => {
'id': id,
'status': status,
'img': img,
'url': url,
'course_id': courseId,
};
}

View File

@ -0,0 +1,39 @@
class CartModel {
CartModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final Data data;
factory CartModel.fromJson(Map<String, dynamic> json) => CartModel(
status: json["status"],
error: json["error"],
data: Data.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": data.toJson(),
};
}
class Data {
Data({
this.messages,
});
final String? messages;
factory Data.fromJson(Map<String, dynamic> json) => Data(
messages: json["messages"],
);
Map<String, dynamic> toJson() => {
"messages": messages,
};
}

165
lib/models/carts_model.dart Normal file
View File

@ -0,0 +1,165 @@
import 'package:equatable/equatable.dart';
class CartsModel extends Equatable {
CartsModel({
this.status,
this.error,
required this.data,
this.totalPayment,
this.potonganKupon,
});
final int? status;
final bool? error;
final List<DataCartsModel> data;
final int? potonganKupon;
final String? totalPayment;
factory CartsModel.fromJson(Map<String, dynamic> json) => CartsModel(
status: json["status"],
error: json["error"],
data: List<DataCartsModel>.from(
json["data"].map((x) => DataCartsModel.fromJson(x))),
potonganKupon: json["potongan_kupon"],
totalPayment: json["total_payment"],
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(data.map((x) => x.toJson())),
"total_payment": totalPayment,
};
@override
// TODO: implement props
List<Object?> get props => [];
}
class DataCartsModel extends Equatable {
DataCartsModel({
this.cartId,
this.courseId,
this.title,
this.price,
this.instructor,
this.thumbnail,
this.discountPrice,
this.discountFlag,
this.totalDiscount,
this.student,
required this.review,
this.fotoProfile,
this.coupon,
this.finalPrice,
this.potonganKupon,
});
final String? cartId;
final String? courseId;
final String? title;
final String? price;
final String? instructor;
final String? thumbnail;
final String? discountPrice;
final String? discountFlag;
final int? totalDiscount;
final String? student;
final List<Review> review;
final dynamic fotoProfile;
final Coupon? coupon;
final String? finalPrice;
final String? potonganKupon;
factory DataCartsModel.fromJson(Map<String, dynamic> json) => DataCartsModel(
cartId: json["cart_id"],
courseId: json["course_id"],
title: json["title"],
price: json["price"],
instructor: json["instructor"],
thumbnail: json["thumbnail"],
discountPrice: json["discount_price"],
discountFlag: json["discount_flag"],
totalDiscount: json["total_discount"],
student: json["student"],
review:
List<Review>.from(json["review"].map((x) => Review.fromJson(x))),
fotoProfile: json["foto_profile"],
coupon: json["coupon"] == null ? null : Coupon.fromJson(json["coupon"]),
potonganKupon: json["potongan_kupon"],
finalPrice: json["final_price"],
);
Map<String, dynamic> toJson() => {
"cart_id": cartId,
"course_id": courseId,
"title": title,
"price": price,
"instructor": instructor,
"thumbnail": thumbnail,
"discount_price": discountPrice,
"discount_flag": discountFlag,
"total_discount": totalDiscount,
"student": student,
"review": List<dynamic>.from(review.map((x) => x.toJson())),
"foto_profile": fotoProfile,
"coupon": coupon,
"final_price": finalPrice
};
@override
// TODO: implement props
List<Object?> get props => [finalPrice];
}
class Coupon {
Coupon({
this.id,
this.typeCoupon,
this.codeCoupon,
this.value,
this.finalPrice,
});
final String? id;
final String? typeCoupon;
final String? codeCoupon;
final String? value;
final int? finalPrice;
factory Coupon.fromJson(Map<String, dynamic> json) => Coupon(
id: json["id"],
typeCoupon: json["type_coupon"],
codeCoupon: json["code_coupon"],
value: json["value"],
finalPrice: json["final_price"],
);
Map<String, dynamic> toJson() => {
"id": id,
"type_coupon": typeCoupon,
"code_coupon": codeCoupon,
"value": value,
"final_price": finalPrice,
};
}
class Review {
Review({
this.totalReview,
this.avgRating,
});
final String? totalReview;
final int? avgRating;
factory Review.fromJson(Map<String, dynamic> json) => Review(
totalReview: json["total_review"],
avgRating: json["avg_rating"] == null ? null : json["avg_rating"],
);
Map<String, dynamic> toJson() => {
"total_review": totalReview,
"avg_rating": avgRating == null ? null : avgRating,
};
}

View File

@ -0,0 +1,47 @@
import 'package:initial_folder/models/subcategories_model.dart';
class CategoriesModel {
CategoriesModel({
this.id,
this.nameCategory,
this.slugCategory,
this.parentCategory,
this.fontAwesomeClass,
this.subCategories,
this.subId,
});
final String? id;
final String? nameCategory;
final String? slugCategory;
final String? parentCategory;
final String? fontAwesomeClass;
final String? subId;
List<SubCategoryModel>? subCategories;
factory CategoriesModel.fromJson(Map<String, dynamic> json) {
List<dynamic> subCategoriesJson = json['subcategories'] ?? [];
List<SubCategoryModel> subCategories = subCategoriesJson
.map((subCategoryJson) => SubCategoryModel.fromJson(subCategoryJson))
.toList();
return CategoriesModel(
id: json["id"],
nameCategory: json["name_category"],
slugCategory: json["slug_category"],
parentCategory: json["parent_category"],
fontAwesomeClass: json["font_awesome_class"],
subId: json["sub_category_id"],
subCategories: subCategories,
);
}
Map<String, dynamic> toJson() => {
"id": id,
"name_category": nameCategory,
"slug_category": slugCategory,
"parent_category": parentCategory,
"font_awesome_class": fontAwesomeClass,
"sub_category_id": subId
};
}

View File

@ -0,0 +1,48 @@
class CertificateModel {
final String? idPayment;
final String? name;
final String? title;
final int? finishDate;
final String? certificateNo;
CertificateModel({
this.idPayment,
this.name,
this.title,
this.finishDate,
required this.certificateNo,
});
factory CertificateModel.fromJson(Map<String, dynamic> json) =>
CertificateModel(
name: json['name'],
title: json['title'],
finishDate: json['finish_date'],
certificateNo: json['certificate_no'],
idPayment: json['id_enrol'],
);
Map<String, dynamic> toJson() => {
'id_enrol': idPayment,
'name': name,
'title': title,
'finishDate': finishDate,
'certificate_no': certificateNo,
};
}
class CertificateNo {
CertificateNo({
this.idPayment,
});
String? idPayment;
factory CertificateNo.fromJson(Map<String, dynamic> json) => CertificateNo(
idPayment: json["id_payment"],
);
Map<String, dynamic> toJson() => {
"id_payment": idPayment,
};
}

View File

@ -0,0 +1,74 @@
class CheckCertificate {
int? status;
bool? error;
List<CheckCertificateData>? data;
CheckCertificate({this.status, this.error, this.data});
CheckCertificate.fromJson(Map<String, dynamic> json) {
status = json['status'];
error = json['error'];
if (json['data'] != null) {
data = <CheckCertificateData>[];
json['data'].forEach((v) {
data!.add(new CheckCertificateData.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
data['error'] = this.error;
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
return data;
}
}
class CheckCertificateData {
String? idPayment;
String? userId;
String? courseId;
String? name;
String? title;
dynamic finishDate;
String? certificateNo;
int? progress;
CheckCertificateData({
this.idPayment,
this.userId,
this.courseId,
this.name,
this.title,
this.finishDate,
this.certificateNo,
this.progress,
});
CheckCertificateData.fromJson(Map<String, dynamic> json) {
idPayment = json['id_enrol'];
userId = json['user_id'];
courseId = json['course_id'];
name = json['name'];
title = json['title'];
finishDate = json['finish_date'];
certificateNo = json['certificate_no'];
progress = json['progress'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id_enrol'] = this.idPayment;
data['user_id'] = this.userId;
data['course_id'] = this.courseId;
data['name'] = this.name;
data['title'] = this.title;
data['finish_date'] = this.finishDate;
data['certificate_no'] = this.certificateNo;
data['progress'] = this.progress;
return data;
}
}

View File

@ -0,0 +1,51 @@
class Comment {
Comment({
this.idRep,
this.sender,
this.username,
this.textRep,
this.fotoProfile,
this.createAt,
});
String? idRep;
String? sender;
String? username;
String? textRep;
String? fotoProfile;
String? createAt;
factory Comment.fromJson(Map<String, dynamic> json) => Comment(
idRep: json["id_rep"],
sender: json["sender"],
username: json["username"],
textRep: json["text_rep"],
fotoProfile: json["foto_profile"],
createAt: json["create_at"],
);
Map<String, dynamic> toJson() => {
"id_rep": idRep,
"sender": sender,
"username": username,
"text_rep": textRep,
"foto_profile": fotoProfile,
"create_at": createAt,
};
}
class LikeModels {
LikeModels({
this.userId,
});
bool? userId;
factory LikeModels.fromJson(Map<String, dynamic> json) => LikeModels(
userId: json["user_id"].length > 0,
);
Map<String, dynamic> toJson() => {
"id_rep": userId,
};
}

View File

@ -0,0 +1,40 @@
class CounterCommentModel {
CounterCommentModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
String? data;
factory CounterCommentModel.fromJson(Map<String, dynamic> json) =>
CounterCommentModel(
status: json["status"],
error: json["error"],
data: (json["data"]["count comment "]).toString(),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": data,
};
}
// class CounterComment {
// CounterComment({
// this.countCommentQna,
// });
// String? countCommentQna;
// factory CounterComment.fromJson(Map<String, dynamic> json) => CounterComment(
// countCommentQna: json["count comment"],
// );
// Map<String, dynamic> toJson() => {
// "count comment": countCommentQna,
// };
// }

View File

@ -0,0 +1,24 @@
class CounterLikeModel {
CounterLikeModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
String? data;
factory CounterLikeModel.fromJson(Map<String, dynamic> json) =>
CounterLikeModel(
status: json["status"],
error: json["error"],
data: (json["data"]["count like "]).toString(),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": data,
};
}

View File

@ -0,0 +1,80 @@
import 'package:initial_folder/models/rating_course_model.dart';
class CourseModel {
CourseModel({
this.idCourse = '',
this.instructorId = '',
this.title = '',
this.price = '',
this.instructorName = '',
this.discountFlag,
this.discountPrice = '',
this.promoPrice = '',
this.thumbnail,
this.students,
required this.rating,
this.totalDiscount,
this.fotoProfile,
this.topCourse,
this.isFreeCourse,
});
String idCourse;
String instructorId;
String title;
String price;
String instructorName;
String? discountFlag;
String discountPrice;
String promoPrice;
String? thumbnail;
String? students;
List<Rating?> rating;
int? totalDiscount;
String? fotoProfile;
String? topCourse;
String? isFreeCourse;
factory CourseModel.fromJson(Map<String, dynamic> json) => CourseModel(
idCourse: json["id_course"] ?? '',
instructorId: json["instructor_id"] ?? '',
title: json["title"] ?? '',
price: json["price"] ?? '',
instructorName: json["instructor_name"] ?? '',
discountFlag: json["discount_flag"] ?? '',
discountPrice: json["discount_price"].toString() != "0"
? (int.parse(json["price"]) - int.parse(json["discount_price"]))
.toString()
: json["price"] ?? '',
promoPrice: json["promo_price"].toString() != '0'
? json["promo_price"].toString()
: json["promo_price"].toString(),
thumbnail: json["thumbnail"],
students: json["students"] ?? '',
rating: List<Rating>.from(json["rating"].map((x) => Rating.fromJson(x)))
.toList() ??
[],
totalDiscount: json["total_discount"] ?? 0,
fotoProfile: json["foto_profile"] ?? '',
topCourse: json["top_course"] ?? '',
isFreeCourse: json["is_free_course"] ?? '',
);
Map<String, dynamic> toJson() => {
"id_course": idCourse,
"instructor_id": instructorId,
"title": title,
"price": price,
"instructor_name": instructorName,
"discount_flag": discountFlag,
"discount_price": discountPrice,
"promo_price": promoPrice,
"thumbnail": thumbnail,
"students": students,
"rating": List<dynamic>.from(rating.map((x) => x!.toJson())).toList(),
"total_discount": totalDiscount,
"foto_profile": fotoProfile,
"top_course": topCourse,
"is_free_course": isFreeCourse,
};
}

View File

@ -0,0 +1,105 @@
class DataDiriModel {
DataDiriModel({
this.status,
this.error,
required this.data,
});
int? status;
bool? error;
List<DataOfDataDiriModel> data;
factory DataDiriModel.fromJson(Map<String, dynamic> json) => DataDiriModel(
status: json["status"],
error: json["error"],
data: List<DataOfDataDiriModel>.from(
json["data"].map((x) => DataOfDataDiriModel.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class DataOfDataDiriModel {
DataOfDataDiriModel({
this.idUser,
this.fullname,
this.headline,
this.biography,
this.datebirth,
this.email,
this.phone,
this.gender,
this.socialLink,
});
String? idUser;
String? fullname;
String? headline;
String? biography;
String? datebirth;
String? email;
String? phone;
String? gender;
SocialLink? socialLink;
factory DataOfDataDiriModel.fromJson(Map<String, dynamic> json) =>
DataOfDataDiriModel(
idUser: json["id_user"],
fullname: json["full_name"],
headline: json["headline"],
biography: json["biography"],
datebirth: json["datebirth"],
email: json["email"],
phone: json["phone"],
gender: json["jenis_kelamin"] == null
? ''
: json["jenis_kelamin"],
socialLink: json["social_link"] == null
? null
: SocialLink.fromJson(json["social_link"]),
);
Map<String, dynamic> toJson() => {
"id_user": idUser,
"full_name": fullname,
"headline": headline,
"biography": biography,
"datebirth": datebirth,
"email": email,
"phone": phone,
"jenis_kelamin": gender,
"social_link": socialLink == null ? null : socialLink!.toJson(),
};
}
class SocialLink {
SocialLink({
this.facebook,
this.twitter,
this.instagram,
this.linkedin,
});
String? facebook;
String? twitter;
String? instagram;
String? linkedin;
factory SocialLink.fromJson(Map<String, dynamic> json) => SocialLink(
facebook: json["facebook"],
twitter: json["twitter"],
instagram: json["instagram"],
linkedin: json["linkedin"],
);
Map<String, dynamic> toJson() => {
"facebook": facebook,
"twitter": twitter,
"instagram": instagram,
"linkedin": linkedin,
};
}

View File

@ -0,0 +1,85 @@
class DetailCourseCoupon {
int? status;
bool? error;
List<DataDetailCourseCoupon>? data;
DetailCourseCoupon({this.status, this.error, this.data});
DetailCourseCoupon.fromJson(Map<String, dynamic> json) {
status = json['status'];
error = json['error'];
if (json['data'] != null) {
data = <DataDetailCourseCoupon>[];
json['data'].forEach((v) {
data!.add(new DataDetailCourseCoupon.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
data['error'] = this.error;
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
return data;
}
}
class DataDetailCourseCoupon {
String? idCourse;
String? typeCoupon;
String? value;
String? discountFlag;
String? courseName;
String? instructor;
String? fotoProfile;
String? thubmnail;
String? originalPrice;
int? discountPrice;
int? finalPrice;
DataDetailCourseCoupon(
{this.idCourse,
this.typeCoupon,
this.value,
this.discountFlag,
this.courseName,
this.instructor,
this.fotoProfile,
this.thubmnail,
this.originalPrice,
this.discountPrice,
this.finalPrice});
DataDetailCourseCoupon.fromJson(Map<String, dynamic> json) {
idCourse = json['id_course'];
typeCoupon = json['type_coupon'];
value = json['value'];
discountFlag = json['discount_flag'];
courseName = json['course_name'];
instructor = json['instructor'];
fotoProfile = json['foto_profile'];
thubmnail = json['thubmnail'];
originalPrice = json['original_price'];
discountPrice = json['discount_price'];
finalPrice = json['final_price'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id_course'] = this.idCourse;
data['type_coupon'] = this.typeCoupon;
data['value'] = this.value;
data['discount_flag'] = this.discountFlag;
data['course_name'] = this.courseName;
data['instructor'] = this.instructor;
data['foto_profile'] = this.fotoProfile;
data['thubmnail'] = this.thubmnail;
data['original_price'] = this.originalPrice;
data['discount_price'] = this.discountPrice;
data['final_price'] = this.finalPrice;
return data;
}
}

View File

@ -0,0 +1,219 @@
import 'package:initial_folder/models/rating_course_model.dart';
// To parse this JSON data, do
//
// final detailCourseModel = detailCourseModelFromJson(jsonString);
import 'dart:convert';
DetailCourseModel detailCourseModelFromJson(String str) =>
DetailCourseModel.fromJson(json.decode(str));
String detailCourseModelToJson(DetailCourseModel data) =>
json.encode(data.toJson());
class DetailCourseModel {
DetailCourseModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final List<List<DataDetailCourseModel>> data;
factory DetailCourseModel.fromJson(Map<String, dynamic> json) =>
DetailCourseModel(
status: json["status"],
error: json["error"],
data: List<List<DataDetailCourseModel>>.from(json["data"].map((x) =>
List<DataDetailCourseModel>.from(
x.map((x) => DataDetailCourseModel.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(
data.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
};
}
class DataDetailCourseModel {
DataDetailCourseModel(
{required this.id,
this.title,
this.instructorId,
this.instructor,
this.shortDescription,
this.levelCourse,
this.totalLesson,
this.totalStudents,
this.description,
this.outcome,
this.requirement,
this.price,
this.discountPrice,
this.discountFlag,
this.videoUrl,
this.totalDuration,
this.bio,
required this.rating,
this.totalDiscount,
this.lastModified,
this.fotoProfile,
this.thumbnail,
this.isFreeCourse,
this.isMine,
required this.breadcrumbs,
this.headlineInstructor,
this.status_course,
this.checkoutPrice,
this.typeCoupon,
this.value,
this.courseName,
this.originalPrice,
this.finalPrice,
this.promoPrice});
final String id;
final String? title;
final String? instructorId;
final String? instructor;
final String? shortDescription;
final String? levelCourse;
final String? totalLesson;
final String? totalStudents;
final String? description;
final String? outcome;
final String? requirement;
final String? price;
final String? discountPrice;
final String? discountFlag;
final String? videoUrl;
final String? totalDuration;
final String? bio;
final List<Rating> rating;
final int? totalDiscount;
final String? lastModified;
final dynamic fotoProfile;
final String? thumbnail;
final String? isFreeCourse;
final dynamic isMine;
final Breadcrumbs breadcrumbs;
final String? status_course;
final String? headlineInstructor;
final String? typeCoupon;
final String? value;
final String? courseName;
final String? originalPrice;
final String? finalPrice;
final int? checkoutPrice;
final String? promoPrice;
factory DataDetailCourseModel.fromJson(Map<String, dynamic> json) =>
DataDetailCourseModel(
id: json["id"],
title: json["title"],
instructorId: json["instructor_id"],
instructor: json["instructor"],
shortDescription: json["short_description"],
levelCourse: json["level_course"],
totalLesson: json["total_lesson"],
totalStudents: json["total_students"],
description: json["description"] == null ? '' : json["description"],
outcome: json["outcome"] == "[]" ? '' : json["outcome"],
requirement: json["requirement"],
price: json["price"].toString(),
discountPrice: json["discount_price"].toString() != "0"
? json["discount_price"].toString()
: "0",
discountFlag: json["discount_flag"],
videoUrl: json["video_url"],
totalDuration: json["total_duration"],
bio: json["bio"],
rating:
List<Rating>.from(json["rating"].map((x) => Rating.fromJson(x))),
totalDiscount: json["total_discount"],
lastModified: json["last_modified"],
fotoProfile: json["foto_profile"],
thumbnail: json["thumbnail"],
isFreeCourse: json["is_free_course"],
isMine: json["is_mine"],
breadcrumbs: Breadcrumbs.fromJson(json["breadcrumbs"]),
headlineInstructor: json['headline'],
status_course: json["status_course"],
checkoutPrice: json["checkout_price"],
typeCoupon: json["type_coupon"],
value: json["value"],
courseName: json["course_name"],
originalPrice: json["original_price"],
finalPrice: json["final_price"],
promoPrice: json["promo_price"].toString() != '0'
? json["promo_price"].toString()
: json["promo_price"].toString(),
);
Map<String, dynamic> toJson() => {
"id": id,
"title": title,
"instructor_id": instructorId,
"instructor": instructor,
"short_description": shortDescription,
"level_course": levelCourse,
"total_lesson": totalLesson,
"total_students": totalStudents,
"description": description,
"outcome": outcome,
"requirement": requirement,
"price": price,
"discount_price": discountPrice,
"discount_flag": discountFlag,
"video_url": videoUrl,
"total_duration": totalDuration,
"bio": bio,
"rating": List<dynamic>.from(rating.map((x) => x.toJson())),
"total_discount": totalDiscount,
"last_modified": lastModified,
"foto_profile": fotoProfile,
"thumbnail": thumbnail,
"is_free_course": isFreeCourse,
"is_mine": isMine,
"breadcrumbs": breadcrumbs.toJson(),
"checkout_price": checkoutPrice,
"type_coupon": typeCoupon,
"value": value,
"course_name": courseName,
"original_price": originalPrice,
"final_price": finalPrice,
"promo_price": promoPrice,
};
}
class Breadcrumbs {
Breadcrumbs({
this.idCategory,
this.parentName,
this.subCategoryId,
this.subParentCategory,
});
final String? idCategory;
final String? parentName;
final String? subCategoryId;
final String? subParentCategory;
factory Breadcrumbs.fromJson(Map<String, dynamic> json) => Breadcrumbs(
idCategory: json["id_category"],
parentName: json["parent_name"],
subCategoryId: json["sub_category_id"],
subParentCategory: json["sub_parent_category"],
);
Map<String, dynamic> toJson() => {
"id_category": idCategory,
"parent_name": parentName,
"sub_category_id": subCategoryId,
"sub_parent_category": subParentCategory,
};
}

View File

@ -0,0 +1,168 @@
class DetailInvoiceModel {
int? status;
bool? error;
List<DataDetailInvoiceModel>? data;
DetailInvoiceModel({this.status, this.error, this.data});
DetailInvoiceModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
error = json['error'];
if (json['data'] != null) {
data = <DataDetailInvoiceModel>[];
json['data'].forEach((v) {
data!.add(new DataDetailInvoiceModel.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
data['error'] = this.error;
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
return data;
}
}
class DataDetailInvoiceModel {
String? statusCode;
String? transactionId;
String? grossAmount;
String? currency;
String? orderId;
String? paymentType;
String? signatureKey;
String? transactionStatus;
String? fraudStatus;
String? statusMessage;
String? merchantId;
String? permataVaNumber;
String? transactionTime;
String? expiryTime;
String? billerCode;
String? billKey;
String? store;
String? paymentCode;
String? bank;
String? maskedCard;
List<VaNumbersModel>? vaNumbers;
DataDetailInvoiceModel({
this.statusCode,
this.transactionId,
this.grossAmount,
this.currency,
this.orderId,
this.paymentType,
this.signatureKey,
this.transactionStatus,
this.fraudStatus,
this.statusMessage,
this.merchantId,
this.permataVaNumber,
this.transactionTime,
this.expiryTime,
this.billerCode,
this.billKey,
this.vaNumbers,
this.store,
this.paymentCode,
this.bank,
this.maskedCard,
});
DataDetailInvoiceModel.fromJson(Map<String, dynamic> json) {
statusCode = json['status_code'];
transactionId = json['transaction_id'];
grossAmount = json['gross_amount'];
currency = json['currency'];
orderId = json['order_id'];
paymentType = json['payment_type'];
bank = json['bank'];
signatureKey = json['signature_key'];
transactionStatus = json['transaction_status'];
fraudStatus = json['fraud_status'];
statusMessage = json['status_message'];
merchantId = json['merchant_id'];
permataVaNumber = json['permata_va_number'];
transactionTime = json['transaction_time'];
expiryTime = json['expiry_time'];
billerCode = json['biller_code'];
billKey = json['bill_key'];
store = json['store'];
paymentCode = json['payment_code'];
maskedCard = json['masked_card'];
if (json['va_numbers'] != null) {
vaNumbers = <VaNumbersModel>[];
json['va_numbers'].forEach((v) {
vaNumbers!.add(new VaNumbersModel.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status_code'] = this.statusCode;
data['transaction_id'] = this.transactionId;
data['gross_amount'] = this.grossAmount;
data['currency'] = this.currency;
data['order_id'] = this.orderId;
data['payment_type'] = this.paymentType;
data['signature_key'] = this.signatureKey;
data['transaction_status'] = this.transactionStatus;
data['fraud_status'] = this.fraudStatus;
data['status_message'] = this.statusMessage;
data['merchant_id'] = this.merchantId;
data['permata_va_number'] = this.permataVaNumber;
data['transaction_time'] = this.transactionTime;
data['expiry_time'] = this.expiryTime;
data['biller_code'] = this.billerCode;
data['bill_key'] = this.billKey;
data['store'] = this.store;
data['payment_code'] = this.paymentCode;
data['bank'] = this.bank;
data['masked_card'] = this.maskedCard;
if (this.vaNumbers != null) {
data['va_numbers'] = this.vaNumbers!.map((v) => v.toJson()).toList();
}
return data;
}
}
class VaNumbersModel {
String? bank;
String? vaNumber;
VaNumbersModel({this.bank, this.vaNumber});
VaNumbersModel.fromJson(Map<String, dynamic> json) {
bank = json['bank'];
vaNumber = json['va_number'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['bank'] = this.bank;
data['va_number'] = this.vaNumber;
return data;
}
}
class StoreModel {
String? store;
StoreModel({this.store});
StoreModel.fromJson(Map<String, dynamic> json) {
store = json['store'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['store'] = this.store;
return data;
}
}

View File

@ -0,0 +1,172 @@
class DetailOrderModel {
String idOrder;
List<VirtualNumbers>? bankVa;
String? virtualNumber;
String? billerCode;
String? bankName;
String paymentType;
String? email;
String? name;
String? url;
// List<OrderModel>? orders;
String totalPayment;
DateTime transactionTime;
DateTime transactionTimeLimit;
String? qrCodeUrl;
String? urlGopay;
String? transactionStatus;
String? merchantId;
String? coupon;
DetailOrderModel({
required this.idOrder,
this.bankVa,
this.url,
this.bankName,
this.qrCodeUrl,
this.urlGopay,
this.email,
this.name,
this.virtualNumber,
this.billerCode,
this.transactionStatus,
this.merchantId,
this.coupon,
// this.orders,
required this.transactionTime,
required this.transactionTimeLimit,
required this.totalPayment,
required this.paymentType,
});
factory DetailOrderModel.fromJson(Map<String, dynamic> json) {
final pType = json['payment_type'] ?? '';
final permataCheck = json['status_message'] ?? '';
final total = json['gross_amount'] ?? '';
final statusTransaction = json['transaction_status'] ?? '';
final time = DateTime.parse(json['transaction_time'] ?? '');
if (pType == 'echannel') {
// Model for Payment Mandiri VA
return DetailOrderModel(
transactionTime: time,
idOrder: json["order_id"] ?? '',
virtualNumber: json["bill_key"] ?? '',
billerCode: json["biller_code"] ?? '',
bankName: 'mandiri',
paymentType: json['payment_type'] ?? '',
totalPayment: total,
transactionStatus: statusTransaction,
transactionTimeLimit: time.add(Duration(days: 1)));
} else if (pType == 'bank_transfer' &&
permataCheck == 'Success, PERMATA VA transaction is successful') {
// Model for Payment Permata VA
return DetailOrderModel(
transactionTime: time,
idOrder: json["order_id"] ?? '',
virtualNumber: json["permata_va_number"] ?? '',
bankName: 'permata',
paymentType: json['payment_type'] ?? '',
totalPayment: total,
transactionStatus: statusTransaction,
transactionTimeLimit: time.add(Duration(days: 1)));
} else if (pType == 'bank_transfer') {
// Model for Payment Bank Transfer (BCA & BNI)
final bankVAResponse = List<VirtualNumbers>.from(
json["va_numbers"].map((x) => VirtualNumbers.fromJson(x))).toList();
return DetailOrderModel(
transactionTime: time,
idOrder: json['order_id'] ?? '',
paymentType: pType,
bankVa: bankVAResponse,
virtualNumber: bankVAResponse[0].vaNumber,
totalPayment: total,
transactionStatus: statusTransaction,
transactionTimeLimit: time.add(Duration(days: 1)),
bankName: bankVAResponse[0].bank);
} else if (pType == 'credit_card') {
// Model for CC Payment
return DetailOrderModel(
transactionTime: time,
url: json['redirect_url'] ?? '',
idOrder: json['order_id'] ?? '',
paymentType: pType,
totalPayment: total,
transactionStatus: statusTransaction,
transactionTimeLimit: time.add(Duration(days: 1)),
bankName: json['bank'] ?? '');
} else if (pType == 'cstore') {
// Model for Store (Indomaret & Alfamart)
return DetailOrderModel(
transactionTime: time,
idOrder: json["order_id"] ?? '',
virtualNumber: json["payment_code"] ?? '',
merchantId: json["merchant_id"] ?? '',
paymentType: pType,
bankName: json['store'] ?? '',
totalPayment: total,
transactionStatus: statusTransaction,
transactionTimeLimit: time.add(Duration(days: 1)));
} else {
// Model for GoPay
final qrUrl = json['actions'][0]['url'];
final urlGop = json['actions'][1]['url'];
return DetailOrderModel(
idOrder: json['order_id'] ?? '',
transactionTime: time,
transactionTimeLimit: time.add(Duration(days: 1)),
totalPayment: total,
paymentType: pType,
transactionStatus: statusTransaction,
qrCodeUrl: qrUrl,
urlGopay: urlGop,
);
}
}
Map<String, dynamic> toJson() {
return paymentType == "echannel"
? {
"order_id": idOrder,
"payment_type": paymentType,
"bill_key": virtualNumber,
"biller_code": billerCode,
"transaction_status": transactionStatus,
}
: paymentType == 'permata'
? {
"order_id": idOrder,
"payment_type": paymentType,
"permata_va_number": bankVa,
"transaction_status": transactionStatus,
}
: {
"order_id": idOrder,
"va_numbers":
List<dynamic>.from(bankVa!.map((x) => x.toJson())).toList(),
"payment_type": paymentType,
"transaction_status": transactionStatus,
};
}
}
class VirtualNumbers {
VirtualNumbers({
this.bank,
this.vaNumber,
});
String? bank;
String? vaNumber;
factory VirtualNumbers.fromJson(Map<String, dynamic> json) => VirtualNumbers(
bank: json["bank"],
vaNumber: json["va_number"],
);
Map<String, dynamic> toJson() => {
"bank": bank,
"va_number": vaNumber,
};
}

View File

@ -0,0 +1,169 @@
class DetailOrderModelUnderscore {
String idOrder;
List<VirtualNumbers>? bankVa;
String? virtualNumber;
String? billerCode;
String? bankName;
String paymentType;
String? email;
String? name;
String? url;
// List<OrderModel>? orders;
String totalPayment;
DateTime transactionTime;
DateTime transactionTimeLimit;
String? qrCodeUrl;
String? urlGopay;
String? transactionStatus;
String? merchantId;
DetailOrderModelUnderscore({
required this.idOrder,
this.bankVa,
this.url,
this.bankName,
this.qrCodeUrl,
this.urlGopay,
this.email,
this.name,
this.virtualNumber,
this.billerCode,
this.transactionStatus,
this.merchantId,
// this.orders,
required this.transactionTime,
required this.transactionTimeLimit,
required this.totalPayment,
required this.paymentType,
});
factory DetailOrderModelUnderscore.fromJson(Map<String, dynamic> json) {
final pType = json['payment_type'] ?? '';
final permataCheck = json['status_message'] ?? '';
final total = json['gross_amount'] ?? '';
final statusTransaction = json['transaction_status'] ?? '';
final time = DateTime.parse(json['transaction_time'] ?? '');
if (pType == 'echannel') {
// Model for Payment Mandiri VA
return DetailOrderModelUnderscore(
transactionTime: time,
idOrder: json["order_id"] ?? '',
virtualNumber: json["bill_key"] ?? '',
billerCode: json["biller_code"] ?? '',
bankName: 'mandiri',
paymentType: json['payment_type'] ?? '',
totalPayment: total,
transactionStatus: statusTransaction,
transactionTimeLimit: time.add(Duration(days: 1)));
} else if (pType == 'bank_transfer' &&
permataCheck == 'Success, PERMATA VA transaction is successful') {
// Model for Payment Permata VA
return DetailOrderModelUnderscore(
transactionTime: time,
idOrder: json["order_id"] ?? '',
virtualNumber: json["permata_va_number"] ?? '',
bankName: 'permata',
paymentType: json['payment_type'] ?? '',
totalPayment: total,
transactionStatus: statusTransaction,
transactionTimeLimit: time.add(Duration(days: 1)));
} else if (pType == 'bank_transfer') {
// Model for Payment Bank Transfer (BCA & BNI)
final bankVAResponse = List<VirtualNumbers>.from(
json["va_numbers"].map((x) => VirtualNumbers.fromJson(x))).toList();
return DetailOrderModelUnderscore(
transactionTime: time,
idOrder: json['order_id'] ?? '',
paymentType: pType,
bankVa: bankVAResponse,
virtualNumber: bankVAResponse[0].vaNumber,
totalPayment: total,
transactionStatus: statusTransaction,
transactionTimeLimit: time.add(Duration(days: 1)),
bankName: bankVAResponse[0].bank);
} else if (pType == 'credit_card') {
// Model for CC Payment
return DetailOrderModelUnderscore(
transactionTime: time,
url: json['redirect_url'] ?? '',
idOrder: json['order_id'] ?? '',
paymentType: pType,
totalPayment: total,
transactionStatus: statusTransaction,
transactionTimeLimit: time.add(Duration(days: 1)),
bankName: json['bank'] ?? '');
} else if (pType == 'cstore') {
// Model for Store (Indomaret & Alfamart)
return DetailOrderModelUnderscore(
transactionTime: time,
idOrder: json["order_id"] ?? '',
virtualNumber: json["payment_code"] ?? '',
merchantId: json["merchant_id"] ?? '',
paymentType: pType,
bankName: json['store'] ?? '',
totalPayment: total,
transactionStatus: statusTransaction,
transactionTimeLimit: time.add(Duration(days: 1)));
} else {
// Model for GoPay
final qrUrl = json['actions'][0]['url'];
final urlGop = json['actions'][1]['url'];
return DetailOrderModelUnderscore(
idOrder: json['order_id'] ?? '',
transactionTime: time,
transactionTimeLimit: time.add(Duration(days: 1)),
totalPayment: total,
paymentType: pType,
transactionStatus: statusTransaction,
qrCodeUrl: qrUrl,
urlGopay: urlGop,
);
}
}
Map<String, dynamic> toJson() {
return paymentType == "echannel"
? {
"order_id": idOrder,
"payment_type": paymentType,
"bill_key": bankVa,
"transaction_status": transactionStatus,
}
: paymentType == 'permata'
? {
"order_id": idOrder,
"payment_type": paymentType,
"permata_va_number": bankVa,
"transaction_status": transactionStatus,
}
: {
"order_id": idOrder,
"va_numbers":
List<dynamic>.from(bankVa!.map((x) => x.toJson())).toList(),
"payment_type": paymentType,
"transaction_status": transactionStatus,
};
}
}
class VirtualNumbers {
VirtualNumbers({
this.bank,
this.vaNumber,
});
String? bank;
String? vaNumber;
factory VirtualNumbers.fromJson(Map<String, dynamic> json) => VirtualNumbers(
bank: json["bank"],
vaNumber: json["va_number"],
);
Map<String, dynamic> toJson() => {
"bank": bank,
"va_number": vaNumber,
};
}

View File

@ -0,0 +1,110 @@
class RatingCourseDetailModel {
RatingCourseDetailModel({
this.status,
this.error,
required this.data,
required this.dataReview,
});
final int? status;
final bool? error;
final Data data;
final List<DataReview> dataReview;
factory RatingCourseDetailModel.fromJson(Map<String, dynamic> json) =>
RatingCourseDetailModel(
status: json["status"],
error: json["error"],
data: Data.fromJson(json["data"]),
dataReview: List<DataReview>.from(
json["data_review"].map((x) => DataReview.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": data.toJson(),
"data_review": List<dynamic>.from(dataReview.map((x) => x.toJson())),
};
}
class Data {
Data({
this.avgRating,
required this.precentageRating,
});
final dynamic avgRating;
final PrecentageRating precentageRating;
factory Data.fromJson(Map<String, dynamic> json) => Data(
avgRating: json["avg_rating"],
precentageRating: PrecentageRating.fromJson(json["precentage_rating"]),
);
Map<String, dynamic> toJson() => {
"avg_rating": avgRating,
"precentage_rating": precentageRating.toJson(),
};
}
class PrecentageRating {
PrecentageRating({
this.rating1,
this.rating2,
this.rating3,
this.rating4,
this.rating5,
});
final dynamic rating1;
final dynamic rating2;
final dynamic rating3;
final dynamic rating4;
final dynamic rating5;
factory PrecentageRating.fromJson(Map<String, dynamic> json) =>
PrecentageRating(
rating1: json["rating_1"],
rating2: json["rating_2"],
rating3: json["rating_3"],
rating4: json["rating_4"],
rating5: json["rating_5"],
);
Map<String, dynamic> toJson() => {
"rating_1": rating1,
"rating_2": rating2,
"rating_3": rating3,
"rating_4": rating4,
"rating_5": rating5,
};
}
class DataReview {
DataReview({
this.name,
this.review,
this.rating,
this.date,
});
final String? name;
final String? review;
final String? rating;
final String? date;
factory DataReview.fromJson(Map<String, dynamic> json) => DataReview(
name: json["name"],
review: json["review"],
rating: json["rating"],
date: json["date"],
);
Map<String, dynamic> toJson() => {
"name": name,
"review": review,
"rating": rating,
"date": date,
};
}

View File

@ -0,0 +1,91 @@
import 'package:initial_folder/models/rating_course_model.dart';
class DiscountCourseModel {
DiscountCourseModel({
this.idCourse = '',
this.instructorId = '',
this.title = '',
this.price = '',
this.instructorName = '',
this.discountFlag,
this.discountPrice = '',
this.thumbnail,
this.students,
required this.rating,
this.finalPrice,
this.fotoProfile,
this.topCourse,
this.hargaTotalDiscount,
this.typeCoupon,
this.value,
});
String idCourse;
String instructorId;
String title;
String price;
String instructorName;
String? discountFlag;
String discountPrice;
String? thumbnail;
String? students;
List<Rating?> rating;
int? finalPrice;
int? hargaTotalDiscount;
String? fotoProfile;
String? topCourse;
String? typeCoupon;
String? value;
factory DiscountCourseModel.fromJson(Map<String, dynamic> json) {
int parseIntWithDotRemoval(dynamic value) {
if (value is int) return value;
return int.tryParse(value.toString().replaceAll('.', '')) ?? 0;
}
return DiscountCourseModel(
idCourse: json["id_course"].toString(),
instructorId: json["instructor_id"].toString(),
title: json["title"].toString(),
price: json["price"].toString(),
instructorName: json["instructor_name"].toString(),
discountFlag: json["discount_flag"]?.toString(),
discountPrice: json["discount_price"].toString(),
thumbnail: json["thumbnail"]?.toString(),
students: json["students"]?.toString(),
rating: List<Rating>.from(json["rating"].map((x) => Rating.fromJson(x)))
.toList(),
finalPrice: parseIntWithDotRemoval(json["final_price"]),
// finalPrice: json["final_price"] is int
// ? json["final_price"]
// : int.tryParse(json["final_price"].toString()),
fotoProfile: json["foto_profile"]?.toString(),
topCourse: json["top_course"]?.toString(),
typeCoupon: json["type_coupon"]?.toString(),
value: json["value"]?.toString(),
hargaTotalDiscount: parseIntWithDotRemoval(json["harga_total_discount"]),
// hargaTotalDiscount: json["harga_total_discount"] is int
// ? json["harga_total_discount"]
// : int.tryParse(json["harga_total_discount"].toString()),
);
}
Map<String, dynamic> toJson() => {
"id_course": idCourse,
"instructor_id": instructorId,
"title": title,
"price": price,
"instructor_name": instructorName,
"discount_flag": discountFlag,
"discount_price": discountPrice,
"thumbnail": thumbnail,
"students": students,
"rating": List<dynamic>.from(rating.map((x) => x!.toJson())).toList(),
"final_price": finalPrice,
"foto_profile": fotoProfile,
"top_course": topCourse,
"harga_total_discount": hargaTotalDiscount,
"type_coupon": typeCoupon,
"value": value,
};
}

View File

@ -0,0 +1,15 @@
class ForgotPasswordModel {
String? email;
ForgotPasswordModel({this.email});
ForgotPasswordModel.fromJson(Map<String, dynamic> json) {
email = json['email'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['email'] = this.email;
return data;
}
}

View File

@ -0,0 +1,100 @@
class HistoryTransactionModel {
HistoryTransactionModel({
this.orderId,
this.totalPrice,
this.date,
this.dateExpired,
this.paymentDetail,
this.statusPayment,
this.courses,
this.discountPrice,
this.token,
});
final String? orderId;
final DateTime? date;
final DateTime? dateExpired;
final List<DataCourses>? courses;
final int? totalPrice;
final int? discountPrice;
final PaymentDetail? paymentDetail;
final String? statusPayment;
final String? token;
factory HistoryTransactionModel.fromJson(Map<String, dynamic> json) {
int timestamp = int.parse(json["date"]);
int timestampExpired = int.parse(json["date_expired"]);
return HistoryTransactionModel(
orderId: json['order_id'] ?? '',
totalPrice: json["sub_total"] ?? 0,
discountPrice: json["discount_price"] ?? 0,
date: DateTime.fromMillisecondsSinceEpoch(timestamp * 1000),
dateExpired: DateTime.fromMillisecondsSinceEpoch(timestamp * 1000),
paymentDetail: PaymentDetail.fromJson(json["payment_detail"] ?? {}),
statusPayment: json["status"] ?? '',
token: json['token'] ?? '',
courses: json["course"] != null
? List<DataCourses>.from(
json["course"].map((x) => DataCourses.fromJson(x))).toList()
: []);
}
Map<dynamic, dynamic> toJson() => {
'order_id': orderId,
"sub_total": totalPrice,
"discountPrice": discountPrice,
"payment_type": paymentDetail,
"status": statusPayment,
"token": token,
'course': courses != null
? List<dynamic>.from(courses!.map((x) => x.toJson())).toList()
: []
};
}
class DataCourses {
final String? courseId, thumbnail, title, instructor, price;
DataCourses(
{this.courseId, this.title, this.price, this.instructor, this.thumbnail});
factory DataCourses.fromJson(Map<String, dynamic> json) => DataCourses(
courseId: json['id'] ?? '',
title: json['title'] ?? '',
price: json['price'] ?? '',
thumbnail: json['thumbnail'] ?? '',
instructor: json['instructor'] ?? '',
);
Map<String, dynamic> toJson() => {
'id': courseId,
'title': title,
'price': price,
'thumbnail': thumbnail,
'instructor': instructor
};
}
class PaymentDetail {
String? paymentType;
String? bank;
String? vaNumber;
String? store;
PaymentDetail({this.paymentType, this.bank, this.vaNumber, this.store});
PaymentDetail.fromJson(Map<String, dynamic> json) {
paymentType = json['payment_type'] ?? '';
bank = json['bank'] ?? '';
vaNumber = json['va_number'] ?? '';
store = json['store'] ?? '';
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['payment_type'] = this.paymentType;
data['bank'] = this.bank;
data['va_number'] = this.vaNumber;
return data;
}
}

View File

@ -0,0 +1,53 @@
class InstructorModel {
InstructorModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final List<DataInstructor> data;
factory InstructorModel.fromJson(Map<String, dynamic> json) =>
InstructorModel(
status: json["status"],
error: json["error"],
data: List<DataInstructor>.from(
json["data"].map((x) => DataInstructor.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class DataInstructor {
DataInstructor({
this.instructorName,
this.totalReview,
this.totalCourse,
this.totalStudents,
});
final String? instructorName;
final String? totalReview;
final String? totalCourse;
final String? totalStudents;
factory DataInstructor.fromJson(Map<String, dynamic> json) => DataInstructor(
instructorName: json["instructor_name"],
totalReview: json["total_review"],
totalCourse: json["total_course"],
totalStudents: json["total_students"],
);
Map<String, dynamic> toJson() => {
"instructor_name": instructorName,
"total_review": totalReview,
"total_course": totalCourse,
"total_students": totalStudents,
};
}

View File

@ -0,0 +1,164 @@
class LessonCourseModel {
LessonCourseModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final List<List<DataLessonCourseModel>> data;
factory LessonCourseModel.fromJson(Map<String, dynamic> json) =>
LessonCourseModel(
status: json["status"],
error: json["error"],
data: List<List<DataLessonCourseModel>>.from(json["data"].map((x) =>
List<DataLessonCourseModel>.from(
x.map((x) => DataLessonCourseModel.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(
data.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
};
}
class DataLessonCourseModel {
DataLessonCourseModel({
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;
late int? isFinished;
factory DataLessonCourseModel.fromJson(Map<String, dynamic> json) =>
DataLessonCourseModel(
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"] == null ? null : json["video_type"],
videoUrl: json["video_url"] == null ? null : json["video_url"],
lessonType: json["lesson_type"],
attachment: json["attachment"],
isSkip: json["is_skip"],
isFinished: json["is_finished"],
);
Map<String, dynamic> toJson() => {
"course_id": courseId,
"lesson_id": lessonId,
"section_title": sectionTitle,
"lesson_title": lessonTitle,
"duration": duration,
"attachment_type": attachmentType,
"video_type": videoType == null ? null : videoType,
"video_url": videoUrl == null ? null : videoUrl,
"lesson_type": lessonType,
"attachment": attachment,
"is_skip": isSkip,
"is_finished": isFinished,
};
}
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,
};
}

View File

@ -0,0 +1,59 @@
class LessonModel {
LessonModel({
required this.lesssonId,
required this.title,
required this.duration,
this.videoType,
this.videoUrl,
this.attachmentType,
this.attachment,
required this.attachmentDownload,
required this.isSkip,
required this.progressVideo,
required this.isFinished,
required this.summary,
});
final String lesssonId;
final String title;
final String duration;
String? videoType;
String? videoUrl;
String? attachmentType;
String? attachment;
final bool attachmentDownload;
final String isSkip;
final String progressVideo;
final int isFinished;
final String summary;
factory LessonModel.fromJson(Map<String, dynamic> json) => LessonModel(
lesssonId: json["lesson_id"],
title: json["title"],
duration: json["duration"],
videoType: json["video_type"],
videoUrl: json["video_url"],
attachmentType: json["attachment_type"],
attachment: json["attachment"],
attachmentDownload: json["attachment_download"],
isSkip: json["is_skip"],
progressVideo: json["progress_video"],
isFinished: json["is_finished"],
summary: json["summary"],
);
Map<String, dynamic> toJson() => {
"lesson_id": lesssonId,
"title": title,
"duration": duration,
"video_type": videoType,
"video_url": videoUrl,
"attachment_type": attachmentType,
"attachment": attachment,
"attachment_download": attachmentDownload,
"is_skip": isSkip,
"progress_video": progressVideo,
"is_finished": isFinished,
"summary": summary,
};
}

1
lib/models/models.dart Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1,77 @@
class MyCertificateModel {
MyCertificateModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final List<List<DataMyCertificateModel>> data;
factory MyCertificateModel.fromJson(Map<String, dynamic> json) =>
MyCertificateModel(
status: json["status"],
error: json["error"],
data: List<List<DataMyCertificateModel>>.from(json["data"].map((x) =>
List<DataMyCertificateModel>.from(
x.map((x) => DataMyCertificateModel.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(
data.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
};
}
class DataMyCertificateModel {
String? courseId;
String? instructorId;
String? name;
String? title;
String? instructor;
String? certificateNo;
int? progress;
String? fotoProfile;
String? idPayment;
DataMyCertificateModel({
this.courseId,
this.instructorId,
this.name,
this.title,
this.instructor,
this.certificateNo,
this.progress,
this.fotoProfile,
this.idPayment,
});
DataMyCertificateModel.fromJson(Map<String, dynamic> json) {
courseId = json['course_id'];
instructorId = json['instructor_id'];
name = json['name'];
title = json['title'];
instructor = json['instructor'];
certificateNo = json['certificate_no'];
progress = json['progress'];
fotoProfile = json['foto_profile'];
idPayment = json['id_payment'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['course_id'] = this.courseId;
data['instructor_id'] = this.instructorId;
data['name'] = this.name;
data['title'] = this.title;
data['instructor'] = this.instructor;
data['certificate_no'] = this.certificateNo;
data['progress'] = this.progress;
data['foto_profile'] = this.fotoProfile;
data['id_payment'] = this.idPayment;
return data;
}
}

View File

@ -0,0 +1,97 @@
class MyCourseModel {
MyCourseModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final List<List<DataMyCourseModel>> data;
factory MyCourseModel.fromJson(Map<String, dynamic> json) => MyCourseModel(
status: json["status"],
error: json["error"],
data: List<List<DataMyCourseModel>>.from(json["data"].map((x) =>
List<DataMyCourseModel>.from(
x.map((x) => DataMyCourseModel.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(
data.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
};
}
class DataMyCourseModel {
DataMyCourseModel({
this.courseId,
this.instructorId,
this.instructor,
this.title,
this.thumbnail,
required this.rating,
this.fotoProfile,
this.totalProgress,
});
final String? courseId;
final String? instructorId;
final String? instructor;
final String? title;
final String? thumbnail;
final List<Rating> rating;
final dynamic fotoProfile;
final int? totalProgress;
factory DataMyCourseModel.fromJson(Map<String, dynamic> json) =>
DataMyCourseModel(
courseId: json["course_id"],
instructorId: json["instructor_id"],
instructor: json["instructor"],
title: json["title"],
thumbnail: json["thumbnail"],
rating: json['rating'] == []
? []
: List<Rating>.from(json["rating"].map((x) => Rating.fromJson(x))),
fotoProfile: json["foto_profile"],
totalProgress: json["total_progress"],
);
Map<String, dynamic> toJson() => {
"course_id": courseId,
"instructor_id": instructorId,
"instructor": instructor,
"title": title,
"thumbnail": thumbnail,
"rating": List<dynamic>.from(rating.map((x) => x.toJson())),
"foto_profile": fotoProfile,
"total_progress": totalProgress,
};
}
class Rating {
Rating({
this.ratableId,
this.rating,
this.review,
});
final String? ratableId;
final String? rating;
final String? review;
factory Rating.fromJson(Map<String, dynamic> json) => Rating(
ratableId: json["ratable_id"],
rating: json["rating"],
review: json["review"],
);
Map<String, dynamic> toJson() => {
"ratable_id": ratableId,
"rating": rating,
"review": review,
};
}

View File

@ -0,0 +1,385 @@
// Ini model buat notifikasi
class Notification {
int? status;
bool? error;
Data? data;
Notification({this.status, this.error, this.data});
Notification.fromJson(Map<String, dynamic> json) {
status = json['status'];
error = json['error'];
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
data['error'] = this.error;
if (this.data != null) {
data['data'] = this.data!.toJson();
}
return data;
}
}
class Data {
Users? users;
Instructur? instructur;
Data({this.users, this.instructur});
Data.fromJson(Map<String, dynamic> json) {
users = json['users'] != null ? new Users.fromJson(json['users']) : null;
instructur = json['instructur'] != null
? new Instructur.fromJson(json['instructur'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.users != null) {
data['users'] = this.users!.toJson();
}
if (this.instructur != null) {
data['instructur'] = this.instructur!.toJson();
}
return data;
}
}
class Users {
List<Qna>? qna;
List<Courses>? courses;
List<Announcement>? announcement;
Users({this.qna, this.courses, this.announcement});
Users.fromJson(Map<String, dynamic> json) {
if (json['qna'] != null) {
qna = <Qna>[];
json['qna'].forEach((v) {
qna!.add(new Qna.fromJson(v));
});
}
if (json['announcement'] != null) {
announcement = <Announcement>[];
json['announcement'].forEach((v) {
announcement!.add(new Announcement.fromJson(v));
});
}
if (json['courses'] != null) {
courses = <Courses>[];
json['courses'].forEach((v) {
courses!.add(new Courses.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.qna != null) {
data['qna'] = this.qna!.map((v) => v.toJson()).toList();
}
if (this.announcement != null) {
data['announcement'] = this.announcement!.map((v) => v.toJson()).toList();
}
if (this.courses != null) {
data['courses'] = this.courses!.map((v) => v.toJson()).toList();
}
return data;
}
}
class NotificationDataAnnouncementUser {
String? idCourse;
String? subject;
String? titleCourse;
String? messages;
String? date;
String? thumbnail;
String? timestamps;
String? instructor;
int? isRead;
String? idRead;
String? ket;
NotificationDataAnnouncementUser(
{this.idCourse,
this.subject,
this.titleCourse,
this.messages,
this.date,
this.thumbnail,
this.timestamps,
this.instructor,
this.isRead,
this.idRead,
this.ket});
NotificationDataAnnouncementUser.announcementFromJson(
Map<String, dynamic> json) {
idCourse = json['id_course'];
subject = json['subject'];
titleCourse = json['title_course'];
thumbnail = json['thumbnail'];
messages = json['messages'];
date = json['date'];
timestamps = json['timestamps'];
instructor = json['name_instructure'];
isRead = json['is_read'];
idRead = json['id_read'];
ket = json['ket'];
}
}
class NotificationData {
String? idCourse;
String? subject;
String? titleCourse;
String? messages;
String? date;
String? thumbnail;
String? timestamps;
String? instructor;
String? isRead;
String? idRead;
String? ket;
NotificationData(
{this.idCourse,
this.subject,
this.titleCourse,
this.messages,
this.date,
this.thumbnail,
this.timestamps,
this.instructor,
this.isRead,
this.idRead,
this.ket});
NotificationData.qnaFromJson(Map<String, dynamic> json) {
idCourse = json['id_course'];
subject = json['subject'];
titleCourse = json['title_course'];
thumbnail = json['thumbnail'];
messages = json['messages'];
date = json['date'];
timestamps = json['timestamps'].toString();
instructor = json['name_instructure'];
isRead = json['is_read'];
idRead = json['id_read'];
ket = json['ket'];
}
NotificationData.announcementFromJson(Map<String, dynamic> json) {
subject = json['subject'];
titleCourse = json['title_course'];
messages = json['messages'];
date = json['date'];
idCourse = json['id_course'];
timestamps = json['timestamps'];
isRead = json['is_read'].toString();
idRead = json['id_read'];
ket = json['ket'];
instructor = json['name_instructure'];
thumbnail = json['thumbnail'];
}
NotificationData.coursesFromJson(Map<String, dynamic> json) {
idCourse = json['id_course'];
subject = json['subject'];
titleCourse = json['title_course'];
thumbnail = json['thumbnail'];
messages = json['messages'];
date = json['date'];
timestamps = json['timestamps'];
instructor = json['instructur_name'];
isRead = json['is_read'];
idRead = json['id_read'];
ket = json['ket'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['subject'] = this.subject;
data['title_course'] = this.titleCourse;
data['messages'] = this.messages;
data['date'] = this.date;
return data;
}
}
class Qna {
String? subject;
String? titleCourse;
String? messages;
String? date;
Qna({this.subject, this.titleCourse, this.messages, this.date});
Qna.fromJson(Map<String, dynamic> json) {
subject = json['subject'];
titleCourse = json['title_course'];
messages = json['messages'];
date = json['date'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['subject'] = this.subject;
data['title_course'] = this.titleCourse;
data['messages'] = this.messages;
data['date'] = this.date;
return data;
}
}
class Announcement {
String? subject;
String? titleCourse;
String? messages;
String? date;
Announcement({this.subject, this.titleCourse, this.messages, this.date});
Announcement.fromJson(Map<String, dynamic> json) {
subject = json['subject'];
titleCourse = json['title_course'];
messages = json['messages'];
date = json['date'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['subject'] = this.subject;
data['title_course'] = this.titleCourse;
data['messages'] = this.messages;
data['date'] = this.date;
return data;
}
}
class Courses {
String? subject;
String? title;
String? thumbnail;
String? date;
Courses({this.subject, this.title, this.thumbnail, this.date});
Courses.fromJson(Map<String, dynamic> json) {
subject = json['subject'];
title = json['title'];
thumbnail = json['thumbnail'];
date = json['date'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['subject'] = this.subject;
data['title'] = this.title;
data['thumbnail'] = this.thumbnail;
data['date'] = this.date;
return data;
}
}
class Instructur {
List<Qna>? qna;
List<Announcement>? announcement;
List<CoursesAdded>? coursesAdded;
List<Payout>? payout;
Instructur({this.qna, this.coursesAdded, this.payout, this.announcement});
Instructur.fromJson(Map<String, dynamic> json) {
if (json['qna'] != null) {
qna = <Qna>[];
json['qna'].forEach((v) {
qna!.add(new Qna.fromJson(v));
});
}
if (json['announcement'] != null) {
announcement = <Announcement>[];
json['announcement'].forEach((v) {
announcement!.add(new Announcement.fromJson(v));
});
}
if (json['courses_added'] != null) {
coursesAdded = <CoursesAdded>[];
json['courses_added'].forEach((v) {
coursesAdded!.add(new CoursesAdded.fromJson(v));
});
}
if (json['payout'] != null) {
payout = <Payout>[];
json['payout'].forEach((v) {
payout!.add(new Payout.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.qna != null) {
data['qna'] = this.qna!.map((v) => v.toJson()).toList();
}
if (this.announcement != null) {
data['announcement'] = this.announcement!.map((v) => v.toJson()).toList();
}
if (this.coursesAdded != null) {
data['courses_added'] =
this.coursesAdded!.map((v) => v.toJson()).toList();
}
if (this.payout != null) {
data['payout'] = this.payout!.map((v) => v.toJson()).toList();
}
return data;
}
}
class CoursesAdded {
String? subject;
String? title;
String? time;
CoursesAdded({this.subject, this.title, this.time});
CoursesAdded.fromJson(Map<String, dynamic> json) {
subject = json['subject'];
title = json['title'];
time = json['time'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['subject'] = this.subject;
data['title'] = this.title;
data['time'] = this.time;
return data;
}
}
class Payout {
String? subject;
String? message;
String? date;
Payout({this.subject, this.message, this.date});
Payout.fromJson(Map<String, dynamic> json) {
subject = json['subject'];
message = json['message'];
date = json['date'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['subject'] = this.subject;
data['message'] = this.message;
data['date'] = this.date;
return data;
}
}

View File

@ -0,0 +1,16 @@
class OrderModel {
String idCourse;
String title;
String price;
String discountPrice;
String imageUrl;
String instructor;
OrderModel(
{required this.idCourse,
required this.title,
required this.price,
required this.imageUrl,
required this.discountPrice,
required this.instructor});
}

View File

@ -0,0 +1,50 @@
class PaymentHistoryModel {
PaymentHistoryModel({this.status, this.error, required this.data});
final int? status;
final bool? error;
final List<List<DataPaymentHistoryModel>> data;
}
class DataPaymentHistoryModel {
DataPaymentHistoryModel({
this.orderId,
this.title,
this.thumbnail,
this.instructor,
this.totalPrice,
this.date,
this.paymentType,
this.statusPayment,
});
final String? orderId;
final String? title;
final String? thumbnail;
final String? instructor;
final String? totalPrice;
final String? date;
final String? paymentType;
final String? statusPayment;
factory DataPaymentHistoryModel.fromJson(Map<String, dynamic> json) =>
DataPaymentHistoryModel(
orderId: json['order_id'],
title: json["title"],
thumbnail: json["thumbnail"] == null ? null : json["thumbnail"],
instructor: json["instructor"],
totalPrice: json["total"],
date: json["date"],
paymentType: json["payment_type"],
statusPayment: json["status"],
);
Map<String, dynamic> toJson() => {
"order_id": orderId,
"title": title,
"thumbnail": thumbnail == null ? null : thumbnail,
"instructor": instructor,
"total_price": totalPrice,
"date": date,
"payment_type": paymentType,
"status_payment": statusPayment,
};
}

View File

@ -0,0 +1,23 @@
class PaymentModel {
PaymentModel({
this.status,
this.error,
this.messages,
});
final int? status;
final bool? error;
final String? messages;
factory PaymentModel.fromJson(Map<String, dynamic> json) => PaymentModel(
status: json["status"],
error: json["error"],
messages: json["messages"],
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"messages": messages,
};
}

View File

@ -0,0 +1,40 @@
class ProfileImagePostModel {
ProfileImagePostModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final DataPostImage data;
factory ProfileImagePostModel.fromJson(Map<String, dynamic> json) =>
ProfileImagePostModel(
status: json["status"],
error: json["error"],
data: DataPostImage.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": data.toJson(),
};
}
class DataPostImage {
DataPostImage({
this.messages,
});
final String? messages;
factory DataPostImage.fromJson(Map<String, dynamic> json) => DataPostImage(
messages: json["messages"],
);
Map<String, dynamic> toJson() => {
"messages": messages,
};
}

130
lib/models/qna_model.dart Normal file
View File

@ -0,0 +1,130 @@
import 'package:initial_folder/models/comment_qna_model.dart';
class QnaModel {
QnaModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final List<List<QnaDataModel>> data;
factory QnaModel.fromJson(Map<String, dynamic> json) => QnaModel(
status: json["status"],
error: json["error"],
data: List<List<QnaDataModel>>.from(json["data"].map((x) =>
List<QnaDataModel>.from(x.map((x) => QnaDataModel.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(
data.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
};
}
class QnaDataModel {
QnaDataModel({
this.idQna,
this.idLesson,
this.sender,
this.username,
this.title,
this.quest,
this.fotoProfile,
this.countComment,
this.countLike,
this.selfLiked,
this.date,
required this.comment,
});
final String? idQna;
final String? idLesson;
final String? sender;
final String? username;
final String? title;
final String? quest;
final String? fotoProfile;
int? countComment;
String? countLike;
bool? selfLiked;
final String? date;
List<Comment> comment;
factory QnaDataModel.fromJson(Map<String, dynamic> json) => QnaDataModel(
idQna: json["id_qna"],
idLesson: json["id_lesson"],
sender: json["sender"],
username: json["username"],
title: json["title"],
quest: json["quest"],
fotoProfile: json["foto_profile"],
countComment: json["count_comment"],
countLike: json["count_up"],
selfLiked: json['status_up'],
date: json["date"],
comment:
List<Comment>.from(json["comment"].map((x) => Comment.fromJson(x)))
.toList(),
);
Map<String, dynamic> toJson() => {
"id_qna": idQna,
"id_lesson": idLesson,
"sender": sender,
"username": username,
"quest": quest,
"foto_profile": fotoProfile,
"date": date,
"comment": List<dynamic>.from(comment.map((x) => x)),
};
}
/// Class untuk response tambah
class QnaPostModel {
QnaPostModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final DataPostQna data;
factory QnaPostModel.fromJson(Map<String, dynamic> json) => QnaPostModel(
status: json["status"],
error: json["error"],
data: DataPostQna.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": data.toJson(),
};
}
class DataPostQna {
DataPostQna({this.sender, this.quest, this.idCourse});
final String? sender;
final String? quest;
final String? idCourse;
factory DataPostQna.fromJson(Map<String, dynamic> json) => DataPostQna(
sender: json["sender"],
quest: json["quest"],
idCourse: json["id_course"],
);
Map<String, dynamic> toJson() => {
"messages": sender,
"quest": quest,
"id_course": idCourse,
};
}

View File

@ -0,0 +1,82 @@
// To parse this JSON data, do
//
// final quizModel = quizModelFromJson(jsonString);
import 'dart:convert';
QuizModel quizModelFromJson(String str) => QuizModel.fromJson(json.decode(str));
String quizModelToJson(QuizModel data) => json.encode(data.toJson());
class QuizModel {
int status;
bool error;
int total;
List<Datum> data;
QuizModel({
required this.status,
required this.error,
required this.total,
required this.data,
});
factory QuizModel.fromJson(Map<String, dynamic> json) => QuizModel(
status: json["status"],
error: json["error"],
total: json["total"],
data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"total": total,
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class Datum {
String id;
String quizId;
String title;
String type;
String numberOption;
List<String> options;
List<String> correctAnswers;
String order;
Datum({
required this.id,
required this.quizId,
required this.title,
required this.type,
required this.numberOption,
required this.options,
required this.correctAnswers,
required this.order,
});
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
id: json["id"],
quizId: json["quiz_id"],
title: json["title"],
type: json["type"],
numberOption: json["number_option"],
options: List<String>.from(json["options"].map((x) => x)),
correctAnswers:
List<String>.from(json["correct_answers"].map((x) => x)),
order: json["order"],
);
Map<String, dynamic> toJson() => {
"id": id,
"quiz_id": quizId,
"title": title,
"type": type,
"number_option": numberOption,
"options": List<dynamic>.from(options.map((x) => x)),
"correct_answers": List<dynamic>.from(correctAnswers.map((x) => x)),
"order": order,
};
}

View File

@ -0,0 +1,81 @@
// To parse this JSON data, do
//
// final quizPerQuestionResult = quizPerQuestionResultFromJson(jsonString);
import 'dart:convert';
QuizPerQuestionResult quizPerQuestionResultFromJson(String str) => QuizPerQuestionResult.fromJson(json.decode(str));
String quizPerQuestionResultToJson(QuizPerQuestionResult data) => json.encode(data.toJson());
class QuizPerQuestionResult {
int status;
bool error;
int total;
List<Datum> data;
QuizPerQuestionResult({
required this.status,
required this.error,
required this.total,
required this.data,
});
factory QuizPerQuestionResult.fromJson(Map<String, dynamic> json) => QuizPerQuestionResult(
status: json["status"],
error: json["error"],
total: json["total"],
data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"total": total,
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class Datum {
String id;
String quizId;
String title;
String type;
String numberOption;
List<String> options;
List<String> correctAnswers;
String order;
Datum({
required this.id,
required this.quizId,
required this.title,
required this.type,
required this.numberOption,
required this.options,
required this.correctAnswers,
required this.order,
});
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
id: json["id"],
quizId: json["quiz_id"],
title: json["title"],
type: json["type"],
numberOption: json["number_option"],
options: List<String>.from(json["options"].map((x) => x)),
correctAnswers: List<String>.from(json["correct_answers"].map((x) => x)),
order: json["order"],
);
Map<String, dynamic> toJson() => {
"id": id,
"quiz_id": quizId,
"title": title,
"type": type,
"number_option": numberOption,
"options": List<dynamic>.from(options.map((x) => x)),
"correct_answers": List<dynamic>.from(correctAnswers.map((x) => x)),
"order": order,
};
}

View File

@ -0,0 +1,71 @@
// To parse this JSON data, do
//
// final quizQuestion = quizQuestionFromJson(jsonString);
import 'dart:convert';
QuizQuestion quizQuestionFromJson(String str) =>
QuizQuestion.fromJson(json.decode(str));
String quizQuestionToJson(QuizQuestion data) => json.encode(data.toJson());
class QuizQuestion {
final List<Datum> data;
QuizQuestion({
required this.data,
});
factory QuizQuestion.fromJson(Map<String, dynamic> json) => QuizQuestion(
data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class Datum {
final String id;
final String quizId;
final String title;
final String type;
final String numberOption;
final List<String> options;
final List<String> correctAnswers;
final String order;
Datum({
required this.id,
required this.quizId,
required this.title,
required this.type,
required this.numberOption,
required this.options,
required this.correctAnswers,
required this.order,
});
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
id: json["id"],
quizId: json["quiz_id"],
title: json["title"],
type: json["type"],
numberOption: json["number_option"],
options: List<String>.from(json["options"].map((x) => x)),
correctAnswers:
List<String>.from(json["correct_answers"].map((x) => x)),
order: json["order"],
);
Map<String, dynamic> toJson() => {
"id": id,
"quiz_id": quizId,
"title": title,
"type": type,
"number_option": numberOption,
"options": List<dynamic>.from(options.map((x) => x)),
"correct_answers": List<dynamic>.from(correctAnswers.map((x) => x)),
"order": order,
};
}

View File

@ -0,0 +1,69 @@
// To parse this JSON data, do
//
// final quizQuestionResult = quizQuestionResultFromJson(jsonString);
import 'dart:convert';
QuizQuestionResult quizQuestionResultFromJson(String str) =>
QuizQuestionResult.fromJson(json.decode(str));
String quizQuestionResultToJson(QuizQuestionResult data) =>
json.encode(data.toJson());
class QuizQuestionResult {
final int status;
final bool error;
final List<Datum> data;
QuizQuestionResult({
required this.status,
required this.error,
required this.data,
});
factory QuizQuestionResult.fromJson(Map<String, dynamic> json) =>
QuizQuestionResult(
status: json["status"],
error: json["error"],
data: List<Datum>.from(json["data"].map((x) => Datum.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class Datum {
final int questionId;
final List<String> answers;
final String question;
final bool isCorrect;
final List<String> correctAnswers;
Datum({
required this.questionId,
required this.answers,
required this.question,
required this.isCorrect,
required this.correctAnswers,
});
factory Datum.fromJson(Map<String, dynamic> json) => Datum(
questionId: json["question_id"],
answers: List<String>.from(json["answers"].map((x) => x)),
question: json["question"],
isCorrect: json["is_correct"],
correctAnswers:
List<String>.from(json["correct_answers"].map((x) => x)),
);
Map<String, dynamic> toJson() => {
"question_id": questionId,
"answers": List<dynamic>.from(answers.map((x) => x)),
"question": question,
"is_correct": isCorrect,
"correct_answers": List<dynamic>.from(correctAnswers.map((x) => x)),
};
}

View File

@ -0,0 +1,19 @@
class Rating {
Rating({
this.totalReview,
this.avgRating,
});
String? totalReview;
int? avgRating;
factory Rating.fromJson(Map<String, dynamic> json) => Rating(
totalReview: json["total_review"],
avgRating: json["avg_rating"],
);
Map<String, dynamic> toJson() => {
"total_review": totalReview,
"avg_rating": avgRating,
};
}

View File

@ -0,0 +1,55 @@
class ReplyModel {
ReplyModel({
this.idRep,
this.sender,
this.name,
this.body,
this.fotoProfile,
this.updateAt,
this.createAt,
});
String? idRep;
String? sender;
String? name;
String? body;
String? fotoProfile;
String? updateAt;
String? createAt;
factory ReplyModel.fromJson(Map<String, dynamic> json) => ReplyModel(
idRep: json["id_replies"],
sender: json["sender"],
name: json["name"],
body: json["body"],
fotoProfile: json["foto_profile"],
createAt: json["created_at"],
updateAt: json["update_at"],
);
Map<String, dynamic> toJson() => {
"id_replies": idRep,
"sender": sender,
"name": name,
"body": body,
"foto_profile": fotoProfile,
"update_at": updateAt,
"created_at": createAt,
};
}
class LikeModels {
LikeModels({
this.userId,
});
bool? userId;
factory LikeModels.fromJson(Map<String, dynamic> json) => LikeModels(
userId: json["user_id"].length > 0,
);
Map<String, dynamic> toJson() => {
"id_replies": userId,
};
}

View File

@ -0,0 +1,15 @@
class ResetModel{
String? token;
String? email;
ResetModel({this.email, this.token});
factory ResetModel.fromJson(Map<String, dynamic> json) => ResetModel(
token: json["token"],
email: json["email"],
);
Map<String, dynamic> toJson() => {
"token": token,
"email": email,
};
}

View File

@ -0,0 +1,78 @@
class SectionLessonModel {
SectionLessonModel({
this.status,
this.error,
this.data,
});
final int? status;
final bool? error;
final List<List<SectionLessonList>>? data;
factory SectionLessonModel.fromJson(Map<String, dynamic> json) =>
SectionLessonModel(
status: json["status"],
error: json["error"],
data: List<List<SectionLessonList>>.from(json["data"].map((x) =>
List<SectionLessonList>.from(
x.map((x) => SectionLessonList.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(
data!.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
};
}
class SectionLessonList {
SectionLessonList({
this.title,
this.duration,
this.dataLesson,
});
final String? title;
final String? duration;
final List<List<DataLesson>>? dataLesson;
factory SectionLessonList.fromJson(Map<String, dynamic> json) =>
SectionLessonList(
title: json["title"],
duration: json["duration"] == null ? null : json["duration"],
dataLesson: List<List<DataLesson>>.from(json["data_lesson"].map((x) =>
List<DataLesson>.from(x.map((x) => DataLesson.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"title": title,
"duration": duration == null ? null : duration,
"data_lesson": List<dynamic>.from(dataLesson!
.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
};
}
class DataLesson {
DataLesson(
{this.titleLesson, this.duration, this.lessonType, this.attachment});
final String? titleLesson;
final String? duration;
final String? lessonType;
final String? attachment;
factory DataLesson.fromJson(Map<String, dynamic> json) => DataLesson(
titleLesson: json["title_lesson"],
duration: json["duration"],
lessonType: json["lesson_type"],
attachment: json["attachment"],
);
Map<String, dynamic> toJson() => {
"title_lesson": titleLesson,
"duration": duration,
"lesson_type": lessonType,
"attachment": attachment,
};
}

View File

@ -0,0 +1,187 @@
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,
};
}

View File

@ -0,0 +1,15 @@
class SocialLink {
SocialLink({
this.facebook,
});
String? facebook;
factory SocialLink.fromJson(Map<String, dynamic> json) => SocialLink(
facebook: json["facebook"],
);
Map<String, dynamic> toJson() => {
"facebook": facebook,
};
}

View File

@ -0,0 +1,23 @@
class SubCategoryModel {
final String subId;
final String nameSubCategory;
SubCategoryModel({
required this.subId,
required this.nameSubCategory,
});
factory SubCategoryModel.fromJson(Map<String, dynamic> json) {
return SubCategoryModel(
subId: json['id'],
nameSubCategory: json['name_subcategory'],
);
}
Map<String, dynamic> toJson() {
return {
'id': subId,
'name_subcategory': nameSubCategory,
};
}
}

View File

@ -0,0 +1,43 @@
class UpdateDataDiriModel {
UpdateDataDiriModel({
this.status,
this.error,
this.messages,
});
int? status;
bool? error;
dynamic messages;
factory UpdateDataDiriModel.fromJson(Map<String, dynamic> json) => UpdateDataDiriModel(
status: json["status"],
error: json["error"],
messages: json["status"] != 200
? MessagesOfUpdateDataDiriModel.fromJson(json["data"]["message"])
: json["data"]["messages"],
);
}
class MessagesOfUpdateDataDiriModel {
MessagesOfUpdateDataDiriModel({
this.fullname,
this.phone,
this.datebirth,
this.email,
this.gender,
});
String? fullname;
String? phone;
String? datebirth;
String? email;
String? gender;
factory MessagesOfUpdateDataDiriModel.fromJson(Map<String, dynamic> json) => MessagesOfUpdateDataDiriModel(
fullname: json["full_name"],
phone: json["phone"],
datebirth: json["datebirth"],
email: json["email"],
gender: json["jenis_kel"],
);
}

View File

@ -0,0 +1,57 @@
class UpdateIncompleteProfileModel {
UpdateIncompleteProfileModel({
this.status,
this.error,
this.messages,
});
int? status;
bool? error;
dynamic messages;
factory UpdateIncompleteProfileModel.fromJson(Map<String, dynamic> json) {
UpdateIncompleteProfileModel updateIncompleteProfileModel;
try {
updateIncompleteProfileModel = UpdateIncompleteProfileModel(
status: json["status"],
error: json["error"],
messages: json["status"] == 200
? json["data"]["messages"]
: json["status"] == 404
? json["message"]
: MessagesOfIncompleteProfileModel.fromJson(json["data"]["message"])
);
} catch(e) {
updateIncompleteProfileModel = UpdateIncompleteProfileModel(
status: json["status"],
error: json["error"],
messages: json["data"]["message"]
);
}
return updateIncompleteProfileModel;
}
}
class MessagesOfIncompleteProfileModel {
MessagesOfIncompleteProfileModel({
this.fullname,
this.phone,
this.datebirth,
this.email,
this.gender,
});
String? fullname;
String? phone;
String? datebirth;
String? email;
String? gender;
factory MessagesOfIncompleteProfileModel.fromJson(Map<String, dynamic> json) => MessagesOfIncompleteProfileModel(
fullname: json["full_name"],
phone: json["phone"],
datebirth: json["datebirth"],
email: json["email"],
gender: json["jenis_kel"],
);
}

View File

@ -0,0 +1,47 @@
class UpdatePasswordModel {
UpdatePasswordModel({
this.status,
this.error = false,
required this.data,
});
final int? status;
final bool error;
final List<Data> data;
factory UpdatePasswordModel.fromJson(Map<String, dynamic> json) =>
UpdatePasswordModel(
status: json["status"],
error: json["error"],
data: List<Data>.from(json["data"].map((x) => Data.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class Data {
Data({
this.message,
//required this.social_link,
});
final String? message;
//final List<SocialLink?> social_link;
factory Data.fromJson(Map<String, dynamic> json) => Data(
message: json["message"],
//social_link: List<SocialLink>.from(
//json["social_link"].map((x) => SocialLink.fromJson(x))).toList(),
);
Map<String, dynamic> toJson() => {
"message": message,
//"social_link":
// List<dynamic>.from(social_link.map((x) => x!.toJson())).toList(),
};
}

View File

@ -0,0 +1,53 @@
class UserInfoIncompleteModel {
UserInfoIncompleteModel({
this.status,
this.error,
this.data,
});
final int? status;
final bool? error;
final Data? data;
factory UserInfoIncompleteModel.fromJson(Map<String, dynamic> json) => UserInfoIncompleteModel(
status: json["status"],
error: json["error"],
data: Data.fromJson(json["data"][0]),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": data == null
? null
: [data!.toJson()],
};
}
class Data {
Data({
this.idUser,
this.fullname,
this.email,
this.phone,
});
final String? idUser;
final String? fullname;
final String? email;
final String? phone;
factory Data.fromJson(Map<String, dynamic> json) => Data(
idUser: json["id_user"],
fullname: json["full_name"],
email: json["email"],
phone: json["phone"],
);
Map<String, dynamic> toJson() => {
"id_user": idUser,
"full_name": fullname,
"email": email,
"phone": phone,
};
}

View File

@ -0,0 +1,55 @@
class UserInfoModel {
UserInfoModel({
this.status,
this.error = false,
required this.data,
});
final int? status;
final bool error;
final List<Data> data;
factory UserInfoModel.fromJson(Map<String, dynamic> json) => UserInfoModel(
status: json["status"],
error: json["error"],
data: List<Data>.from(json["data"].map((x) => Data.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(data.map((x) => x.toJson())),
};
}
class Data {
Data({
this.idUser,
this.fullname,
this.email,
this.fotoProfile,
this.isInstructor,
});
final String? idUser;
final String? fullname;
final String? email;
final String? fotoProfile;
final int? isInstructor;
factory Data.fromJson(Map<String, dynamic> json) => Data(
idUser: json["id_user"],
fullname: json["fullname"],
email: json["email"],
fotoProfile: json["foto_profile"],
isInstructor: json["is_instructor"],
);
Map<String, dynamic> toJson() => {
"id_user": idUser,
"fullname": fullname,
"email": email,
"foto_profile": fotoProfile,
"is_instructor": isInstructor,
};
}

View File

@ -0,0 +1,23 @@
class UserModel {
UserModel({
this.messages,
this.token,
this.expireAt,
});
final String? messages;
String? token;
final int? expireAt;
factory UserModel.fromJson(Map<String, dynamic> json) => UserModel(
messages: json["messages"],
token: json["token"],
expireAt: json["expire_at"],
);
Map<String, dynamic> toJson() => {
"messages": messages,
"token": token,
"expire_at": expireAt,
};
}

View File

@ -0,0 +1,90 @@
class VoucherModel {
int? status;
bool? error;
List<DataVoucher>? data;
VoucherModel({this.status, this.error, this.data});
VoucherModel.fromJson(Map<String, dynamic> json) {
status =
json['status'] is String ? int.parse(json['status']) : json['status'];
error = json['error'];
if (json['data'] != null) {
data = <DataVoucher>[];
json['data'].forEach((v) {
data!.add(new DataVoucher.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
data['error'] = this.error;
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
return data;
}
}
class DataVoucher {
String? idCourse;
String? typeCoupon;
String? value;
String? discountFlag;
String? courseName;
String? instructor;
String? fotoProfile;
String? thubmnail;
String? originalPrice;
dynamic discountPrice;
dynamic finalPrice;
DataVoucher(
{this.idCourse,
this.typeCoupon,
this.value,
this.discountFlag,
this.courseName,
this.instructor,
this.fotoProfile,
this.thubmnail,
this.originalPrice,
this.discountPrice,
this.finalPrice});
DataVoucher.fromJson(Map<String, dynamic> json) {
idCourse = json['id_course'];
typeCoupon = json['type_coupon'];
value = json['value'];
discountFlag = json['discount_flag'];
courseName = json['course_name'];
instructor = json['instructor'];
fotoProfile = json['foto_profile'];
thubmnail = json['thubmnail'];
originalPrice = json['original_price'];
discountPrice = json['discount_price'] is String
? int.parse(json['discount_price'])
: json['discount_price'];
finalPrice = json['final_price'] is String
? int.parse(json['final_price'])
: json['final_price'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id_course'] = this.idCourse;
data['type_coupon'] = this.typeCoupon;
data['value'] = this.value;
data['discount_flag'] = this.discountFlag;
data['course_name'] = this.courseName;
data['instructor'] = this.instructor;
data['foto_profile'] = this.fotoProfile;
data['thubmnail'] = this.thubmnail;
data['original_price'] = this.originalPrice;
data['discount_price'] = this.discountPrice;
data['final_price'] = this.finalPrice;
return data;
}
}

View File

@ -0,0 +1,152 @@
/// Class untuk mengambil data wishlist
class WishlistModel {
WishlistModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final List<List<DataWihslistModel>> data;
factory WishlistModel.fromJson(Map<String, dynamic> json) => WishlistModel(
status: json["status"],
error: json["error"],
data: List<List<DataWihslistModel>>.from(json["data"].map((x) =>
List<DataWihslistModel>.from(
x.map((x) => DataWihslistModel.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(
data.map((x) => List<dynamic>.from(x.map((x) => x.toJson())))),
};
}
class DataWihslistModel {
DataWihslistModel({
this.wishlistId,
this.courseId,
this.title,
this.price,
this.instructor,
this.thumbnail,
this.discountPrice,
this.discountFlag,
this.totalDiscount,
this.student,
required this.review,
this.fotoProfile,
});
final String? wishlistId;
final String? courseId;
final String? title;
final String? price;
final String? instructor;
final String? thumbnail;
final String? discountPrice;
final String? discountFlag;
final int? totalDiscount;
final String? student;
final List<Review> review;
final dynamic fotoProfile;
factory DataWihslistModel.fromJson(Map<String, dynamic> json) =>
DataWihslistModel(
wishlistId: json["wishlist_id"],
courseId: json["course_id"],
title: json["title"],
price: json["price"],
instructor: json["instructor"],
thumbnail: json["thumbnail"] == null ? null : json["thumbnail"],
discountPrice: json["discount_price"],
discountFlag: json["discount_flag"],
totalDiscount: json["total_discount"],
student: json["student"],
review:
List<Review>.from(json["review"].map((x) => Review.fromJson(x))),
fotoProfile: json["foto_profile"],
);
Map<String, dynamic> toJson() => {
"wishlist_id": wishlistId,
"course_id": courseId,
"title": title,
"price": price,
"instructor": instructor,
"thumbnail": thumbnail == null ? null : thumbnail,
"discount_price": discountPrice,
"discount_flag": discountFlag,
"total_discount": totalDiscount,
"student": student,
"review": List<dynamic>.from(review.map((x) => x.toJson())),
"foto_profile": fotoProfile,
};
}
class Review {
Review({
this.totalReview,
this.avgRating,
});
final String? totalReview;
final int? avgRating;
factory Review.fromJson(Map<String, dynamic> json) => Review(
totalReview: json["total_review"],
avgRating: json["avg_rating"] == null ? null : json["avg_rating"],
);
Map<String, dynamic> toJson() => {
"total_review": totalReview,
"avg_rating": avgRating == null ? null : avgRating,
};
}
class WishlistPostModel {
WishlistPostModel({
this.status,
this.error,
required this.data,
});
final int? status;
final bool? error;
final DataPostWishlist data;
factory WishlistPostModel.fromJson(Map<String, dynamic> json) =>
WishlistPostModel(
status: json["status"],
error: json["error"],
data: DataPostWishlist.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": data.toJson(),
};
}
class DataPostWishlist {
DataPostWishlist({
this.messages,
});
final String? messages;
factory DataPostWishlist.fromJson(Map<String, dynamic> json) =>
DataPostWishlist(
messages: json["messages"],
);
Map<String, dynamic> toJson() => {
"messages": messages,
};
}

View File

@ -0,0 +1,54 @@
// To parse this JSON data, do
//
// final zeroPrice = zeroPriceFromJson(jsonString);
import 'dart:convert';
ZeroPrice zeroPriceFromJson(String str) => ZeroPrice.fromJson(json.decode(str));
String zeroPriceToJson(ZeroPrice data) => json.encode(data.toJson());
class ZeroPrice {
ZeroPrice({
this.status,
this.error,
this.data,
});
final int? status;
final bool? error;
List<Data>? data;
factory ZeroPrice.fromJson(Map<String, dynamic> json) => ZeroPrice(
status: json["status"],
error: json["error"],
data: List<Data>.from(json["data"]
.map((x) => List<Data>.from(x.map((x) => Data.fromJson(x))))),
);
Map<String, dynamic> toJson() => {
"status": status,
"error": error,
"data": List<dynamic>.from(data!.map((x) => x.toJson())),
};
}
class Data {
Data({
this.orderId,
this.grossAmount,
});
final String? orderId;
final String? grossAmount;
factory Data.fromJson(Map<String, dynamic> json) => Data(
orderId: json["order_id"],
grossAmount: json["gross_amount"],
);
Map<String, dynamic> toJson() => {
"order_id": orderId,
"gross_amount": grossAmount,
};
}