|
- import 'dart:convert';
- import 'package:flutter/cupertino.dart';
- import 'package:zhiying_base_widget/widgets/goods_details/recommend/goods_detail_commend_creater.dart';
- import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart';
- import 'package:zhiying_comm/zhiying_comm.dart';
-
- ///
- /// 通用模块的商品列表
- ///
- class CustomGoodsCreater extends WidgetCreater {
- WidgetCreater creater;
-
- @override
- List<Widget> createWidgets(Map<String, dynamic> model) {
- Map<String, dynamic> json = jsonDecode(model['data']);
- // 有Tab头部的商品列表
- if (!EmptyUtil.isEmpty(json['recommend_list'])) {
- creater = GoodsListCreater();
- } else {
- // 没有Tab头部的商品列表
- creater = GoodsDetailCommendCreater();
- }
- return creater?.createWidgets(model) ?? SliverToBoxAdapter(child: Container());
- }
-
- @override
- bool isSliverChild() {
- return creater?.isSliverChild() ?? true;
- }
- }
|