gpt4 book ai didi

flutter - Flutter/Dart-RenderFlex在底部溢出了99804像素

转载 作者:行者123 更新时间:2023-12-03 02:52:10 24 4
gpt4 key购买 nike

有人可以看到为什么我在第一个 child :列上遇到此错误吗?我在构建中使用堆栈。并尝试将每个小部件包装在Flexible小部件中,但无法确定代码在哪里溢出。屏幕闪烁黄色/黑色renderflex线仅一秒钟,但随后似乎还不错。控制台中的消息令人讨厌,但开头的黄色/黑色小闪烁也是如此。

A RenderFlex overflowed by 99804 pixels on the bottom.
The relevant error-causing widget was:
Column file:///E:/FlutterProjects/myproject/lib/builders/CustomPageView.dart:47:26
这是代码。第47行是第一个 child: column
class _CustomPageViewState extends State<CustomPageView> {
Widget build(context) {
return PageView.builder(
itemCount: widget.speakcrafts.length,
itemBuilder: (context, int currentIndex) {
return createViewItem(widget.speakcrafts[currentIndex], context);
},
);
}

Widget createViewItem(SpeakContent speakcraft, BuildContext context) {
var contsize = MediaQuery.of(context).size.width * 0.60;
var contHeightsize = MediaQuery.of(context).size.height;

return Stack(
children: <Widget>[
Container(
color: Colors.black12,
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.network(
speakcraft.gavatar,
height: contsize,
width: contsize,
),
PlayerWidget2(url: kUrl),
],
),
),
],
),
),
],
);
这里是chunhunghan的ConstrainedBox建议的完整错误代码;
A RenderFlex overflowed by 99325 pixels on the right.
The relevant error-causing widget was:
Row file:///E:/FlutterProjects/speakoholic/lib/builders/CustomPageView.dart:121:25
The specific RenderFlex in question is: RenderFlex#d5393 relayoutBoundary=up8 OVERFLOWING
parentData: offset=Offset(0.0, 556.9); flex=null; fit=null (can use size)
constraints: BoxConstraints(0.0<=w<=674.9, 0.0<=h<=Infinity)
size: Size(674.9, 100000.0)
direction: horizontal
mainAxisAlignment: center
mainAxisSize: max
crossAxisAlignment: center
textDirection: ltr
verticalDirection: down
child 1: RenderErrorBox#d3900
parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
constraints: BoxConstraints(unconstrained)
size: Size(100000.0, 100000.0)
════════════════════════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════════════════════════
A RenderFlex overflowed by 100385 pixels on the bottom.
The relevant error-causing widget was:
Column file:///E:/FlutterProjects/speakoholic/lib/builders/CustomPageView.dart:49:28

最佳答案

事实证明,我不得不在该小部件的小部件树中进一步跟踪错误;

child: PlayerWidget2(url: kUrl))
PlayerWidget2中是在生成 PageViewBuilder之前为空的路径。这引发了空路径错误,从而导致renderflex错误。构建完成后,将使用路径填充空值。因此,为了消除错误,我只是向小部件添加了默认路径以填充空值,直到构建PageViewBuilder为止。

关于flutter - Flutter/Dart-RenderFlex在底部溢出了99804像素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63161056/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com