import 'package:flutter/material.dart'; class QuestionListModel{ // String brand; // String title; // String icon; // String name; // String time; // String desc; // List imgList; // String nums; // VoidCallback onPressed; // QuestionList({ // this.brand, // this.title, // this.icon, // this.name, // this.time, // this.desc, // this.imgList, // this.nums, // this.onPressed, // }); // static List questions =[ // new QuestionList( // brand:"三菱", // title:"电梯常见故障有哪些?", // icon:"temporary/tou1", // name:"小小维修工", // time:"2020-02-20", // desc:"1.闭合底层钥匙开关,基站不能开门 可能原因: 1.控制回路保险丝熔断 2.钥匙开关按点接触不良或破坏 3.底...", // imgList:null, // nums:"100" // ), // new QuestionList( // brand:"奥的斯", // title:"电梯不能正常开门是什么原因?", // icon:"temporary/tou2", // name:"小阿哥", // time:"2020-02-20", // desc:"1.闭合底层钥匙开关,基站不能开门 可能原因: 1.控制回路保险丝熔断 2.钥匙开关按点接触不良或破坏 3.底...", // imgList:['temporary/wen1','temporary/wen2','temporary/wen3'], // nums:"101" // ), // ]; List data; QuestionListModel(this.data); factory QuestionListModel.fromJson(List json){ return QuestionListModel( json.map((i)=>QuestionListItem.fromJson((i))).toList() ); } // List data; // int errorCode; // String errorMsg; // QuestionListModel({this.data, this.errorCode, this.errorMsg}); // QuestionListModel.fromJson(Map json) { // data = new List(); // json['questionListItem'].forEach((v) { // data.add(new QuestionListItem.fromJson(v)); // }); // } // Map toJson() { // final Map data = new Map(); // if (this.data != null) { // data['questionListItem'] = this.data.map((v) => v.toJson()).toList(); // } // return data; // } } class QuestionListItem{ String brand; String title; String icon; String name; String time; String desc; List imgList; String nums; QuestionListItem({ this.brand, this.title, this.icon, this.name, this.time, this.desc, this.imgList, this.nums, }); // QuestionListItem.fromJson(Map json){ // QuestionListItem( // brand:json["brand"], // title:json["title"], // icon:json["icon"], // name:json["name"], // time:json["time"], // desc:json["desc"], // imgList:json["imgList"], // nums:json["nums"], // ); // } factory QuestionListItem.fromJson(dynamic json){ return QuestionListItem( brand:json["brand"], title:json["title"], icon:json["icon"], name:json["name"], time:json["time"], desc:json["desc"], imgList:json["imgList"], nums:json["nums"], ); } // Map toJson(){ // final Map questionListItem = new Map(); // questionListItem["brand"] = this.brand; // questionListItem["title"] = this.title; // questionListItem["icon"] = this.icon; // questionListItem["name"] = name; // questionListItem["time"] = time; // questionListItem["desc"] = desc; // questionListItem["imgList"] = imgList; // questionListItem["nums"] = nums; // } }