Flutter SingleChildScrollView内的颤振柱不';卷轴

Flutter SingleChildScrollView内的颤振柱不';卷轴,flutter,dart,material-design,Flutter,Dart,Material Design,当我尝试在SingleScrollChildView中使用卡时,我遇到以下错误: The following assertion was thrown during layout: A RenderFlex overflowed by 178 pixels on the bottom. The relevant error-causing widget was: Column file:///C:/Users/emirs/AndroidStudioProjects/view_met/li

当我尝试在SingleScrollChildView中使用卡时,我遇到以下错误:

The following assertion was thrown during layout:
A RenderFlex overflowed by 178 pixels on the bottom.

The relevant error-causing widget was: 
  Column file:///C:/Users/emirs/AndroidStudioProjects/view_met/lib/home.dart:197:16
The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.

Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.

The specific RenderFlex in question is: RenderFlex#d861f relayoutBoundary=up2 OVERFLOWING
...  needs compositing
...  parentData: offset=Offset(0.0, 0.0) (can use size)
...  constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=820.6)
...  size: Size(411.4, 820.6)
...  direction: vertical
...  mainAxisAlignment: start
...  mainAxisSize: max
...  crossAxisAlignment: center
...  verticalDirection: down
◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
结果是:


我也看了其他的问题,但没有一个真正有帮助,他们也没有我想要的答案。我真的不知道现在该怎么办。我将感谢任何形式的帮助。如果需要,我可以提供更多信息。

请尝试下面的代码

 Padding(
              padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
              child: Stack(
                children: [
                  Align(
                    alignment:Alignment.topCenter,
                      child: Text("Random Items You Could Like", style: GoogleFonts.merriweather(fontSize: 18, color: Colors.black))),
                  SingleChildScrollView(
                    scrollDirection: Axis.vertical,
                    child: Column(
                      children: <Widget>[
                        Column(
                          children: <Widget>[
                            builder(randint1.toString()),
                            builder(randint2.toString()),
                            builder(randint3.toString()),
                            builder(randint4.toString()),
                            builder(randint5.toString()),
                          ],
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            )
填充(
填充:来自LTRB(0,20,0,0)的边插入集,
子:堆栈(
儿童:[
对齐(
对齐:alignment.topCenter,
孩子:文本(“你可能喜欢的随机项目”,样式:GoogleFonts.merriweather(fontSize:18,颜色:Colors.black)),
SingleChildScrollView(
滚动方向:轴垂直,
子:列(
儿童:[
纵队(
儿童:[
生成器(randint1.toString()),
生成器(randint2.toString()),
生成器(randint3.toString()),
生成器(randint4.toString()),
生成器(randint5.toString()),
],
),
],
),
),
],
),
)

在下面尝试代码

 Padding(
              padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
              child: Stack(
                children: [
                  Align(
                    alignment:Alignment.topCenter,
                      child: Text("Random Items You Could Like", style: GoogleFonts.merriweather(fontSize: 18, color: Colors.black))),
                  SingleChildScrollView(
                    scrollDirection: Axis.vertical,
                    child: Column(
                      children: <Widget>[
                        Column(
                          children: <Widget>[
                            builder(randint1.toString()),
                            builder(randint2.toString()),
                            builder(randint3.toString()),
                            builder(randint4.toString()),
                            builder(randint5.toString()),
                          ],
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            )
填充(
填充:来自LTRB(0,20,0,0)的边插入集,
子:堆栈(
儿童:[
对齐(
对齐:alignment.topCenter,
孩子:文本(“你可能喜欢的随机项目”,样式:GoogleFonts.merriweather(fontSize:18,颜色:Colors.black)),
SingleChildScrollView(
滚动方向:轴垂直,
子:列(
儿童:[
纵队(
儿童:[
生成器(randint1.toString()),
生成器(randint2.toString()),
生成器(randint3.toString()),
生成器(randint4.toString()),
生成器(randint5.toString()),
],
),
],
),
),
],
),
)

展开的
包装
SingleChildScrollView

Column(
  children: [
    // ...
    Expanded(
      child: SingleChildScrollView(),
    ),
  ],
),

SingleChildScrollView
Expanded
包装

Column(
  children: [
    // ...
    Expanded(
      child: SingleChildScrollView(),
    ),
  ],
),

我认为您错误地使用了
SingleChildScrollView
,请删除
SingleChildScrollView
和scrollDirection;使用它来包装此零件:

Column(
                          children: <Widget>[
                            builder(randint1.toString()),
                            builder(randint2.toString()),
                            builder(randint3.toString()),
                            builder(randint4.toString()),
                            builder(randint5.toString()),
                          ],
列(
儿童:[
生成器(randint1.toString()),
生成器(randint2.toString()),
生成器(randint3.toString()),
生成器(randint4.toString()),
生成器(randint5.toString()),
],
看起来是这样的:

SingleChildScrollView(
                    scrollDirection: Axis.vertical,
Column(
                          children: <Widget>[
                            builder(randint1.toString()),
                            builder(randint2.toString()),
                            builder(randint3.toString()),
                            builder(randint4.toString()),
                            builder(randint5.toString()),
                          ],
),
SingleChildScrollView(
滚动方向:轴垂直,
纵队(
儿童:[
生成器(randint1.toString()),
生成器(randint2.toString()),
生成器(randint3.toString()),
生成器(randint4.toString()),
生成器(randint5.toString()),
],
),

我认为您错误地使用了
SingleChildScrollView
,请删除
SingleChildScrollView
和scrollDirection;使用它包装此部分:

Column(
                          children: <Widget>[
                            builder(randint1.toString()),
                            builder(randint2.toString()),
                            builder(randint3.toString()),
                            builder(randint4.toString()),
                            builder(randint5.toString()),
                          ],
列(
儿童:[
生成器(randint1.toString()),
生成器(randint2.toString()),
生成器(randint3.toString()),
生成器(randint4.toString()),
生成器(randint5.toString()),
],
看起来是这样的:

SingleChildScrollView(
                    scrollDirection: Axis.vertical,
Column(
                          children: <Widget>[
                            builder(randint1.toString()),
                            builder(randint2.toString()),
                            builder(randint3.toString()),
                            builder(randint4.toString()),
                            builder(randint5.toString()),
                          ],
),
SingleChildScrollView(
滚动方向:轴垂直,
纵队(
儿童:[
生成器(randint1.toString()),
生成器(randint2.toString()),
生成器(randint3.toString()),
生成器(randint4.toString()),
生成器(randint5.toString()),
],
),

这很有效,非常感谢。我有一个错误,但我在另一个问题上用这个答案修复了它:这很有效,非常感谢。我有一个错误,但我在另一个问题上用这个答案修复了它: