- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在从 Firebase 创建水平 ListView
流时遇到问题。
这是我的代码:
...
Column(
children: [
Container(
height: 200.0,
child: StreamBuilder(
stream: Firestore.instance
.collection('users')
.snapshots(),
builder: (context, snapshot) {
int length = 0;
if(snapshot.hasData && snapshot.data.documents != null)
length = (snapshot.data.documents.length ?? 0);
return ListView.builder(
itemCount: length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return ListItemWidget(document: snapshot.data.documents[index],);
},
);
},
),
),
],
),
...
我得到这个错误:
I/flutter (28131): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (28131): The following assertion was thrown during performResize():
I/flutter (28131): Horizontal viewport was given unbounded width.
I/flutter (28131): Viewports expand in the scrolling direction to fill their container.In this case, a horizontal
I/flutter (28131): viewport was given an unlimited amount of horizontal space in which to expand. This situation
I/flutter (28131): typically happens when a scrollable widget is nested inside another scrollable widget.
I/flutter (28131): If this widget is always nested in a scrollable widget there is no need to use a viewport because
I/flutter (28131): there will always be enough horizontal space for the children. In this case, consider using a Row
I/flutter (28131): instead. Otherwise, consider using the "shrinkWrap" property (or a ShrinkWrappingViewport) to size
I/flutter (28131): the width of the viewport to the sum of the widths of its children.
I/flutter (28131): When the exception was thrown, this was the stack:
I/flutter (28131): #0 RenderViewport.performResize.<anonymous closure> (package:flutter/src/rendering/viewport.dart:1159:15)
I/flutter (28131): #1 RenderViewport.performResize (package:flutter/src/rendering/viewport.dart:1186:6)
I/flutter (28131): #2 RenderObject.layout (package:flutter/src/rendering/object.dart:1616:9)
I/flutter (28131): #3 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:108:13)
I/flutter (28131): #4 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #5 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:108:13)
I/flutter (28131): #6 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #7 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:108:13)
I/flutter (28131): #8 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #9 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:108:13)
I/flutter (28131): #10 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #11 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:108:13)
I/flutter (28131): #12 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #13 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:108:13)
I/flutter (28131): #14 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #15 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:108:13)
I/flutter (28131): #16 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #17 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:108:13)
I/flutter (28131): #18 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #19 RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:262:13)
I/flutter (28131): #20 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #21 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:199:11)
I/flutter (28131): #22 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #23 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:108:13)
I/flutter (28131): #24 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #25 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:164:27)
I/flutter (28131): #26 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #27 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:182:11)
I/flutter (28131): #28 RenderObject.layout (package:flutter/src/rendering/object.dart:1631:7)
I/flutter (28131): #29 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:405:13)
I/flutter (28131): #30 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1320:12)
I/flutter (28131): #31 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1238:20)
I/flutter (28131): #32 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1506:7)
I/flutter (28131): #33 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:765:18)
I/flutter (28131): #34 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:270:19)
I/flutter (28131): #35 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:654:13)
I/flutter (28131): #36 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
I/flutter (28131): #37 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter (28131): #38 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter (28131): #39 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
I/flutter (28131): #40 _invoke (dart:ui/hooks.dart:128:13)
I/flutter (28131): #41 _drawFrame (dart:ui/hooks.dart:117:3)
I/flutter (28131): The following RenderObject was being processed when the exception was fired:
I/flutter (28131): RenderViewport#4cfa1 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (28131): creator: Viewport ← _ScrollableScope ← IgnorePointer-[GlobalKey#a76da] ← Semantics ← Listener ←
I/flutter (28131): _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#8a47c] ←
I/flutter (28131): _ScrollSemantics-[GlobalKey#cab19] ← RepaintBoundary ← CustomPaint ← RepaintBoundary ←
I/flutter (28131): NotificationListener<ScrollNotification> ← ⋯
I/flutter (28131): parentData: <none> (can use size)
I/flutter (28131): constraints: BoxConstraints(0.0<=w<=Infinity, h=300.0)
I/flutter (28131): size: MISSING
I/flutter (28131): axisDirection: right
I/flutter (28131): crossAxisDirection: down
I/flutter (28131): offset: ScrollPositionWithSingleContext#8dfac(offset: 0.0, range: null..null, viewport: null,
I/flutter (28131): ScrollableState, ClampingScrollPhysics, IdleScrollActivity#91939, ScrollDirection.idle)
I/flutter (28131): anchor: 0.0
I/flutter (28131): This RenderObject had the following descendants (showing up to depth 5):
I/flutter (28131): RenderSliverPadding#e80f1 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (28131): RenderSliverList#97084 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (28131): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderViewport#4cfa1 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderViewport#4cfa1 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#df1eb relayoutBoundary=up13 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#44b85 relayoutBoundary=up12 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#96b35 relayoutBoundary=up11 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#80416 relayoutBoundary=up10 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: _RenderScrollSemantics#712c9 relayoutBoundary=up9 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#aaf0f relayoutBoundary=up8 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#a9537 relayoutBoundary=up7 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: BoxConstraints forces an infinite width.
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: _RenderListTile#6d051 relayoutBoundary=up9 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderPadding#9ebbd relayoutBoundary=up8 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#0673a relayoutBoundary=up7 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#4ee5a relayoutBoundary=up6 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#36efb relayoutBoundary=up5 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderFlex#3f9fc relayoutBoundary=up4 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: BoxConstraints forces an infinite width.
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: _RenderListTile#fb3c8 relayoutBoundary=up9 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderPadding#db36b relayoutBoundary=up8 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#56680 relayoutBoundary=up7 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#9a367 relayoutBoundary=up6 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#f9ea9 relayoutBoundary=up5 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderFlex#18660 relayoutBoundary=up4 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 441 pos 12: 'child.hasSize': is not true.
I/flutter (28131): Another exception was thrown: Horizontal viewport was given unbounded width.
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderViewport#e06d5 NEEDS-LAYOUT NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderViewport#e06d5 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#c9f49 relayoutBoundary=up13 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#710fd relayoutBoundary=up12 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#40679 relayoutBoundary=up11 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#89057 relayoutBoundary=up10 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: _RenderScrollSemantics#fa9df relayoutBoundary=up9 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#153a7 relayoutBoundary=up8 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#31069 relayoutBoundary=up7 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#ba7c8 relayoutBoundary=up6 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: BoxConstraints forces an infinite width.
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: _RenderListTile#e1115 relayoutBoundary=up9 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderPadding#ba1c6 relayoutBoundary=up8 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#f49e3 relayoutBoundary=up7 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#28bc1 relayoutBoundary=up6 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#7e4cc relayoutBoundary=up5 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderFlex#30f31 relayoutBoundary=up4 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: BoxConstraints forces an infinite width.
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: _RenderListTile#75a70 relayoutBoundary=up9 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderPadding#7e571 relayoutBoundary=up8 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#9dbc1 relayoutBoundary=up7 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#59637 relayoutBoundary=up6 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#cbb7b relayoutBoundary=up5 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderFlex#ca6b6 relayoutBoundary=up4 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 441 pos 12: 'child.hasSize': is not true.
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#ba7c8 relayoutBoundary=up6 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
I/flutter (28131): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 441 pos 12: 'child.hasSize': is not true.
I/flutter (28131): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#687b9 relayoutBoundary=up6 NEEDS-PAINT
I/flutter (28131): Another exception was thrown: NoSuchMethodError: The method '<=' was called on null.
I/flutter (28131): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 441 pos 12: 'child.hasSize': is not true.
I/flutter (28131): Another exception was thrown: NoSuchMethodError: The getter 'visible' was called on null.
I/flutter (28131): Another exception was thrown: Multiple widgets used the same GlobalKey.
I/flutter (28131): Another exception was thrown: Multiple widgets used the same GlobalKey.
I/flutter (28131): Another exception was thrown: Multiple widgets used the same GlobalKey.
E/flutter (28131): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter (28131): Cannot hit test a render box with no size.
E/flutter (28131): The hitTest() method was called on this RenderBox:
E/flutter (28131): RenderRepaintBoundary#a0721 relayoutBoundary=up3 NEEDS-PAINT
E/flutter (28131): Although this node is not marked as needing layout, its size is not set. A RenderBox object must have an explicit size before it can be hit-tested. Make sure that the RenderBox in question sets its size during layout.
E/flutter (28131): #0 RenderBox.hitTest.<anonymous closure> (package:flutter/src/rendering/box.dart:1911:9)
E/flutter (28131): #1 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1922:6)
E/flutter (28131): #2 _RenderSliverMultiBoxAdaptor&RenderSliver&ContainerRenderObjectMixin&RenderSliverHelpers.hitTestBoxChild (package:flutter/src/rendering/sliver.dart:1471:22)
E/flutter (28131): #3 RenderSliverMultiBoxAdaptor.hitTestChildren (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:455:11)
E/flutter (28131): #4 RenderSliver.hitTest (package:flutter/src/rendering/sliver.dart:1137:11)
E/flutter (28131): #5 RenderSliverPadding.hitTestChildren (package:flutter/src/rendering/sliver_padding.dart:266:20)
E/flutter (28131): #6 RenderSliver.hitTest (package:flutter/src/rendering/sliver.dart:1137:11)
E/flutter (28131): #7 RenderViewportBase.hitTestChildren (package:flutter/src/rendering/viewport.dart:572:43)
E/flutter (28131): #8 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #9 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #10 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #11 RenderIgnorePointer.hitTest (package:flutter/src/rendering/proxy_box.dart:2780:37)
E/flutter (28131): #12 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #13 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #14 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #15 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:164:19)
E/flutter (28131): #16 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #17 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #18 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #19 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #20 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #21 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #22 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #23 RenderCustomPaint.hitTestChildren (package:flutter/src/rendering/custom_paint.dart:500:18)
E/flutter (28131): #24 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #25 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #26 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #27 _RenderFlex&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2250:17)
E/flutter (28131): #28 RenderFlex.hitTestChildren (package:flutter/src/rendering/flex.dart:925:12)
E/flutter (28131): #29 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #30 _RenderStack&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2250:17)
E/flutter (28131): #31 RenderStack.hitTestChildren (package:flutter/src/rendering/stack.dart:595:12)
E/flutter (28131): #32 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #33 _RenderCustomMultiChildLayoutBox&RenderBox&Cont
E/flutter (28131): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter (28131): Cannot hit test a render box with no size.
E/flutter (28131): The hitTest() method was called on this RenderBox:
E/flutter (28131): RenderRepaintBoundary#a0721 relayoutBoundary=up3 NEEDS-PAINT
E/flutter (28131): Although this node is not marked as needing layout, its size is not set. A RenderBox object must have an explicit size before it can be hit-tested. Make sure that the RenderBox in question sets its size during layout.
E/flutter (28131): #0 RenderBox.hitTest.<anonymous closure> (package:flutter/src/rendering/box.dart:1911:9)
E/flutter (28131): #1 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1922:6)
E/flutter (28131): #2 _RenderSliverMultiBoxAdaptor&RenderSliver&ContainerRenderObjectMixin&RenderSliverHelpers.hitTestBoxChild (package:flutter/src/rendering/sliver.dart:1471:22)
E/flutter (28131): #3 RenderSliverMultiBoxAdaptor.hitTestChildren (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:455:11)
E/flutter (28131): #4 RenderSliver.hitTest (package:flutter/src/rendering/sliver.dart:1137:11)
E/flutter (28131): #5 RenderSliverPadding.hitTestChildren (package:flutter/src/rendering/sliver_padding.dart:266:20)
E/flutter (28131): #6 RenderSliver.hitTest (package:flutter/src/rendering/sliver.dart:1137:11)
E/flutter (28131): #7 RenderViewportBase.hitTestChildren (package:flutter/src/rendering/viewport.dart:572:43)
E/flutter (28131): #8 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #9 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #10 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #11 RenderIgnorePointer.hitTest (package:flutter/src/rendering/proxy_box.dart:2780:37)
E/flutter (28131): #12 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #13 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #14 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #15 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:164:19)
E/flutter (28131): #16 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #17 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #18 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #19 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #20 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #21 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #22 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #23 RenderCustomPaint.hitTestChildren (package:flutter/src/rendering/custom_paint.dart:500:18)
E/flutter (28131): #24 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #25 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
E/flutter (28131): #26 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #27 _RenderFlex&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2250:17)
E/flutter (28131): #28 RenderFlex.hitTestChildren (package:flutter/src/rendering/flex.dart:925:12)
E/flutter (28131): #29 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #30 _RenderStack&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2250:17)
E/flutter (28131): #31 RenderStack.hitTestChildren (package:flutter/src/rendering/stack.dart:595:12)
E/flutter (28131): #32 RenderBox.hitTest (package:flutter/src/rendering/box.dart:1924:11)
E/flutter (28131): #33 _RenderCustomMultiChildLayoutBox&RenderBox&Cont
但是,如果我使用 scrollDirection: Axis.vertical
而不是 Axis.horizontal
,它就可以正常工作。或者,如果我像这样使用常规 ListView
,它也可以工作:
...
Column(
children: [
Container(
height: 200.0,
child: ListView(
scrollDirection: Axis.horizontal,
children: [
Container(width: 160.0, color: Colors.red,),
Container(width: 160.0, color: Colors.orange,),
Container(width: 160.0, color: Colors.pink,),
Container(width: 160.0, color: Colors.yellow,),
],
),
),
],
),
...
这感觉像是一个愚蠢的问题,但我不知道我做错了什么。
最佳答案
此问题的原因是 ListView
的宽度不受限制。由于小部件水平滚动,因此应定义有限宽度。当小部件无法填充屏幕上的有限尺寸时,会发生此错误。您可以在 ListView
上设置宽度或尝试使用 Expanded
小部件。
要获取屏幕的宽度尺寸,您可以使用 LayoutBuilder
或 MediaQuery
.
关于flutter - 水平 ListView 流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52722128/
我之前在论坛上发布过这个,但我想我不太清楚。我有一个侧边栏 ListView 和一个包含我的控件的主面板。我想在 oncreate() 中突出显示 listview 中的 Activity 项,因为每
这里有没有人知道我如何通过 onTap() 扩展 ListView 项(在本例中为卡片)的内容 - 以显示更多选项?您知道那里有可以提供帮助的酒吧吗? 我已经看过了,但我不知道要搜索什么?我相信你们都
我的 ListView 控件有问题。我希望我的奇数行和偶数行具有不同的颜色,但我想通过代码而不是 FXML 来实现。例如: 第一行 - 绿色 第二行 - 红色 第三行 - 绿色 第四行 - 红色 现在
我有一个 ListView 。我想让单元格背景透明。目前,我正在做以下事情: .list-cell { -fx-background-color: transparent; } 但是,细胞的颜
我想创建一个几乎无限的元素列表,但我想将列表的初始位置设置为某个特定元素。像这张图片: 其中索引 0 将是初始位置,并且此列表可能会也可能不会在两个方向上延伸很长。 我可以像这样创建我的元素: W
有没有办法在JavaFX中获取ListView的可见项?我想确定 JavaFX 应用程序中 ListView 显示的第一个可见项。 以下代码found here不适合我(仅适用于 TableView)
开发人员。 我尝试在水平方向拉伸(stretch) ListView 项目。我确实重置了 ItemContainerStyle ,并且水平对齐是拉伸(stretch)的。这是 MainPage.xam
有没有办法在JavaFX中获取ListView的可见项?我想确定 JavaFX 应用程序中 ListView 显示的第一个可见项。 以下代码found here不适合我(仅适用于 TableView)
我想问一下: 我有一个预定义顺序的数组。 var order=new Array(); order[0]="Tesco"; order[1]="Interspar"; order[2]="
我希望创建以下内容:当到达内部 Listview 的顶部或底部时,我想继续在顶部 Listview 中滚动。见动图: Gif of what I got so far 一个选项是在到达底部时将内部 L
我正在尝试在 ajax 发布后刷新 jQuery 移动 ListView ,我一直在尝试使用 .trigger("create") 来执行此操作,如下所示: Most Played
我真的不明白是什么导致了错误我检查了文档,这里有一个非常相似的例子是我的 views.py,我使用的应用程序下的 urls.py 包含,以及模板 View .py class SchoolListVi
我有这个父布局 parent_listview 的列表项具有这种布局 child_listview 的项目有这个布局
我在单击列表项时获取 listview 项 时遇到问题。我得到了 simple listview(Arrayadapter) 的 listview item,但我遇到了 custom listview
我有一个工作正常的 DropdownMenu,但我需要一个 ListView,但我无法转换它。 DropdownMenu 如下所示: // Create the List of devices t
我想实现一个可滚动(垂直)且其中包含元素的屏幕。所以我把它放在 listview.builder 上。问题是,其中一个元素是另一个水平滚动的 listview.builder。当我实现它时,horiz
帮助!我想不通! 为了帮助我学习 SwiftUI,我正在使用 ListView 制作一个简单的杂货 list 应用程序。点击列表中的每个项目时,有些按钮会变成绿色或红色。 在我向列表数组中添加太多项目
所以我知道我们可以等待 ListView 加载,然后显示它。但是,如果我们动态加载正在下载的图像,ListView 将加载但图像尚未加载,因此它们不会出现在 ListView 中。 可接受的等待 Li
我是 Android 的新手,正在努力提高编程技能。 在这里,我有自定义 ListView 适配器类,我曾在其中显示 ListView 项目,如 TextView 、图像等。 我需要做的是,我在 Li
So, what I want is to individually disable a button for the concerned item in the ListView when clic
我是一名优秀的程序员,十分优秀!