question_model.dart 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. class QuestionListModel{
  2. // String brand;
  3. // String title;
  4. // String icon;
  5. // String name;
  6. // String time;
  7. // String desc;
  8. // List<dynamic> imgList;
  9. // String nums;
  10. // VoidCallback onPressed;
  11. // QuestionList({
  12. // this.brand,
  13. // this.title,
  14. // this.icon,
  15. // this.name,
  16. // this.time,
  17. // this.desc,
  18. // this.imgList,
  19. // this.nums,
  20. // this.onPressed,
  21. // });
  22. // static List<QuestionList> questions =[
  23. // new QuestionList(
  24. // brand:"三菱",
  25. // title:"电梯常见故障有哪些?",
  26. // icon:"temporary/tou1",
  27. // name:"小小维修工",
  28. // time:"2020-02-20",
  29. // desc:"1.闭合底层钥匙开关,基站不能开门 可能原因: 1.控制回路保险丝熔断 2.钥匙开关按点接触不良或破坏 3.底...",
  30. // imgList:null,
  31. // nums:"100"
  32. // ),
  33. // new QuestionList(
  34. // brand:"奥的斯",
  35. // title:"电梯不能正常开门是什么原因?",
  36. // icon:"temporary/tou2",
  37. // name:"小阿哥",
  38. // time:"2020-02-20",
  39. // desc:"1.闭合底层钥匙开关,基站不能开门 可能原因: 1.控制回路保险丝熔断 2.钥匙开关按点接触不良或破坏 3.底...",
  40. // imgList:['temporary/wen1','temporary/wen2','temporary/wen3'],
  41. // nums:"101"
  42. // ),
  43. // ];
  44. List<QuestionListItem> data;
  45. QuestionListModel(this.data);
  46. factory QuestionListModel.fromJson(List json){
  47. return QuestionListModel(
  48. json.map((i)=>QuestionListItem.fromJson((i))).toList()
  49. );
  50. }
  51. // List<QuestionListItem> data;
  52. // int errorCode;
  53. // String errorMsg;
  54. // QuestionListModel({this.data, this.errorCode, this.errorMsg});
  55. // QuestionListModel.fromJson(Map<String, dynamic> json) {
  56. // data = new List<QuestionListItem>();
  57. // json['questionListItem'].forEach((v) {
  58. // data.add(new QuestionListItem.fromJson(v));
  59. // });
  60. // }
  61. // Map<String, dynamic> toJson() {
  62. // final Map<String, dynamic> data = new Map<String, dynamic>();
  63. // if (this.data != null) {
  64. // data['questionListItem'] = this.data.map((v) => v.toJson()).toList();
  65. // }
  66. // return data;
  67. // }
  68. }
  69. class QuestionListItem{
  70. String brand;
  71. String title;
  72. String icon;
  73. String name;
  74. String time;
  75. String desc;
  76. List<dynamic> imgList;
  77. String nums;
  78. QuestionListItem({
  79. this.brand,
  80. this.title,
  81. this.icon,
  82. this.name,
  83. this.time,
  84. this.desc,
  85. this.imgList,
  86. this.nums,
  87. });
  88. // QuestionListItem.fromJson(Map<String,dynamic> json){
  89. // QuestionListItem(
  90. // brand:json["brand"],
  91. // title:json["title"],
  92. // icon:json["icon"],
  93. // name:json["name"],
  94. // time:json["time"],
  95. // desc:json["desc"],
  96. // imgList:json["imgList"],
  97. // nums:json["nums"],
  98. // );
  99. // }
  100. factory QuestionListItem.fromJson(dynamic json){
  101. return QuestionListItem(
  102. brand:json["brand"],
  103. title:json["title"],
  104. icon:json["icon"],
  105. name:json["name"],
  106. time:json["time"],
  107. desc:json["desc"],
  108. imgList:json["imgList"],
  109. nums:json["nums"],
  110. );
  111. }
  112. // Map<String,dynamic> toJson(){
  113. // final Map<String,dynamic> questionListItem = new Map<String,dynamic>();
  114. // questionListItem["brand"] = this.brand;
  115. // questionListItem["title"] = this.title;
  116. // questionListItem["icon"] = this.icon;
  117. // questionListItem["name"] = name;
  118. // questionListItem["time"] = time;
  119. // questionListItem["desc"] = desc;
  120. // questionListItem["imgList"] = imgList;
  121. // questionListItem["nums"] = nums;
  122. // }
  123. }