- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我有一个可点击图像的 Livtview,当点击一个图像时,它会呈现另一个页面,该页面在原始图像上方有一个文本,我试图在图像之后添加一个 ListView ,该 ListView 也可以作为第一个列表滚动,但是没有顶部图像移动或此时任何一种方式都可以。我尝试像第一页那样构建 ListView ,但它一直出现视口(viewport)错误,所以我将 shrinkwrap 添加到 ListView ,现在我在屏幕底部看到一个红色条,它不会滚动到屏幕上可见的内容屏幕。
这是第二个 ListView 所在的一些代码。
@override
Widget build(BuildContext context) {
var _children = <Widget>[
new Center(
child: new Text(widget.spec.name,
style: new TextStyle(fontSize: 30.0, fontWeight: FontWeight.bold),
),
),
new Center(
child: new Container(
padding: new EdgeInsets.only(
left: 10.0, right: 10.0, top: 20.0, bottom: 10.0),
child: new Image.asset(widget.spec.pic.assetName),
)
),
new Center(
child: new Container(
padding: new EdgeInsets.only(
left: 10.0, right: 10.0, top: 20.0, bottom: 10.0),
child: new Text('Facilities for Specialty',
style: new TextStyle(fontSize: 30.0),
textAlign: TextAlign.center,
),
),
),
new RefreshIndicator(
child: new ListView.builder(
itemBuilder: _itemBuilder,
itemCount: listcount,
shrinkWrap: true,
scrollDirection: Axis.vertical,
),
onRefresh: _onRefresh,
),
];
return new Scaffold(
appBar: new AppBar(title: new Text("My Specialty")),
body: new Column(
children: _children,
),
);
}
有人有什么想法吗?
这是shrinkWrap 为false 时的错误。但是当它真正的滚动不起作用时。
The following assertion was thrown during performResize():
I/flutter ( 1519): Vertical viewport was given unbounded height.
I/flutter ( 1519): Viewports expand in the scrolling direction to fill their container.In this case, a vertical
I/flutter ( 1519): viewport was given an unlimited amount of vertical space in which to expand. This situation
I/flutter ( 1519): typically happens when a scrollable widget is nested inside another scrollable widget.
I/flutter ( 1519): If this widget is always nested in a scrollable widget there is no need to use a viewport because
I/flutter ( 1519): there will always be enough vertical space for the children. In this case, consider using a Column
I/flutter ( 1519): instead. Otherwise, consider using the "shrinkWrap" propery (or a ShrinkWrappingViewport) to size
I/flutter ( 1519): the height of the viewport to the sum of the heights of its children.
I/flutter ( 1519):
I/flutter ( 1519): When the exception was thrown, this was the stack:
I/flutter ( 1519): #0 RenderViewport.performResize.<anonymous closure> (package:flutter/src/rendering/viewport.dart:701)
I/flutter ( 1519): #2 RenderViewport.performResize (package:flutter/src/rendering/viewport.dart:696)
I/flutter ( 1519): #3 RenderObject.layout (package:flutter/src/rendering/object.dart:1854)
I/flutter ( 1519): #4 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #5 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #6 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #7 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #8 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #9 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #10 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #11 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #12 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #13 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #14 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #15 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #16 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:544)
I/flutter ( 1519): #17 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #18 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:124)
I/flutter ( 1519): #19 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:85)
I/flutter ( 1519): #20 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:194)
I/flutter ( 1519): #21 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:338)
I/flutter ( 1519): #22 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #23 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #24 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #25 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #26 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1015)
I/flutter ( 1519): #27 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #28 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #29 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #30 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #31 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #32 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #33 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #34 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:2609)
I/flutter ( 1519): #35 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #36 RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:105)
I/flutter ( 1519): #37 RenderObject.layout (package:flutter/src/rendering/object.dart:1869)
I/flutter ( 1519): #38 RenderStack.performLayout (package:flutter/src/rendering/stack.dart:433)
I/flutter ( 1519): #39 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1746)
I/flutter ( 1519): #40 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1041)
I/flutter ( 1519): #41 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:251)
I/flutter ( 1519): #42 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:504)
I/flutter ( 1519): #43 BindingBase&SchedulerBinding&GestureBinding&ServicesBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:189)
I/flutter ( 1519): #44 BindingBase&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:688)
I/flutter ( 1519): #45 BindingBase&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:636)
I/flutter ( 1519): #46 _drawFrame (file:///b/build/slave/Linux_Engine/build/src/flutter/lib/ui/hooks.dart:70)
I/flutter ( 1519): (elided one frame from class _AssertionError)
I/flutter ( 1519):
I/flutter ( 1519): The following RenderObject was being processed when the exception was fired:
I/flutter ( 1519): RenderViewport#7f9aa NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 1519): creator: Viewport ← _ScrollableScope ← IgnorePointer-[GlobalKey#d069c] ← Listener ←
I/flutter ( 1519): _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#a4705] ←
I/flutter ( 1519): RepaintBoundary ← CustomPaint ← RepaintBoundary ← NotificationListener<ScrollNotification> ←
I/flutter ( 1519): GlowingOverscrollIndicator ← Scrollable ← ⋯
I/flutter ( 1519): parentData: <none> (can use size)
I/flutter ( 1519): constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=Infinity)
I/flutter ( 1519): size: MISSING
I/flutter ( 1519): AxisDirection.down
I/flutter ( 1519): offset: ScrollPositionWithSingleContext#0c3e5(offset: 0.0, range: null..null, viewport: null,
I/flutter ( 1519): ScrollableState, AlwaysScrollableScrollPhysics -> ClampingScrollPhysics, IdleScrollActivity#59379,
I/flutter ( 1519): ScrollDirection.idle)
I/flutter ( 1519): anchor: 0.0
I/flutter ( 1519): This RenderObject had the following child:
I/flutter ( 1519): RenderSliverList#bc50e NEEDS-LAYOUT NEEDS-PAINT
I/flutter ( 1519): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter ( 1519): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1430: 'hasSize': is not true.
I/flutter ( 1519): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1430: 'hasSize': is not true.
I/flutter ( 1519): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1430: 'hasSize': is not true.
I/flutter ( 1519): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1430: 'hasSize': is not true.
I/flutter ( 1519): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1430: 'hasSize': is not true.
I/flutter ( 1519): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1430: 'hasSize': is not true.
I/flutter ( 1519): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1430: 'hasSize': is not true.
I/flutter ( 1519): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1430: 'hasSize': is not true.
I/flutter ( 1519): Another exception was thrown: 'package:flutter/src/rendering/box.dart': Failed assertion: line 1430: 'hasSize': is not true.
最佳答案
我会将您的 RefreshIndicator
和 ListView
包装在 Expanded
中。这告诉 Flutter 他们想要消耗剩余的空间。您不需要 shrinkWrap
它。
关于dart - 渲染图像下方的可滚动列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45148378/
我有一个相当冗长的命令行程序,它需要用户输入参数,然后使用这些参数进行处理。我想做的是将程序拆分为交互式和非交互式。我试图这样做,并打算让非交互式程序“调用”交互式程序并使用结果(参数),基于这些参数
谁能解释为什么我们在构造函数的参数中使用大括号。 class Cars { String carName; bool isAuto; // create the constructor
我想知道是否有Dart函数,例如PHP的 strrev()。如果没有,您能否请向我展示任何源代码如何自行实现? 谢谢。 最佳答案 我还没有在API中找到一个新的Dart用户(截至今天下午)。但是,以任
我有一个组件,我想根据一个 bool 值绑定(bind)一个不同的 css 类。我的组件代码中有以下内容: bindCssClass(div, "open", this, "task.isOpen")
我一直在研究如何在dart中播放.wav文件,并且已经能够通过dart:html库中定义的AudioElement成功完成此操作。但是,我对使用dart:web_audio库感兴趣,并且遇到了所有这些
Dart 是否旨在实现许多与 Haxe 相同的功能,以便能够针对其他语言和运行时?它是语言和工具的既定目标还是已知目标? 最佳答案 不。Dart 专门针对 web 应用程序开发(更具体地说,客户端 w
我正在尝试让 dart 正常工作。作为编辑器,我想使用 emacs dart-mode。我有两个关于在没有 dart 编辑器的情况下使用 dart 的问题: 1) 我是否需要手动调用 dart2js,
我正在使用列表来创建墨水瓶按钮。我想将列表放在一个单独的 dart 文件中,并将该文件导入到我使用列表的文件中。我不知道如何导入列表。 https://pastebin.com/mf0kvsGu 我制
我正在编写一个 flutter 应用程序,它通过蓝牙 (FlutterBlue) 向设备发送命令。该设备控制一些 LED。通信总体上运行良好,但是:在用户界面上,我有一个控制光强度的 slider 。
我正在使用来自 Get started: command-line and server apps | Dart 的说明.运行 dart --version 时,我得到: Dart VM versio
var c 返回 3 但 10/7=1.4285,其余为 0.4285,operator % 有错误? void main() { var a = 10; var b = 7; var c
如文档中所述: The const keyword isn’t just for declaring constant variables. You can also use it to create
在 Dart 中,我如何最好地编写相当于(不可变/值/非对象) 的代码输出或引用参数 ? 例如在 C#-ish 中,我可能会编码: function void example() { int re
Dart 支持的多重继承机制有哪些? 最佳答案 不,Dart 不支持多重实现继承。 Dart 具有接口(interface),并且与大多数其他类似语言一样,它具有多个接口(interface)继承。
我正在寻找有关如何制作可以采用位置子参数的 web 组件的资源。就像是: {{value}} // this could be any uneditable element {{value}
使用polymer.dart 的Dart 应用程序的pubspec.yaml 文件如下所示(来自Polymer.dart Code Lab): name: polymer_and_dart descr
今天我决定开始学习 Dart 语言,我从 Tour 开始,那里有一个例子: // These work in a const string. const aConstNum = 0; const aC
我正在查找字符串类和其他一些资源,试图了解如何格式化字符串。首先,我试图将数字填充到字符串中,但不是精度。 例子: int a = 0, b = 5, c = 15, d = 46; String
我知道的大部分是Javascript。我相信“列表”是 Dart 最接近数组的东西,但它们在技术上是一样的吗?将它们视为数组是错误的吗?同样, map 会被视为对象吗?我意识到可能存在差异,但进行这种
现在,白色背景刺痛了我的眼睛,因为这是一个looong的黑夜。是否可以从 Dart 编辑器 (v 0.1) 更改主题(更改为更暗的主题)?选择背景颜色和语法高亮怎么样? 最佳答案 是的,这是可能的,我
我是一名优秀的程序员,十分优秀!