You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aku_new_community/lib/model/community/activity_detail_model.dart

77 lines
2.2 KiB

import 'package:flustars/flustars.dart';
import 'package:aku_community/model/common/img_model.dart';
4 years ago
class ActivityDetailModel {
int id;
String title;
String content;
String location;
String activityStartTime;
String activityEndTime;
String registrationEndTime;
int countRegistration;
List<ImgModel> imgUrls;
List<ImgModel> headImgURls;
DateTime get startDate => DateUtil.getDateTime(activityStartTime);
DateTime get endDate => DateUtil.getDateTime(activityEndTime);
DateTime get registEndDate => DateUtil.getDateTime(registrationEndTime);
ActivityDetailModel(
{this.id,
this.title,
this.content,
this.location,
this.activityStartTime,
this.activityEndTime,
this.registrationEndTime,
this.countRegistration,
this.imgUrls,
this.headImgURls});
ActivityDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
content = json['content'];
location = json['location'];
activityStartTime = json['activityStartTime'];
activityEndTime = json['activityEndTime'];
registrationEndTime = json['registrationEndTime'];
countRegistration = json['countRegistration'];
if (json['imgUrls'] != null) {
4 years ago
imgUrls = [];
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgModel.fromJson(v));
});
} else
imgUrls = [];
if (json['headImgURls'] != null) {
4 years ago
headImgURls = [];
json['headImgURls'].forEach((v) {
headImgURls.add(new ImgModel.fromJson(v));
});
} else
headImgURls = [];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['title'] = this.title;
data['content'] = this.content;
data['location'] = this.location;
data['activityStartTime'] = this.activityStartTime;
data['activityEndTime'] = this.activityEndTime;
data['registrationEndTime'] = this.registrationEndTime;
data['countRegistration'] = this.countRegistration;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
if (this.headImgURls != null) {
data['headImgURls'] = this.headImgURls.map((v) => v.toJson()).toList();
}
return data;
}
}