我无法在堆栈小部件中使用flutter_swiper出现渲染框错误?

时间:2020-07-31 16:37:04

标签: firebase flutter flutter-layout flutter-dependencies flutter-widget

我在卡片小部件中随附的堆栈小部件中使用此刷卡器

Swiper(
        itemBuilder: (BuildContext context, int index) {
          return new Container(
            // margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
            decoration: BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(16)),
                border: Border.all(
                  color: Colors.grey,
                )),
            child: ClipRRect(
              borderRadius: BorderRadius.all(Radius.circular(16)),
              child: CachedNetworkImage(
                imageUrl: post.mediaUrl,
              ),
            ),
          );
        },
        itemCount: 10,
        viewportFraction: 0.8,
        scale: 0.9,
      ),

错误如下:

════════ Exception caught by scheduler library      ═════════════════════════════════════════════════════
 RenderBox was not laid out: RenderRepaintBoundary#4a53c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE DETACHED
'package:flutter/src/rendering/box.dart': Failed assertion: line 1694
pos 12: 'hasSize'

应用父数据时引发了以下断言: 错误使用ParentDataWidget。

ParentDataWidget Expanded(flex:1)要应用的ParentData 将FlexParentData类型设置为已设置的RenderObject 接受不兼容类型StackParentData的ParentData。

通常,这表示扩展窗口小部件的祖先错误 RenderObjectWidget。通常,扩展小部件直接放置 在Flex小部件中。违规扩展目前位于内部 堆栈小部件。

已接收到RenderObject的所有权链 不兼容的父数据为:RepaintBoundary← NotificationListener←GlowingOverscrollIndicator ←可滚动←NotificationListener←PageView← NotificationListener←TransformerPageView← 刷卡←展开←⋯

0 个答案:

没有答案