- 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/
我目前正在研究一个项目欧拉问题(www.projecteuler.net),但遇到了一个绊脚石。其中一个问题提供了一个 20x20 的数字网格,并要求直线上 4 个数字的最大乘积。这条线可以是水平的、
我有两个表,我需要从每个表中选择一列。 这必须在单个查询中完成。 好消息是这两列以正确的方式排序,并且它们都包含相同数量的行。 现在,我知道我可以通过 rowid 加入两个表,但它很慢,因为它必须进行
我想在我的 iPad 应用程序中实现一个布局,该布局具有一个可左右滚动而不是上下滚动的合适 View : 所以而不是 第 1 行第 2 行第 3 行(垂直滚动)这将是 :第 1 行、第 2 行、第 3
我有五个尺寸的图像:600x30、600x30、600x30、600x30、810x30。它们的名称分别是:0.png、1.png、2.png、3.png、4.png。 如何使用 ImageMagic
我正在寻找一个选项来滚动多个列表(水平),如附件中的图片所示。您可以向左或向右滑动以进入下一个 ListView 。顶部应该有一些按钮可以单击或滚动 我尝试将 ListViews 放入类似此代码的内容
这些值之间是否存在数学关系?如果我知道 hFOV 和 vFOV,我可以计算对角 FOV 而不涉及焦距等其他值吗? 我的第一个想法是使用毕达哥拉斯定理,但也许这是错误的。 最佳答案 感兴趣的物理量是传感
我正在尝试在 game_width=640 和 game_height=480 的窗口内绘制网格。网格单元的数量是预定义的。我想在水平和垂直方向上均匀分布单元格。 void GamePaint(HDC
你好,我已经发布了我的 iphone 应用程序 Micro-Pitch,现在正在将它移植到 android 上。我不知道如何在 ScrollView 中画线,想知道我做错了什么。 这是我的 Scrol
如果您访问我的网站:www.ryancoughlin.com - 如果您在页面右侧看到 Google、Yahoo 等 RSS 按钮。我试图让它们均匀对齐,它们的图像高度都相同,我一直试图让它们均匀对齐
我想将此 Material 水平居中: 最佳答案 将 text-align:center 添加到您的 anchor 。我假设您的 zoom1 具有 display
我正在努力做到这一点,以便我的旋转木马可以与其他文本共享一个水平行,但由于某种原因它无法正常工作,当它设置为 40% 时它占据了 100% 的宽度。 我将在下面发布代码和屏幕截图。 在上图中,它显示了
问题来了。我正在尝试放置一些 彼此相邻的元素。 div 的宽度s 未指定,取决于它们的内容。我正在使用下面的 CSS 代码来定位 彼此相邻: #div{ height: 50px; f
我正在尝试使用这样的 Bootstrap 并排打印表格 但是当我尝试打印预览时,我得到了这个 我的代码如下。我尝试了所有可能的解决方案,但我不知道为什么我无法打印我看到的页面。请指导我解决这个问题。
我想知道是否可以在背景中使用两种不同的颜色,并通过 Bootstrap 在每一侧扩展 100%。 这是我的意思的截图, 左侧为红色,右侧为深色,为更大的屏幕放大 100%。有什么简单的解决方案吗? 最
我正在尝试制作一个包含所有事件的滚动触发的整个网站。我只需要帮助来实现这种效果: 我有一个网站,其中包含一些填满所有视口(viewport)的 div,我希望用户能够向下滚动到一个命名的 div,然后
我的代码是 Show All Show Valid Show Pending Save Clear Download As CSV 我希望那些输入日期和按钮在 class="buttons" di
我在玩这个想法: 在这个 block 中我有 2 作为按钮和 并尝试了 float荷兰国际集团他们让他们粘在一起。实现这种效果的主要思想是操纵 ul 的宽度/显示状态。或者只是菜单部分。 Log
这个问题在这里已经有了答案: How can I horizontally center an element? (134 个回答) 关闭 4 年前。
我遇到了一个 CSS 问题,需要帮助。我在目录中有许多不同大小的图像,我正在动态列出它们以显示以下 View :(我仅显示两个图像作为示例) 这是我的 HTML:
这个问题在这里已经有了答案: 关闭 9 年前。 Possible Duplicate: How can I make a horizontal ListView in Android? 我已经多次使
我是一名优秀的程序员,十分优秀!