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

78 lines
2.3 KiB

3 years ago
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:common_utils/common_utils.dart';
class ActivityDetailModel {
4 years ago
int? id;
String? title;
String? content;
String? location;
String? activityStartTime;
String? activityEndTime;
String? registrationEndTime;
int? countRegistration;
List<ImgModel>? imgUrls;
List<ImgModel>? headImgURls;
4 years ago
DateTime? get startDate => DateUtil.getDateTime(activityStartTime!);
3 years ago
4 years ago
DateTime? get endDate => DateUtil.getDateTime(activityEndTime!);
3 years ago
4 years ago
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) {
4 years ago
imgUrls!.add(new ImgModel.fromJson(v));
});
} else
imgUrls = [];
if (json['headImgURls'] != null) {
4 years ago
headImgURls = [];
json['headImgURls'].forEach((v) {
4 years ago
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) {
4 years ago
data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList();
}
if (this.headImgURls != null) {
4 years ago
data['headImgURls'] = this.headImgURls!.map((v) => v.toJson()).toList();
}
return data;
}
}