抖动列表视图不以0

时间:2020-04-26 17:08:34

标签: flutter

SliverGeometry is not valid: The "scrollExtent" is negative.
The relevant error-causing widget was
    ListView 
lib/OnlyCallUI/CallCategoryUI.dart:47


The following RenderObject was being processed when the exception was fired: RenderSliverList#fa84c relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
RenderObject: RenderSliverList#fa84c relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
    needs compositing
    parentData: paintOffset=Offset(0.0, 0.0) (can use size)
    constraints: SliverConstraints(AxisDirection.down, GrowthDirection.forward, ScrollDirection.idle, scrollOffset: 0.0, remainingPaintExtent: 95.8, crossAxisExtent: 375.0, crossAxisDirection: AxisDirection.right, viewportMainAxisExtent: 95.8, remainingCacheExtent: 345.8 cacheOrigin: 0.0 )
    geometry: SliverGeometry(scrollExtent: -0.0, hidden, maxPaintExtent: -0.0)
 scrollExtent: -0.0
        hidden
        maxPaintExtent: -0.0
    currently live children: 9 to 9
    child with index 9: RenderIndexedSemantics#e1039 relayoutBoundary=up3
        needs compositing
        parentData: index=9; layoutOffset=-0.0 (can use size)
        constraints: BoxConstraints(w=375.0, 0.0<=h<=Infinity)
        semantic boundary
        size: Size(375.0, 0.0)
        index: 9
 child: RenderRepaintBoundary#a760a relayoutBoundary=up4
            needs compositing
            parentData: <none> (can use size)
            constraints: BoxConstraints(w=375.0, 0.0<=h<=Infinity)
            layer: OffsetLayer#283e1 DETACHED
                offset: Offset(0.0, 101.5)
            size: Size(375.0, 0.0)
            metrics: 96.7% useful (1 bad vs 29 good)
            diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept
            child: RenderConstrainedBox#db1c5 relayoutBoundary=up5
                parentData: <none> (can use size)
                constraints: BoxConstraints(w=375.0, 0.0<=h<=Infinity)
                size: Size(375.0, 0.0)

这是我收到的错误消息

Container(
      child: ListView.builder(
        padding: EdgeInsets.all(0),
        //shrinkWrap: true,
        itemCount: dataList.length,
        itemBuilder: (context, index) {
          print(index);
          String name, addr1, addr2, category, id;
          int phone;
          double lat1, lng1;
          bool menuTF;
          DocumentSnapshot marketData = dataList[index];
          try {
            name = marketData['name'];
            addr1 = marketData['addr1'];
            addr2 = marketData['addr2'];
            phone = marketData['phone'];
            category = marketData['category'];
            id = marketData.documentID;
            lat1 = marketData['position']['geopoint'].latitude;
            lng1 = marketData['position']['geopoint'].longitude;
            menuTF = marketData['menu'];
          } catch (_) {
            phone = 0;
          }
          if (dataSet.isSelect()) {
            if (category != dataSet.getSelectedCategory()) {
              return SizedBox(
                height: 0,
                width: 0,
              );
            }
          }

          return Slidable(
            actionPane: SlidableDrawerActionPane(),
            actionExtentRatio: 0.25,
            child: Container(

              child: Column(~~~~~)
         );
        },
      ),
    );
  }

我不明白为什么该错误不会立即发生。 在代码中间,您可以看到dataSet.isSelect() 我有一个列表,其中包含每个数据的类别 因此,当我选择一个特定类别时,该小部件仅显示少数数据,用户已选择了类别 但是先是几次工作,然后(我不知道是什么原因导致错误)发生了错误

0 个答案:

没有答案