|
1234567891011121314151617181920212223242526272829303132333435 |
- 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';
-
- import 'category_goods/category_goods_creater.dart';
- import 'category_goods/category_goods_creater2.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 = CategoryGoodsListCreater2();
- // creater = CategoryGoodsListCreater();
- creater = GoodsListCreater();
- } else {
- // 没有Tab头部的商品列表
- creater = GoodsDetailCommendCreater();
- }
- return creater?.createWidgets(model) ?? SliverToBoxAdapter(child: Container());
- }
-
- @override
- bool isSliverChild() {
- return creater?.isSliverChild() ?? true;
- }
- }
|