question_model.dart 3.6 KB

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