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/manager/event_voting_model.dart

103 lines
2.6 KiB

3 years ago
import 'package:aku_new_community/model/common/img_model.dart';
2 years ago
import 'package:common_utils/common_utils.dart';
class EventVotingModel {
3 years ago
int? id;
String? title;
String? content;
String? beginDate;
String? endDate;
int? status;
List<ImgModel>? imgUrls;
List<ImgModel>? headImgURls;
2 years ago
bool? vote;
bool? allowVote;
DateTime? get beginDT => DateUtil.getDateTime(beginDate!);
DateTime? get endDT => DateUtil.getDateTime(endDate!);
EventVotingModel(
{this.id,
this.title,
this.content,
this.beginDate,
this.endDate,
this.status,
this.imgUrls,
2 years ago
this.headImgURls,
this.vote,
this.allowVote,});
EventVotingModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
content = json['content'];
beginDate = json['beginDate'];
endDate = json['endDate'];
status = json['status'];
2 years ago
if (json['imgList'] != null) {
4 years ago
imgUrls = [];
2 years ago
json['imgList'].forEach((v) {
3 years ago
imgUrls!.add(new ImgModel.fromJson(v));
});
} else
imgUrls = [];
2 years ago
if (json['headImgList'] != null) {
4 years ago
headImgURls = [];
2 years ago
json['headImgList'].forEach((v) {
3 years ago
headImgURls!.add(new ImgModel.fromJson(v));
});
} else
headImgURls = [];
2 years ago
vote=json['vote'];
allowVote=json['allowVote'];
}
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['beginDate'] = this.beginDate;
data['endDate'] = this.endDate;
data['status'] = this.status;
if (this.imgUrls != null) {
2 years ago
data['imgList'] = this.imgUrls!.map((v) => v.toJson()).toList();
}
if (this.headImgURls != null) {
2 years ago
data['headImgList'] = this.headImgURls!.map((v) => v.toJson()).toList();
}
2 years ago
data['vote'] = this.vote;
data['allowVote'] = this.allowVote;
return data;
}
}
class ImgUrls {
3 years ago
String? url;
String? size;
int? longs;
int? paragraph;
int? sort;
ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort});
ImgUrls.fromJson(Map<String, dynamic> json) {
url = json['url'];
size = json['size'];
longs = json['longs'];
paragraph = json['paragraph'];
sort = json['sort'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
data['size'] = this.size;
data['longs'] = this.longs;
data['paragraph'] = this.paragraph;
data['sort'] = this.sort;
return data;
}
}