基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 rivejä
955 B

  1. import 'dart:convert';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:zhiying_base_widget/widgets/goods_details/recommend/goods_detail_commend_creater.dart';
  4. import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart';
  5. import 'package:zhiying_comm/zhiying_comm.dart';
  6. ///
  7. /// 通用模块的商品列表
  8. ///
  9. class CustomGoodsCreater extends WidgetCreater {
  10. WidgetCreater creater;
  11. @override
  12. List<Widget> createWidgets(Map<String, dynamic> model) {
  13. Map<String, dynamic> json = jsonDecode(model['data']);
  14. // 有Tab头部的商品列表
  15. if (!EmptyUtil.isEmpty(json['recommend_list'])) {
  16. creater = GoodsListCreater();
  17. } else {
  18. // 没有Tab头部的商品列表
  19. creater = GoodsDetailCommendCreater();
  20. }
  21. return creater?.createWidgets(model) ?? SliverToBoxAdapter(child: Container());
  22. }
  23. @override
  24. bool isSliverChild() {
  25. return creater?.isSliverChild() ?? true;
  26. }
  27. }