123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import 'package:shuqi/model/novel.dart';
- class HomeModule {
- late String id;
- late String name;
- late int style;
- late List content;
- List<CarouselInfo>? carousels;
- List<MenuInfo>? menus;
- List<Novel>? books;
- HomeModule.fromJson(Map data) {
- id = data['id'];
- name = data['m_s_name'];
- content = data['content'];
- if (name == '顶部banner') {
- carousels = [];
- content.forEach((data) {
- carousels!.add(CarouselInfo.fromJson(data));
- });
- }
- if (name == '顶部导航') {
- menus = [];
- content.forEach((data) {
- menus!.add(MenuInfo.fromJson(data));
- });
- }
- if (data['m_s_style'] != null) {
- style = data['m_s_style'];
- books = [];
- content.forEach((data) {
- books!.add(Novel.fromJson(data));
- });
- }
- }
- }
- class MenuInfo {
- late String title;
- late String icon;
- MenuInfo.fromJson(Map data) {
- title = data['toTitle'];
- icon = data['icon'];
- }
- }
- class CarouselInfo {
- String? imageUrl;
- late String link;
- CarouselInfo.fromJson(Map data) {
- imageUrl = data['image_url'];
- link = data['link_url'];
- }
- }
|