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

60 lines
1.5 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:zhiying_base_widget/widgets/home_goods/home_goods.dart';
  3. import 'package:zhiying_base_widget/widgets/home_goods/home_goods_header.dart';
  4. import 'package:zhiying_base_widget/widgets/home_goods/skeleton/home_goods_header_sk.dart';
  5. import 'package:zhiying_base_widget/widgets/home_goods/skeleton/home_goods_sk.dart';
  6. import 'package:zhiying_comm/zhiying_comm.dart';
  7. class GoodsListCreater extends WidgetCreater {
  8. @override
  9. List<Widget> createWidgets(Map<String, dynamic> model) {
  10. TabController controller =
  11. TabController(initialIndex: 0, length: 6, vsync: ScrollableState());
  12. return [
  13. _createHeader(controller),
  14. _createBody(controller),
  15. ];
  16. }
  17. @override
  18. List<Widget> createSkeleton(Map<String, dynamic> model) {
  19. return [
  20. _createHeaderSkeleton(),
  21. _createBodySkeleton(),
  22. ];
  23. }
  24. Widget _createHeader(TabController controller) {
  25. return SliverPersistentHeader(
  26. pinned: true,
  27. floating: false,
  28. delegate: HomeGoodsDelegate(controller),
  29. );
  30. }
  31. Widget _createHeaderSkeleton() {
  32. return SliverPersistentHeader(
  33. pinned: true,
  34. floating: false,
  35. delegate: HomeGoodsHeaderSkeletonDelegate(),
  36. );
  37. }
  38. Widget _createBody(TabController controller) {
  39. return SliverToBoxAdapter(
  40. child: HomeGoods(),
  41. );
  42. }
  43. Widget _createBodySkeleton() {
  44. return SliverToBoxAdapter(
  45. child: HomeGoodsSkeleton(),
  46. );
  47. }
  48. @override
  49. bool isSliverChild() {
  50. return true;
  51. }
  52. }