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.

82 lines
2.2KB

  1. class Nursery {
  2. int cropId;
  3. String executeDate;
  4. String description;
  5. String substrates;
  6. num quantity;
  7. num seedLength;
  8. num seedIncubationTime;
  9. List<NurseryDetail> nurseryDetail;
  10. Nursery(
  11. {this.cropId,
  12. this.executeDate,
  13. this.description,
  14. this.substrates,
  15. this.quantity,
  16. this.seedLength,
  17. this.seedIncubationTime,
  18. this.nurseryDetail});
  19. Nursery.fromJson(Map<String, dynamic> json) {
  20. cropId = json['cropId'];
  21. executeDate = json['executeDate'];
  22. description = json['description'];
  23. substrates = json['substrates'];
  24. quantity = json['quantity'];
  25. seedLength = json['seedLength'];
  26. seedIncubationTime = json['seedIncubationTime'];
  27. if (json['nurseryDetail'] != null) {
  28. nurseryDetail = new List<NurseryDetail>();
  29. json['nurseryDetail'].forEach((v) {
  30. nurseryDetail.add(new NurseryDetail.fromJson(v));
  31. });
  32. }
  33. }
  34. Map<String, dynamic> toJson() {
  35. final Map<String, dynamic> data = new Map<String, dynamic>();
  36. data['cropId'] = this.cropId;
  37. data['executeDate'] = this.executeDate;
  38. data['description'] = this.description;
  39. data['substrates'] = this.substrates;
  40. data['quantity'] = this.quantity;
  41. data['seedLength'] = this.seedLength;
  42. data['seedIncubationTime'] = this.seedIncubationTime;
  43. if (this.nurseryDetail != null) {
  44. data['nurseryDetail'] =
  45. this.nurseryDetail.map((v) => v.toJson()).toList();
  46. }
  47. return data;
  48. }
  49. }
  50. class NurseryDetail {
  51. int id;
  52. String workerName;
  53. String trayNumber;
  54. bool isExpanded = false;
  55. NurseryDetail({this.workerName, this.trayNumber});
  56. NurseryDetail.clone(NurseryDetail nurseryDetail) {
  57. this.id = nurseryDetail.id;
  58. this.workerName = nurseryDetail.workerName;
  59. this.trayNumber = nurseryDetail.trayNumber;
  60. this.isExpanded = nurseryDetail.isExpanded;
  61. }
  62. NurseryDetail.fromJson(Map<String, dynamic> json) {
  63. id = json['id'];
  64. workerName = json['workerName'];
  65. trayNumber = json['trayNumber'];
  66. }
  67. Map<String, dynamic> toJson() {
  68. final Map<String, dynamic> data = new Map<String, dynamic>();
  69. data['id'] = this.id;
  70. data['workerName'] = this.workerName;
  71. data['trayNumber'] = this.trayNumber;
  72. return data;
  73. }
  74. }