// Author: fengshengxiong // Date: 2024/6/20 // Description: 首页实际展示数据模型 import 'dart:convert'; class HomeModel { String? headerTitle; List? contents; String? browseType; HomeModel({ this.headerTitle, this.contents, this.browseType, }); factory HomeModel.fromJson(String str) => HomeModel.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory HomeModel.fromMap(Map json) => HomeModel( headerTitle: json["headerTitle"], contents: json["contents"] == null ? [] : List.from(json["contents"]!.map((x) => Content.fromMap(x))), browseType: json["browseType"] ); Map toMap() => { "headerTitle": headerTitle, "contents": contents == null ? [] : List.from(contents!.map((x) => x.toMap())), "browseType": browseType, }; } class Content { String? title; String? subTitle; String? thumbnail; String? videoId; String? playlistId; String? browseId; String? params; Content({ this.title, this.subTitle, this.thumbnail, this.videoId, this.playlistId, this.browseId, this.params, }); factory Content.fromJson(String str) => Content.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory Content.fromMap(Map json) => Content( title: json["title"], subTitle: json["subTitle"], thumbnail: json["thumbnail"], videoId: json["videoId"], playlistId: json["playlistId"], browseId: json["browseId"], params: json["params"], ); Map toMap() => { "title": title, "subTitle": subTitle, "thumbnail": thumbnail, "videoId": videoId, "playlistId": playlistId, "browseId": browseId, "params": params, }; }