- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我有一个包含三个选项卡的屏幕。我的第三个选项卡应该有根据收到的数据构建的小部件。所以我有以下类,其中包含该特定选项卡的 ListView.builder。
class ThirdFormEdit extends StatelessWidget {
ThirdFormEdit({Key key, this.title}) : super(key: key);
final String title;
Map<dynamic,dynamic> _values = new Map();
@override
Widget build(BuildContext context) {
final FormsInheritedWidgetState state = FormsInheritedWidget.of(context,true);
_values = state.editableAllValues["ThirdForm"];
return ListView.builder(
itemCount: _values.length,
itemBuilder: (context, index) {
return Text("Test",style: TextStyle(color: Colors.black));
}
);
}
}
这个类在这里被称为 TabBarView 的子类:
DefaultTabController(
length: 3,
child: Scaffold(
body: TabBarView(
children: <Widget>[
SingleChildScrollView(child: FirstFormEdit(title: "Edit First Form",),),
Text("Second Form"),
SingleChildScrollView(child: ThirdFormEdit(title: "Edit First Form",),),
],
),
),
);
当我打开选项卡时,出现以下错误:
I/flutter (22554): Another exception was thrown: Vertical viewport was given unbounded height.
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderViewport#8e25e NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderViewport#8e25e NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#b8d17 relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#fcf71 relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#14047 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#3ea95 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#47980 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: _RenderScrollSemantics#d5f2c relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#bff38 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#cb5c4 relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#bfb82 relayoutBoundary=up1 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: _RenderSingleChildViewport#19173 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderIgnorePointer#2c868 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderSemanticsAnnotations#7623a NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#c443d NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#12cd3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#8701f NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: _RenderScrollSemantics#1935e NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#684e0 NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderCustomPaint#0fa83 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#7440e NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#04e1a NEEDS-PAINT
NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (22554): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 549 pos 12: 'child.hasSize': is not true.
I/flutter (22554): Another exception was thrown: RenderBox was not laid out: RenderIndexedSemantics#c8dd5 NEEDS-PAINTI/flutter (22554): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 549 pos 12: 'child.hasSize': is not true.
E/flutter (22554): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: Cannot hit test a render box with no size.
E/flutter (22554): The hitTest() method was called on this RenderBox: RenderIndexedSemantics#c8dd5 NEEDS-PAINT:
E/flutter (22554): needs compositing
E/flutter (22554): creator: IndexedSemantics ← NotificationListener<KeepAliveNotification> ← KeepAlive ← AutomaticKeepAlive ← KeyedSubtree-[Key <[<2>]>] ← SliverFillViewport ← Viewport ← IgnorePointer-[GlobalKey#2927f] ← Semantics ← Listener ← _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#8660e] ← ⋯
E/flutter (22554): parentData: index=2; layoutOffset=720.0
E/flutter (22554): constraints: BoxConstraints(w=360.0, h=552.0)
E/flutter (22554): semantic boundary
E/flutter (22554): size: MISSING
E/flutter (22554): index: 2
E/flutter (22554): Although this node is not marked as needing layout, its size is not set.
E/flutter (22554): 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 (22554): #0 RenderBox.hitTest.<anonymous closure> (package:flutter/src/rendering/box.dart:2119:9)
E/flutter (22554): #1 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2134:6)
E/flutter (22554): #2 _RenderSliverMultiBoxAdaptor&RenderSliver&ContainerRenderObjectMixin&RenderSliverHelpers.hitTestBoxChild.<anonymous closure> (package:flutter/src/rendering/sliver.dart:1636:22)
E/flutter (22554): #3 BoxHitTestResult.addWithRawTransform (package:flutter/src/rendering/box.dart:797:31)
E/flutter (22554): #4 BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:754:12)
E/flutter (22554): #5 _RenderSliverMultiBoxAdaptor&RenderSliver&ContainerRenderObjectMixin&RenderSliverHelpers.hitTestBoxChild (package:flutter/src/rendering/sliver.dart:1632:19)
E/flutter (22554): #6 RenderSliverMultiBoxAdaptor.hitTestChildren (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:564:11)
E/flutter (22554): #7 RenderSliver.hitTest (package:flutter/src/rendering/sliver.dart:1279:11)
E/flutter (22554): #8 RenderViewportBase.hitTestChildren.<anonymous closure> (package:flutter/src/rendering/viewport.dart:585:24)
E/flutter (22554): #9 BoxHitTestResult.addWithRawTransform (package:flutter/src/rendering/box.dart:797:31)
E/flutter (22554): #10 BoxHitTestResult.addWithPaintTransform (package:flutter/src/rendering/box.dart:725:12)
E/flutter (22554): #11 RenderViewportBase.hitTestChildren (package:flutter/src/rendering/viewport.dart:581:33)
E/flutter (22554): #12 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2136:11)
E/flutter (22554): #13 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:114:19)
E/flutter (22554): #14 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2136:11)
E/flutter (22554): #15 RenderIgnorePointer.hitTest (package:flutter/src/rendering/proxy_box.dart:2972:37)
E/flutter (22554): #16 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:114:19)
E/flutter (22554): #17 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2136:11)
E/flutter (22554): #18 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:114:19)
E/flutter (22554): #19 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:161:19)
E/flutter (22554): #20 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:114:19)
E/flutter (22554): #21 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2136:11)
E/flutter (22554): #22 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:114:19)
E/flutter (22554): #23 RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:161:19)
E/flutter (22554): #24 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:114:19)
E/flutter (22554): #25 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2136:11)
E/flutter (22554): #26 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:114:19)
E/flutter (22554): #27 RenderBox.hitTest (package:flutter/src/rendering/box.dart:2136:11)
E/flutter (22554): #28 _RenderProxyBox&
我试过将 ListView.builder() 放入 SizedBox 中,但没有成功。我知道错误与小部件的大小有关,但我不知道如何准确解决它。
最佳答案
经过几个小时的搜索,我找到了解决方案。为了让 ListView 工作,我必须做 Olaf Schlüter说(删除 SingleChildScrollView
作为我的小部件的 parnet)加上将 shrinkWrap
属性添加到我的 ListView 中,值为 true。
我遇到的另一个问题是 ListView 不再可滚动。再次解决方案是将 physics
属性添加到值为 BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics())
的 ListView。
关于TabBarView 中的 Flutter ListView.builder 抛出 hitTest 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57316083/
我一直在尝试使用标签更改应用栏标题的许多解决方案,我解决了它,但现在有一个小问题;按下选项卡时,应用栏会随选项卡而变化,但不会随选项卡 View 而变化。在选项卡栏 View 上向左或向右滑动会更改选
我使用 TabBarView 并且我注意到一些非常奇怪的事情。我在所有选项卡的小部件中放置了一些打印消息,以便在滑动选项卡时获得反馈。我得到了这些结果: 从 0 -> 1:选项卡 1 调用,选项卡 3
这是我的布局结构 这是主界面 ListView( children: [ _buildCarousel(), _buildHomeTabBar(), ], ) 这是 HomeT
如何为未选中的标签添加下划线,如下所示: https://ibb.co/mfkzKp 在这里您可以看到未选中的选项卡为灰色,选中的选项卡为蓝色。 最佳答案 我在文档中没有找到任何关于如何自定义禁用指标
我需要在 Flutter 中实现如下布局。 当用户滚动时,我希望整个布局滚动(隐藏标题和标签栏)。但是,我不能将 TabBarView 嵌套在 ListView 中,因为 TabBarView 没有限
我在 SingleChildScrollView 中创建了 TabBar。问题是我想用我的整个应用程序在 TabBarView 中创建可滚动的内容,而不是仅在 TabBarView 中滚动内容。我尝试
我想在我的 flutter 页面中添加一些标签,但没有一个只有标签的页面。 简而言之,我有一些输入字段,在它们下面我想放置我的标签。 我不断收到此错误:TabBarView 没有 TabControl
我想构建一个 UI,其中我在屏幕顶部有一些固定的小部件(在所有选项卡上可见),然后在它们下面我想要一个 TabBarView(底部有选项卡栏),这是否可能而不使您的自己的标签小部件还是 TabBarV
我的 Flutter 应用有 3 个标签页。当应用程序加载时,我希望它加载所有 3 个页面,而不仅仅是它将显示的页面。我的问题是,当滑动到我的其他选项卡时,加载内容需要一秒钟,然后它会显示动画。为这种
想要在 flutter 中克隆 playstore 首页应用栏滚动功能。 Playstore Appbar我正在尝试在 SliverAppBar 底部属性下制作一个包含静态选项卡的屏幕。每当我单击任何
我有一个包含项目列表的 TabBarView,我为每个项目分配了一个 Navigator.push 方法。目前该方法会跳转到新页面。 我的问题是,是否可以导航到 TabBarView 主体内的新页面?
Flutter 的新手,不知道如何在我的 UI 上设置大小限制,以免溢出。尝试使用选项卡制作一些不同的 UI,我在选项卡栏上方有一些组件。基本上我想要这样的东西: ------------------
我想使用 TabBar 和 BottomNavigationBar 来控制相同的 TabBarView,其主体是自定义小部件 RankingTable 的列表(仅在演示中放置一个并使用文本小部件作为第
TabBar 小部件有一个 onTap() 回调,允许检测用户何时刚刚按下了一个选项卡。这很有用,我们可以准备新的 tabView 来显示一些动态数据。 TabBar 小部件还有一个拖动功能,允许更改
我的 tabBar 有一个 StatelessWidget 小部件,其中包含 2 个 statefulWidget。问题是,当单击管理器以查看我的所有选项卡时(默认情况下登陆我的第一个选项卡),tab
我用 DefaultTabController 实现了一个基本的 TabBar 和 TabBarView,见下面的代码。 class MyApp2 extends StatelessWidget {
我有下面的代码来让 TabBarView 与条子效果一起工作。问题是当用户滚动到末尾时我需要加载更多数据。但是每次向下滚动时,_handleScrolling 函数都不会被触发。我必须再次上下滚动才能
我的问题是我想要一个 TabBarView 在 SingleChildScrollView 但它给了我这个错误:RenderFlex child 有非零弹性,但传入的高度约束是无界的。 如果我删除 S
我正在开发一个 flutter 应用程序。我有一个有六个 child 的底部栏。其中两个是 TabBar 屏幕,但我对它们有疑问。每当我在 TabBar/TabBarView 中更改选定的选项卡并移动
Check video for more clearifacation gitlab link 我的代码 import 'package:flutter/material.dart'; import
我是一名优秀的程序员,十分优秀!