颤振-布局

时间:2019-04-17 18:58:32

标签: android mobile dart flutter flutter-layout

I / flutter(8622):渲染库引起的异常CA ══════════════════════════ I / flutter(8622):在performLayout()期间引发了以下断言: I /颤振(8622):BoxConstraints强制无限宽度。 I / flutter(8622):这些无效约束由RenderAnimatedOpacity的layout()函数提供给 I / flutter(8622):以下函数,该函数可能计算出有问题的无效约束: I / Flutter(8622):_RenderDecoration._layout.layoutLineBox(包:flutter / src / material / input_decorator.dart:819:11) I / flutter(8622):令人讨厌的约束是: I /颤振(8622):BoxConstraints(w = Infinity,0.0 <= h <= Infinity) I /颤振(8622): I / flutter(8622):引发异常时,这是堆栈: I / flutter(8622):#0 BoxConstraints.debugAssertIsValid..throwError(package:flutter / src / rendering / box.dart:504:9) I /颤振(8622):#1 BoxConstraints.debugAssertIsValid。 (包:flutter / src / rendering / box.dart:545:21) I / flutter(8622):#2 BoxConstraints.debugAssertIsValid(包:flutter / src / rendering / box.dart:551:6) I / flutter(8622):#3 RenderObject.layout(package:flutter / src / rendering / object.dart:1547:24) I / flutter(8622):#4 _RenderDecoration._layout.layoutLineBox(包:flutter / src / material / input_decorator.dart:819:11) I / flutter(8622):#5 _RenderDecoration._layout(package:flutter / src / material / input_decorator.dart:857:18) I / flutter(8622):#6 _RenderDecoration.performLayout(package:flutter / src / material / input_decorator.dart:987:44) I / flutter(8622):#7 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#8 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#9 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#10 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#11 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#12 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#13 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#14 RenderFlex.performLayout(package:flutter / src / rendering / flex.dart:738:15) I / flutter(8622):#15 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#16 RenderFlex.performLayout(package:flutter / src / rendering / flex.dart:738:15) I / flutter(8622):#17 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#18 RenderPositionedBox.performLayout(package:flutter / src / rendering / shifted_box.dart:385:13) I / flutter(8622):#19 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#20 RenderPadding.performLayout(package:flutter / src / rendering / shifted_box.dart:199:11) I / flutter(8622):#21 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#22 MultiChildLayoutDelegate.layoutChild(包:flutter / src / rendering / custom_layout.dart:142:11) I / flutter(8622):#23 _ScaffoldLayout.performLayout(package:flutter / src / material / scaffold.dart:350:7) I / flutter(8622):#24 MultiChildLayoutDelegate._callPerformLayout(package:flutter / src / rendering / custom_layout.dart:212:7) I / flutter(8622):#25 RenderCustomMultiChildLayoutBox.performLayout(package:flutter / src / rendering / custom_layout.dart:356:14) I / flutter(8622):#26 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#27 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#28 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#29 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#30 _RenderCustomClip.performLayout(package:flutter / src / rendering / proxy_box.dart:1206:11) I / flutter(8622):#31 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#32 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#33 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#34 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#35 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#36 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#37 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#38 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#39 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#40 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#41 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#42 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#43 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#44 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout(package:flutter / src / rendering / proxy_box.dart:105:13) I / flutter(8622):#45 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#46 RenderOffstage.performLayout(package:flutter / src / rendering / proxy_box.dart:3030:14) I / flutter(8622):#47 RenderObject.layout(package:flutter / src / rendering / object.dart:1632:7) I / flutter(8622):#48 RenderStack.performLayout(package:flutter / src / rendering / stack.dart:510:15) I / flutter(8622):#49 RenderObject._layoutWithoutResize(package:flutter / src / rendering / object.dart:1507:7) I / flutter(8622):#50 PipelineOwner.flushLayout(package:flutter / src / rendering / object.dart:766:18) I / flutter(8622):#51 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame(package:flutter / src / rendering / binding.dart:329:19) I / flutter(8622):#52 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame(package:flutter / src / widgets / binding.dart:701:13) I / flutter(8622):#53 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback(package:flutter / src / rendering / binding.dart:268:5) I / flutter(8622):#54 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback(包:flutter / src / scheduler / binding.dart:988:15) I / flutter(8622):#55 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame(package:flutter / src / scheduler / binding.dart:928:9) I / flutter(8622):#56 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame(package:flutter / src / scheduler / binding.dart:840:5) I / flutter(8622):#60 _invoke(dart:ui / hooks.dart:209:10) I / Flutter(8622):#61 _drawFrame(dart:ui / hooks.dart:168:3) I / flutter(8622):(从dart:async包中删除了3帧) I /颤振(8622): I / flutter(8622):引发异常时,正在处理以下RenderObject: I / Flutter(8622):_RenderDecoration#e7960 relayoutBoundary = up8 NEEDS-LAYOUT NEEDS-PAINT I / flutter(8622):创建者:_Decorator←InputDecorator←AnimatedBuilder←Listener←RawGestureDetector← I / flutter(8622):GestureDetector←TextSelectionGestureDetector←IgnorePointer←语义←TextField←行← I /颤振(8622):列←⋯ I / flutter(8622):parentData:(可以使用大小) I / flutter(8622):约束:BoxConstraints(无约束) I /颤振(8622):大小:MISSING I / flutter(8622):此RenderObject具有以下子孙(显示到深度5): I / flutter(8622):RenderRepaintBoundary#cf635 NEEDS-LAYOUT NEEDS-PAINT I / flutter(8622):RenderRepaintBoundary#d2e21需要布局需要油漆 I / flutter(8622):RenderCustomPaint#0795f NEEDS-LAYOUT NEEDS-PAINT I / flutter(8622):RenderRepaintBoundary#d5989需求布局需求油漆 I / flutter(8622):RenderPointerListener#c4dea NEEDS-LAYOUT NEEDS-PAINT I / Flutter(8622):RenderTransform#4b8f2 relayoutBoundary = up9 NEEDS-PAINT I / flutter(8622):RenderAnimatedOpacity#ecabe relayoutBoundary = up10 NEEDS-PAINT I / Flutter(8622):RenderParagraph#f9e47 relayoutBoundary = up11 NEEDS-PAINT I / flutter(8622):RenderAnimatedOpacity#353ec NEEDS-LAYOUT NEEDS-PAINT I / flutter(8622):RenderParagraph#90160需求布局需求油漆 I / flutter(8622):RenderConstrainedBox#1bf14需要布局需要油漆 I / flutter(8622):RenderCustomPaint#748f9需要布局的需要油漆 I /颤振(8622):═══════════════════════════════════════════ ══════════════════════════════════════════════════ ═══════ I / flutter(8622):引发了另一个异常:未布置RenderBox:_RenderDecoration#e7960 relayoutBoundary = up8 NEEDS-PAINT I / flutter(8622):引发了另一个异常:未布置RenderBox:RenderPointerListener#503e8 relayoutBoundary = up7 NEEDS-PAINT I / flutter(8622):引发了另一个异常:未布置RenderBox:RenderIgnorePointer#9317f relayoutBoundary = up6 NEEDS-PAINT I / flutter(8622):引发了另一个异常:未布置RenderBox:RenderSemanticsAnnotations#d9867 relayoutBoundary = up5 NEEDS-PAINT I / flutter(8622):引发了另一个异常:未布置RenderBox:RenderFlex#f517a relayoutBoundary = up4 NEEDS-PAINT I / flutter(8622):引发了另一个异常:'package:flutter / src / rendering / shifted_box.dart':失败的断言:314行pos 12:'child.hasSize':不正确。 I / flutter(8622):引发了另一个异常:NoSuchMethodError:方法'<='在null上调用。

3 个答案:

答案 0 :(得分:0)

这可能由于多种原因而发生。发布一些代码,以便我们检查。同时,您可以尝试使用Expanded Flexible摆脱此类错误。

答案 1 :(得分:0)

这多数是由于没有给容器或列表视图指定高度。请检查您的代码是否相同。

答案 2 :(得分:0)

当我将一个listview放在另一个listview或任何其他种类的视图中时,这会发生在我身上,因为您无法在未定义要滚动的listview的情况下滚动其他滚动,因此您需要放置高度和宽度

要解决此问题,请将您的列表视图放在这样的Sizedbox中

 ListView(
          children: <Widget>[
            SizedBox(
            height: 150,
            width: 150,
          child: ListView(
            children: <Widget>[],
          ),
        )
          ],
        ),

希望可以为您提供帮助