基础组件库
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.

custom_goods_creater.dart 1.1 KiB

1234567891011121314151617181920212223242526272829303132333435
  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. import 'category_goods/category_goods_creater.dart';
  7. import 'category_goods/category_goods_creater2.dart';
  8. ///
  9. /// 通用模块的商品列表
  10. ///
  11. class CustomGoodsCreater extends WidgetCreater {
  12. WidgetCreater creater;
  13. @override
  14. List<Widget> createWidgets(Map<String, dynamic> model) {
  15. Map<String, dynamic> json = jsonDecode(model['data']);
  16. // 有Tab头部的商品列表
  17. if (!EmptyUtil.isEmpty(json['recommend_list'])) {
  18. // creater = CategoryGoodsListCreater2();
  19. // creater = CategoryGoodsListCreater();
  20. creater = GoodsListCreater();
  21. } else {
  22. // 没有Tab头部的商品列表
  23. creater = GoodsDetailCommendCreater();
  24. }
  25. return creater?.createWidgets(model) ?? SliverToBoxAdapter(child: Container());
  26. }
  27. @override
  28. bool isSliverChild() {
  29. return creater?.isSliverChild() ?? true;
  30. }
  31. }