From 414671863c35f39e2c24adb392304a23aa93e6f3 Mon Sep 17 00:00:00 2001
From: Weller <1812208341@qq.com>
Date: Fri, 9 Oct 2020 17:10:16 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=95=86=E5=93=81=E8=AF=A6?=
 =?UTF-8?q?=E6=83=85=EF=BC=8C=E6=8E=A8=E8=8D=90=E5=88=97=E8=A1=A8=E9=87=8D?=
 =?UTF-8?q?=E7=94=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../recommend/goods_detail_commend_list.dart  | 84 +++++++++----------
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/lib/widgets/goods_details/recommend/goods_detail_commend_list.dart b/lib/widgets/goods_details/recommend/goods_detail_commend_list.dart
index 97d17b7..3f0e7d6 100644
--- a/lib/widgets/goods_details/recommend/goods_detail_commend_list.dart
+++ b/lib/widgets/goods_details/recommend/goods_detail_commend_list.dart
@@ -72,7 +72,9 @@ class _GoodsDetailCommendListContainerState
     super.didChangeDependencies();
     print('didChangeDependencies');
     bool isNeedLoadMore =
-        Provider.of<GoodsDetailsPageNotifier>(context).scrollEnd;
+        Provider
+            .of<GoodsDetailsPageNotifier>(context)
+            .scrollEnd;
     if (isNeedLoadMore && _provider != '') {
       print('HomeGoods loadmore...');
       _bloc.loadMore(_provider);
@@ -81,52 +83,50 @@ class _GoodsDetailCommendListContainerState
 
   @override
   Widget build(BuildContext context) {
-    return Container(
-      width: double.infinity,
-      child: StreamBuilder<List<HomeGoodsModel>>(
+    return StreamBuilder<List<HomeGoodsModel>>(
         stream: _bloc.outData,
         builder: (BuildContext context, AsyncSnapshot snapshot) {
-          if (snapshot.data == null) {
-            return Container();
-          }
+          // if (snapshot.data == null) {
+          //   return Container();
+          // }
 
           List<HomeGoodsModel> goods = snapshot.data;
           int column = 2;
-          int count = (goods.length / column).ceil();
-          return ListView.builder(
-              shrinkWrap: true,
-              physics: NeverScrollableScrollPhysics(),
-              itemCount: count,
-              itemBuilder: (context, index) {
-                if (column == 1) {
-                  return HomeGoodsItemSingle(
-                    goods[index],
-                    _style,
-                    data: widget.data,
-                  );
-                } else {
-                  // return Container(color: Colors.red, height: 126,margin: EdgeInsets.all(10),);
-                  return Padding(
-                    padding: const EdgeInsets.only(left: 5, right: 5),
-                    child: Row(
-                      children: List.generate(column, (c) {
-                        int i = index * column + c;
-                        return Expanded(
-                          child: i < goods.length
-                              ? HomeGoodsItem(
-                                  goods[i],
-                                  _style,
-                                  data: widget.data,
-                                )
-                              : Container(),
-                        );
-                      }).toList(),
-                    ),
-                  );
-                }
-              });
-        },
-      ),
+          int count = ((goods?.length ?? 0) / column).ceil();
+          return SliverList(
+            delegate: SliverChildBuilderDelegate((context, index) {
+              if (column == 1) {
+                return HomeGoodsItemSingle(
+                  goods[index],
+                  _style,
+                  data: widget.data,
+                );
+              } else {
+                // return Container(color: Colors.red, height: 126,margin: EdgeInsets.all(10),);
+                return Padding(
+                  padding: const EdgeInsets.only(left: 5, right: 5),
+                  child: Row(
+                    children: List.generate(column, (c) {
+                      int i = index * column + c;
+                      return Expanded(
+                        child: i < goods.length
+                            ? HomeGoodsItem(
+                          goods[i],
+                          _style,
+                          data: widget.data,
+                        )
+                            : Container(),
+                      );
+                    }).toList(),
+                  ),
+                );
+              }
+            }, childCount
+                :
+            count
+              ,
+            ),);
+        }
     );
   }
 }